From d815a88e98698a849326b845c959261a5c7d4d2f Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Thu, 22 Dec 2022 10:08:40 +0000 Subject: [PATCH] 2.10.0 --- browser/bundle.js | 8149 +++++++++++++++-- dist/index.d.ts | 1 + dist/index.js | 1 + dist/index.js.map | 2 +- docs/classes/BaseEntity.html | 42 +- docs/classes/BitStream.html | 116 +- docs/classes/BitView.html | 42 +- docs/classes/ConVars.html | 12 +- docs/classes/DemoFile.html | 222 +- docs/classes/Entities.html | 138 +- docs/classes/GameEvent.html | 12 +- docs/classes/GameEvents.html | 186 +- docs/classes/GameRules.html | 38 +- docs/classes/Networkable.html | 30 +- docs/classes/Player.html | 148 +- docs/classes/Projectile.html | 44 +- docs/classes/StringTables.html | 40 +- docs/classes/Team.html | 48 +- docs/classes/UserMessages.html | 160 +- docs/classes/Weapon.html | 58 +- docs/enums/CrosshairStyle.html | 12 +- docs/enums/LifeState.html | 8 +- docs/enums/TeamNumber.html | 10 +- docs/functions/annotateEvent.html | 2 +- docs/functions/decodeCrosshairCode.html | 2 +- docs/functions/decodeShareCode.html | 2 +- .../functions/extractPublicEncryptionKey.html | 2 +- docs/functions/parseBinaryKeyValues.html | 2 +- docs/functions/parseHeader.html | 2 +- docs/interfaces/Angle2D.html | 6 +- docs/interfaces/CAI_BaseNPC.html | 34 +- docs/interfaces/CAK47.html | 44 +- docs/interfaces/CBRC4Target.html | 18 +- docs/interfaces/CBaseAnimating.html | 16 +- docs/interfaces/CBaseAnimatingOverlay.html | 20 +- docs/interfaces/CBaseAttributableItem.html | 26 +- docs/interfaces/CBaseButton.html | 10 +- docs/interfaces/CBaseCSGrenade.html | 44 +- docs/interfaces/CBaseCSGrenadeProjectile.html | 20 +- docs/interfaces/CBaseCombatCharacter.html | 32 +- docs/interfaces/CBaseCombatWeapon.html | 40 +- docs/interfaces/CBaseDoor.html | 12 +- docs/interfaces/CBaseEntity.html | 8 +- docs/interfaces/CBaseFlex.html | 24 +- docs/interfaces/CBaseGrenade.html | 18 +- docs/interfaces/CBaseParticleEntity.html | 8 +- docs/interfaces/CBasePlayer.html | 46 +- docs/interfaces/CBasePropDoor.html | 18 +- .../CBaseTeamObjectiveResource.html | 40 +- docs/interfaces/CBaseTempEntity.html | 2 +- docs/interfaces/CBaseToggle.html | 10 +- docs/interfaces/CBaseTrigger.html | 12 +- docs/interfaces/CBaseVPhysicsTrigger.html | 8 +- docs/interfaces/CBaseViewModel.html | 4 +- docs/interfaces/CBaseWeaponWorldModel.html | 4 +- docs/interfaces/CBeam.html | 8 +- docs/interfaces/CBeamSpotlight.html | 10 +- docs/interfaces/CBoneFollower.html | 10 +- docs/interfaces/CBreachCharge.html | 42 +- docs/interfaces/CBreachChargeProjectile.html | 20 +- docs/interfaces/CBreakableProp.html | 18 +- docs/interfaces/CBreakableSurface.html | 12 +- docs/interfaces/CBumpMine.html | 42 +- docs/interfaces/CBumpMineProjectile.html | 20 +- docs/interfaces/CC4.html | 44 +- docs/interfaces/CCSGameRulesProxy.html | 52 +- docs/interfaces/CCSPlayer.html | 90 +- docs/interfaces/CCSPlayerResource.html | 124 +- docs/interfaces/CCSRagdoll.html | 4 +- docs/interfaces/CCSTeam.html | 4 +- docs/interfaces/CCascadeLight.html | 4 +- docs/interfaces/CChicken.html | 22 +- docs/interfaces/CColorCorrection.html | 4 +- docs/interfaces/CColorCorrectionVolume.html | 4 +- docs/interfaces/CDEagle.html | 44 +- docs/interfaces/CDangerZone.html | 10 +- docs/interfaces/CDangerZoneController.html | 14 +- docs/interfaces/CDecoyGrenade.html | 44 +- docs/interfaces/CDecoyProjectile.html | 20 +- docs/interfaces/CDrone.html | 20 +- docs/interfaces/CDronegun.html | 18 +- docs/interfaces/CDynamicLight.html | 10 +- docs/interfaces/CDynamicProp.html | 20 +- docs/interfaces/CEconEntity.html | 34 +- docs/interfaces/CEconWearable.html | 34 +- docs/interfaces/CEmbers.html | 10 +- docs/interfaces/CEntityDissolve.html | 10 +- docs/interfaces/CEntityFlame.html | 10 +- docs/interfaces/CEntityFreezing.html | 12 +- docs/interfaces/CEntityParticleTrail.html | 12 +- docs/interfaces/CEnvAmbientLight.html | 6 +- docs/interfaces/CEnvDOFController.html | 10 +- docs/interfaces/CEnvDetailController.html | 4 +- docs/interfaces/CEnvGasCanister.html | 18 +- docs/interfaces/CEnvParticleScript.html | 18 +- docs/interfaces/CEnvProjectedTexture.html | 10 +- docs/interfaces/CEnvQuadraticBeam.html | 10 +- docs/interfaces/CEnvScreenEffect.html | 10 +- docs/interfaces/CEnvScreenOverlay.html | 10 +- docs/interfaces/CEnvTonemapController.html | 10 +- docs/interfaces/CEnvWind.html | 4 +- docs/interfaces/CFEPlayerDecal.html | 12 +- docs/interfaces/CFireCrackerBlast.html | 18 +- docs/interfaces/CFireSmoke.html | 10 +- docs/interfaces/CFireTrail.html | 10 +- docs/interfaces/CFish.html | 4 +- docs/interfaces/CFists.html | 44 +- docs/interfaces/CFlashbang.html | 44 +- docs/interfaces/CFogController.html | 4 +- docs/interfaces/CFootstepControl.html | 14 +- docs/interfaces/CFuncAreaPortalWindow.html | 10 +- docs/interfaces/CFuncBrush.html | 8 +- docs/interfaces/CFuncConveyor.html | 10 +- docs/interfaces/CFuncLadder.html | 10 +- docs/interfaces/CFuncMonitor.html | 8 +- docs/interfaces/CFuncMoveLinear.html | 12 +- docs/interfaces/CFuncOccluder.html | 4 +- docs/interfaces/CFuncReflectiveGlass.html | 8 +- docs/interfaces/CFuncRotating.html | 10 +- docs/interfaces/CFuncSmokeVolume.html | 10 +- docs/interfaces/CFuncTrackTrain.html | 8 +- docs/interfaces/CFunc_Dust.html | 6 +- docs/interfaces/CFunc_LOD.html | 10 +- docs/interfaces/CGameRulesProxy.html | 2 +- docs/interfaces/CGrassBurn.html | 10 +- docs/interfaces/CHEGrenade.html | 44 +- docs/interfaces/CHandleTest.html | 10 +- docs/interfaces/CHostage.html | 26 +- docs/interfaces/CHostageCarriableProp.html | 16 +- docs/interfaces/CIncendiaryGrenade.html | 44 +- docs/interfaces/CInferno.html | 18 +- docs/interfaces/CInfoLadderDismount.html | 8 +- docs/interfaces/CInfoMapRegion.html | 10 +- docs/interfaces/CInfoOverlayAccessor.html | 4 +- docs/interfaces/CItemCash.html | 34 +- docs/interfaces/CItemDogtags.html | 36 +- docs/interfaces/CItem_Healthshot.html | 44 +- docs/interfaces/CKnife.html | 42 +- docs/interfaces/CKnifeGG.html | 42 +- docs/interfaces/CLightGlow.html | 4 +- docs/interfaces/CMapVetoPickController.html | 30 +- docs/interfaces/CMaterialModifyControl.html | 10 +- docs/interfaces/CMelee.html | 44 +- docs/interfaces/CMolotovGrenade.html | 44 +- docs/interfaces/CMolotovProjectile.html | 22 +- docs/interfaces/CMovieDisplay.html | 10 +- docs/interfaces/CParadropChopper.html | 18 +- docs/interfaces/CParticleFire.html | 4 +- .../CParticlePerformanceMonitor.html | 10 +- docs/interfaces/CParticleSystem.html | 12 +- docs/interfaces/CPhysBox.html | 8 +- docs/interfaces/CPhysBoxMultiplayer.html | 10 +- docs/interfaces/CPhysMagnet.html | 16 +- docs/interfaces/CPhysPropAmmoBox.html | 20 +- docs/interfaces/CPhysPropLootCrate.html | 22 +- docs/interfaces/CPhysPropRadarJammer.html | 20 +- docs/interfaces/CPhysPropWeaponUpgrade.html | 20 +- docs/interfaces/CPhysicsProp.html | 18 +- docs/interfaces/CPhysicsPropMultiplayer.html | 20 +- docs/interfaces/CPlantedC4.html | 18 +- docs/interfaces/CPlasma.html | 10 +- docs/interfaces/CPlayerPing.html | 10 +- docs/interfaces/CPlayerResource.html | 22 +- docs/interfaces/CPointCamera.html | 10 +- docs/interfaces/CPointCommentaryNode.html | 18 +- docs/interfaces/CPointWorldText.html | 10 +- docs/interfaces/CPoseController.html | 14 +- docs/interfaces/CPostProcessController.html | 12 +- docs/interfaces/CPrecipitation.html | 10 +- docs/interfaces/CPrecipitationBlocker.html | 8 +- docs/interfaces/CPredictedViewModel.html | 4 +- docs/interfaces/CPropCounter.html | 18 +- docs/interfaces/CPropDoorRotating.html | 18 +- docs/interfaces/CPropJeep.html | 20 +- docs/interfaces/CPropVehicleDriveable.html | 18 +- docs/interfaces/CProp_Hallucination.html | 18 +- docs/interfaces/CRagdollManager.html | 4 +- docs/interfaces/CRagdollProp.html | 18 +- docs/interfaces/CRagdollPropAttached.html | 20 +- docs/interfaces/CRopeKeyframe.html | 4 +- docs/interfaces/CSCAR17.html | 44 +- docs/interfaces/CSceneEntity.html | 8 +- docs/interfaces/CSensorGrenade.html | 44 +- docs/interfaces/CSensorGrenadeProjectile.html | 20 +- docs/interfaces/CShadowControl.html | 4 +- docs/interfaces/CSlideshowDisplay.html | 12 +- docs/interfaces/CSmokeGrenade.html | 44 +- docs/interfaces/CSmokeGrenadeProjectile.html | 22 +- docs/interfaces/CSmokeStack.html | 10 +- docs/interfaces/CSnowball.html | 44 +- docs/interfaces/CSnowballPile.html | 16 +- docs/interfaces/CSnowballProjectile.html | 20 +- docs/interfaces/CSpatialEntity.html | 4 +- docs/interfaces/CSpotlightEnd.html | 10 +- docs/interfaces/CSprite.html | 10 +- docs/interfaces/CSpriteOriented.html | 10 +- docs/interfaces/CSpriteTrail.html | 12 +- docs/interfaces/CStatueProp.html | 20 +- docs/interfaces/CSteamJet.html | 10 +- docs/interfaces/CSun.html | 4 +- docs/interfaces/CSunlightShadowControl.html | 4 +- docs/interfaces/CSurvivalSpawnChopper.html | 18 +- docs/interfaces/CTEArmorRicochet.html | 4 +- docs/interfaces/CTEBSPDecal.html | 4 +- docs/interfaces/CTEBaseBeam.html | 4 +- docs/interfaces/CTEBeamEntPoint.html | 6 +- docs/interfaces/CTEBeamEnts.html | 6 +- docs/interfaces/CTEBeamFollow.html | 6 +- docs/interfaces/CTEBeamLaser.html | 6 +- docs/interfaces/CTEBeamPoints.html | 6 +- docs/interfaces/CTEBeamRing.html | 6 +- docs/interfaces/CTEBeamRingPoint.html | 6 +- docs/interfaces/CTEBeamSpline.html | 4 +- docs/interfaces/CTEBloodSprite.html | 4 +- docs/interfaces/CTEBloodStream.html | 6 +- docs/interfaces/CTEBreakModel.html | 4 +- docs/interfaces/CTEBubbleTrail.html | 4 +- docs/interfaces/CTEBubbles.html | 4 +- docs/interfaces/CTEClientProjectile.html | 4 +- docs/interfaces/CTEDecal.html | 4 +- docs/interfaces/CTEDust.html | 6 +- docs/interfaces/CTEDynamicLight.html | 4 +- docs/interfaces/CTEEffectDispatch.html | 4 +- docs/interfaces/CTEEnergySplash.html | 4 +- docs/interfaces/CTEExplosion.html | 6 +- docs/interfaces/CTEFireBullets.html | 4 +- docs/interfaces/CTEFizz.html | 4 +- docs/interfaces/CTEFootprintDecal.html | 4 +- docs/interfaces/CTEFoundryHelpers.html | 4 +- docs/interfaces/CTEGaussExplosion.html | 6 +- docs/interfaces/CTEGlowSprite.html | 4 +- docs/interfaces/CTEImpact.html | 4 +- docs/interfaces/CTEKillPlayerAttachments.html | 4 +- docs/interfaces/CTELargeFunnel.html | 6 +- docs/interfaces/CTEMetalSparks.html | 4 +- docs/interfaces/CTEMuzzleFlash.html | 4 +- docs/interfaces/CTEParticleSystem.html | 4 +- docs/interfaces/CTEPhysicsProp.html | 4 +- docs/interfaces/CTEPlantBomb.html | 4 +- docs/interfaces/CTEPlayerAnimEvent.html | 4 +- docs/interfaces/CTEPlayerDecal.html | 4 +- docs/interfaces/CTEProjectedDecal.html | 4 +- docs/interfaces/CTERadioIcon.html | 4 +- docs/interfaces/CTEShatterSurface.html | 4 +- docs/interfaces/CTEShowLine.html | 6 +- docs/interfaces/CTESmoke.html | 4 +- docs/interfaces/CTESparks.html | 6 +- docs/interfaces/CTESprite.html | 4 +- docs/interfaces/CTESpriteSpray.html | 4 +- docs/interfaces/CTEWorldDecal.html | 4 +- docs/interfaces/CTablet.html | 44 +- docs/interfaces/CTeam.html | 4 +- .../CTeamplayRoundBasedRulesProxy.html | 10 +- docs/interfaces/CTesla.html | 10 +- docs/interfaces/CTestTraceline.html | 4 +- .../CTest_ProxyToggle_Networkable.html | 10 +- docs/interfaces/CTriggerPlayerMovement.html | 12 +- docs/interfaces/CTriggerSoundOperator.html | 14 +- docs/interfaces/CVGuiScreen.html | 10 +- docs/interfaces/CVoteController.html | 12 +- docs/interfaces/CWaterBullet.html | 16 +- docs/interfaces/CWaterLODControl.html | 4 +- docs/interfaces/CWeaponAWP.html | 44 +- docs/interfaces/CWeaponAug.html | 44 +- docs/interfaces/CWeaponBaseItem.html | 44 +- docs/interfaces/CWeaponBizon.html | 44 +- docs/interfaces/CWeaponCSBase.html | 42 +- docs/interfaces/CWeaponCSBaseGun.html | 44 +- docs/interfaces/CWeaponCycler.html | 40 +- docs/interfaces/CWeaponElite.html | 44 +- docs/interfaces/CWeaponFamas.html | 44 +- docs/interfaces/CWeaponFiveSeven.html | 44 +- docs/interfaces/CWeaponG3SG1.html | 44 +- docs/interfaces/CWeaponGalil.html | 44 +- docs/interfaces/CWeaponGalilAR.html | 44 +- docs/interfaces/CWeaponGlock.html | 44 +- docs/interfaces/CWeaponHKP2000.html | 44 +- docs/interfaces/CWeaponM249.html | 44 +- docs/interfaces/CWeaponM3.html | 44 +- docs/interfaces/CWeaponM4A1.html | 44 +- docs/interfaces/CWeaponMAC10.html | 44 +- docs/interfaces/CWeaponMP5Navy.html | 44 +- docs/interfaces/CWeaponMP7.html | 44 +- docs/interfaces/CWeaponMP9.html | 44 +- docs/interfaces/CWeaponMag7.html | 44 +- docs/interfaces/CWeaponNOVA.html | 44 +- docs/interfaces/CWeaponNegev.html | 44 +- docs/interfaces/CWeaponP228.html | 44 +- docs/interfaces/CWeaponP250.html | 44 +- docs/interfaces/CWeaponP90.html | 44 +- docs/interfaces/CWeaponSCAR20.html | 44 +- docs/interfaces/CWeaponSG550.html | 44 +- docs/interfaces/CWeaponSG552.html | 44 +- docs/interfaces/CWeaponSG556.html | 44 +- docs/interfaces/CWeaponSSG08.html | 44 +- docs/interfaces/CWeaponSawedoff.html | 44 +- docs/interfaces/CWeaponScout.html | 44 +- docs/interfaces/CWeaponShield.html | 46 +- docs/interfaces/CWeaponTMP.html | 44 +- docs/interfaces/CWeaponTaser.html | 46 +- docs/interfaces/CWeaponTec9.html | 44 +- docs/interfaces/CWeaponUMP45.html | 44 +- docs/interfaces/CWeaponUSP.html | 44 +- docs/interfaces/CWeaponXM1014.html | 44 +- docs/interfaces/CWeaponZoneRepulsor.html | 44 +- docs/interfaces/CWorld.html | 10 +- docs/interfaces/CWorldVguiText.html | 10 +- docs/interfaces/DT_AI_BaseNPC.html | 24 +- docs/interfaces/DT_AnimTimeMustBeFirst.html | 4 +- docs/interfaces/DT_Animationlayer.html | 16 +- docs/interfaces/DT_AttributeContainer.html | 8 +- docs/interfaces/DT_AttributeList.html | 2 +- .../DT_BCCLocalPlayerExclusive.html | 4 +- .../DT_BCCNonLocalPlayerExclusive.html | 2 +- docs/interfaces/DT_BRC4Target.html | 6 +- docs/interfaces/DT_BaseAnimating.html | 44 +- docs/interfaces/DT_BaseAnimatingOverlay.html | 2 +- docs/interfaces/DT_BaseAttributableItem.html | 14 +- docs/interfaces/DT_BaseBeam.html | 32 +- docs/interfaces/DT_BaseButton.html | 2 +- docs/interfaces/DT_BaseCSGrenade.html | 16 +- .../DT_BaseCSGrenadeProjectile.html | 12 +- docs/interfaces/DT_BaseCombatCharacter.html | 10 +- docs/interfaces/DT_BaseCombatWeapon.html | 24 +- docs/interfaces/DT_BaseDoor.html | 4 +- docs/interfaces/DT_BaseEntity.html | 84 +- docs/interfaces/DT_BaseFlex.html | 6 +- docs/interfaces/DT_BaseGrenade.html | 14 +- docs/interfaces/DT_BaseParticleEntity.html | 2 +- docs/interfaces/DT_BasePlayer.html | 78 +- docs/interfaces/DT_BasePropDoor.html | 2 +- .../DT_BaseTeamObjectiveResource.html | 20 +- docs/interfaces/DT_BaseTempEntity.html | 2 +- docs/interfaces/DT_BaseToggle.html | 8 +- docs/interfaces/DT_BaseTrigger.html | 6 +- docs/interfaces/DT_BaseVPhysicsTrigger.html | 2 +- docs/interfaces/DT_BaseViewModel.html | 30 +- docs/interfaces/DT_BaseWeaponWorldModel.html | 12 +- docs/interfaces/DT_Beam.html | 46 +- docs/interfaces/DT_BeamSpotlight.html | 18 +- docs/interfaces/DT_BoneFollower.html | 6 +- .../interfaces/DT_BreachChargeProjectile.html | 10 +- docs/interfaces/DT_BreakableProp.html | 6 +- docs/interfaces/DT_BreakableSurface.html | 18 +- docs/interfaces/DT_BumpMineProjectile.html | 8 +- docs/interfaces/DT_CChicken.html | 6 +- docs/interfaces/DT_CFish.html | 18 +- docs/interfaces/DT_CHostage.html | 26 +- docs/interfaces/DT_CSGameRules.html | 142 +- docs/interfaces/DT_CSGameRulesProxy.html | 2 +- .../interfaces/DT_CSLocalPlayerExclusive.html | 36 +- .../DT_CSNonLocalPlayerExclusive.html | 6 +- docs/interfaces/DT_CSPlayer.html | 184 +- docs/interfaces/DT_CSPlayerResource.html | 12 +- docs/interfaces/DT_CSRagdoll.html | 30 +- docs/interfaces/DT_CSTeam.html | 2 +- docs/interfaces/DT_CSTeamExclusive.html | 2 +- docs/interfaces/DT_CascadeLight.html | 16 +- docs/interfaces/DT_CollisionProperty.html | 18 +- docs/interfaces/DT_ColorCorrection.html | 26 +- docs/interfaces/DT_ColorCorrectionVolume.html | 6 +- docs/interfaces/DT_DangerZone.html | 16 +- docs/interfaces/DT_DangerZoneController.html | 16 +- docs/interfaces/DT_DecoyGrenade.html | 2 +- docs/interfaces/DT_DecoyProjectile.html | 2 +- docs/interfaces/DT_DetailController.html | 6 +- docs/interfaces/DT_Drone.html | 16 +- docs/interfaces/DT_Dronegun.html | 10 +- docs/interfaces/DT_DustTrail.html | 28 +- docs/interfaces/DT_DynamicLight.html | 16 +- docs/interfaces/DT_DynamicProp.html | 12 +- docs/interfaces/DT_EconEntity.html | 14 +- docs/interfaces/DT_EffectData.html | 46 +- docs/interfaces/DT_Embers.html | 10 +- docs/interfaces/DT_EntityDissolve.html | 22 +- docs/interfaces/DT_EntityFlame.html | 6 +- docs/interfaces/DT_EntityFreezing.html | 8 +- docs/interfaces/DT_EntityParticleTrail.html | 6 +- .../DT_EntityParticleTrailInfo.html | 8 +- docs/interfaces/DT_EnvAmbientLight.html | 4 +- docs/interfaces/DT_EnvDOFController.html | 16 +- docs/interfaces/DT_EnvGasCanister.html | 48 +- docs/interfaces/DT_EnvParticleScript.html | 4 +- docs/interfaces/DT_EnvProjectedTexture.html | 44 +- docs/interfaces/DT_EnvScreenEffect.html | 6 +- docs/interfaces/DT_EnvScreenOverlay.html | 12 +- docs/interfaces/DT_EnvTonemapController.html | 28 +- docs/interfaces/DT_EnvWind.html | 2 +- docs/interfaces/DT_EnvWindShared.html | 26 +- docs/interfaces/DT_FEPlayerDecal.html | 30 +- docs/interfaces/DT_FireCrackerBlast.html | 2 +- docs/interfaces/DT_FireSmoke.html | 14 +- docs/interfaces/DT_FireTrail.html | 6 +- docs/interfaces/DT_Flashbang.html | 2 +- docs/interfaces/DT_FogController.html | 38 +- docs/interfaces/DT_FootstepControl.html | 6 +- docs/interfaces/DT_FuncAreaPortalWindow.html | 10 +- docs/interfaces/DT_FuncBrush.html | 2 +- docs/interfaces/DT_FuncConveyor.html | 4 +- docs/interfaces/DT_FuncLadder.html | 10 +- docs/interfaces/DT_FuncMonitor.html | 2 +- docs/interfaces/DT_FuncMoveLinear.html | 6 +- docs/interfaces/DT_FuncOccluder.html | 6 +- docs/interfaces/DT_FuncReflectiveGlass.html | 2 +- docs/interfaces/DT_FuncRotating.html | 12 +- docs/interfaces/DT_FuncSmokeVolume.html | 24 +- docs/interfaces/DT_FuncTrackTrain.html | 2 +- docs/interfaces/DT_Func_Dust.html | 26 +- docs/interfaces/DT_Func_LOD.html | 6 +- docs/interfaces/DT_GameRulesProxy.html | 2 +- docs/interfaces/DT_GrassBurn.html | 4 +- docs/interfaces/DT_HEGrenade.html | 2 +- docs/interfaces/DT_HandleTest.html | 6 +- docs/interfaces/DT_HostageCarriableProp.html | 2 +- docs/interfaces/DT_IncendiaryGrenade.html | 2 +- docs/interfaces/DT_Inferno.html | 6 +- docs/interfaces/DT_InfoLadderDismount.html | 2 +- docs/interfaces/DT_InfoMapRegion.html | 6 +- docs/interfaces/DT_InfoOverlayAccessor.html | 6 +- docs/interfaces/DT_ItemCash.html | 2 +- docs/interfaces/DT_ItemDogtags.html | 6 +- docs/interfaces/DT_Item_Healthshot.html | 2 +- docs/interfaces/DT_LightGlow.html | 26 +- docs/interfaces/DT_Local.html | 86 +- docs/interfaces/DT_LocalActiveWeaponData.html | 10 +- docs/interfaces/DT_LocalPlayerExclusive.html | 48 +- docs/interfaces/DT_LocalWeaponData.html | 14 +- docs/interfaces/DT_MapVetoPickController.html | 12 +- docs/interfaces/DT_MaterialModifyControl.html | 26 +- docs/interfaces/DT_MolotovGrenade.html | 2 +- docs/interfaces/DT_MolotovProjectile.html | 4 +- docs/interfaces/DT_MovieDisplay.html | 24 +- docs/interfaces/DT_MovieExplosion.html | 2 +- docs/interfaces/DT_OverlayVars.html | 2 +- docs/interfaces/DT_ParadropChopper.html | 8 +- docs/interfaces/DT_ParticleFire.html | 6 +- .../DT_ParticlePerformanceMonitor.html | 6 +- docs/interfaces/DT_ParticleSmokeGrenade.html | 14 +- docs/interfaces/DT_ParticleSystem.html | 24 +- docs/interfaces/DT_PhysBox.html | 2 +- docs/interfaces/DT_PhysBoxMultiplayer.html | 6 +- docs/interfaces/DT_PhysMagnet.html | 2 +- docs/interfaces/DT_PhysPropAmmoBox.html | 2 +- docs/interfaces/DT_PhysPropLootCrate.html | 10 +- docs/interfaces/DT_PhysPropRadarJammer.html | 2 +- docs/interfaces/DT_PhysPropWeaponUpgrade.html | 2 +- docs/interfaces/DT_PhysicsProp.html | 4 +- .../interfaces/DT_PhysicsPropMultiplayer.html | 10 +- docs/interfaces/DT_PlantedC4.html | 18 +- docs/interfaces/DT_Plasma.html | 14 +- docs/interfaces/DT_PlayerPing.html | 12 +- docs/interfaces/DT_PlayerResource.html | 2 +- docs/interfaces/DT_PlayerState.html | 4 +- docs/interfaces/DT_PointCamera.html | 20 +- docs/interfaces/DT_PointCommentaryNode.html | 18 +- docs/interfaces/DT_PointWorldText.html | 8 +- docs/interfaces/DT_PoseController.html | 20 +- docs/interfaces/DT_PostProcessController.html | 4 +- docs/interfaces/DT_Precipitation.html | 4 +- docs/interfaces/DT_PrecipitationBlocker.html | 2 +- docs/interfaces/DT_PredictedViewModel.html | 2 +- docs/interfaces/DT_PropCounter.html | 4 +- docs/interfaces/DT_PropDoorRotating.html | 2 +- docs/interfaces/DT_PropJeep.html | 4 +- docs/interfaces/DT_PropVehicleDriveable.html | 30 +- docs/interfaces/DT_Prop_Hallucination.html | 8 +- docs/interfaces/DT_ProxyToggle.html | 2 +- .../DT_ProxyToggle_ProxiedData.html | 4 +- docs/interfaces/DT_QuadraticBeam.html | 10 +- docs/interfaces/DT_Ragdoll.html | 12 +- docs/interfaces/DT_RagdollManager.html | 4 +- docs/interfaces/DT_Ragdoll_Attached.html | 10 +- docs/interfaces/DT_RetakeGameRules.html | 12 +- docs/interfaces/DT_RocketTrail.html | 32 +- docs/interfaces/DT_RopeKeyframe.html | 50 +- docs/interfaces/DT_SceneEntity.html | 12 +- .../interfaces/DT_ScriptCreatedAttribute.html | 12 +- docs/interfaces/DT_ScriptCreatedItem.html | 18 +- docs/interfaces/DT_SensorGrenade.html | 2 +- .../DT_SensorGrenadeProjectile.html | 2 +- docs/interfaces/DT_ServerAnimationData.html | 4 +- docs/interfaces/DT_ShadowControl.html | 12 +- docs/interfaces/DT_SlideshowDisplay.html | 16 +- docs/interfaces/DT_SmokeGrenade.html | 2 +- .../interfaces/DT_SmokeGrenadeProjectile.html | 6 +- docs/interfaces/DT_SmokeStack.html | 38 +- docs/interfaces/DT_SmokeTrail.html | 32 +- docs/interfaces/DT_Snowball.html | 2 +- docs/interfaces/DT_SnowballPile.html | 2 +- docs/interfaces/DT_SnowballProjectile.html | 2 +- docs/interfaces/DT_SpatialEntity.html | 12 +- docs/interfaces/DT_SporeExplosion.html | 16 +- docs/interfaces/DT_SporeTrail.html | 16 +- docs/interfaces/DT_SpotlightEnd.html | 6 +- docs/interfaces/DT_Sprite.html | 24 +- docs/interfaces/DT_SpriteOriented.html | 2 +- docs/interfaces/DT_SpriteTrail.html | 18 +- docs/interfaces/DT_StatueProp.html | 12 +- docs/interfaces/DT_SteamJet.html | 24 +- docs/interfaces/DT_Sun.html | 22 +- docs/interfaces/DT_SunlightShadowControl.html | 22 +- docs/interfaces/DT_SurvivalGameRules.html | 22 +- docs/interfaces/DT_SurvivalSpawnChopper.html | 6 +- docs/interfaces/DT_TEArmorRicochet.html | 2 +- docs/interfaces/DT_TEBSPDecal.html | 8 +- docs/interfaces/DT_TEBeamEntPoint.html | 10 +- docs/interfaces/DT_TEBeamEnts.html | 6 +- docs/interfaces/DT_TEBeamFollow.html | 4 +- docs/interfaces/DT_TEBeamLaser.html | 6 +- docs/interfaces/DT_TEBeamPoints.html | 6 +- docs/interfaces/DT_TEBeamRing.html | 6 +- docs/interfaces/DT_TEBeamRingPoint.html | 8 +- docs/interfaces/DT_TEBeamSpline.html | 6 +- docs/interfaces/DT_TEBloodSprite.html | 20 +- docs/interfaces/DT_TEBloodStream.html | 14 +- docs/interfaces/DT_TEBreakModel.html | 24 +- docs/interfaces/DT_TEBubbleTrail.html | 14 +- docs/interfaces/DT_TEBubbles.html | 14 +- docs/interfaces/DT_TEClientProjectile.html | 12 +- docs/interfaces/DT_TEDecal.html | 12 +- docs/interfaces/DT_TEDust.html | 8 +- docs/interfaces/DT_TEDynamicLight.html | 18 +- docs/interfaces/DT_TEEffectDispatch.html | 2 +- docs/interfaces/DT_TEEnergySplash.html | 8 +- docs/interfaces/DT_TEExplosion.html | 18 +- docs/interfaces/DT_TEFireBullets.html | 26 +- docs/interfaces/DT_TEFizz.html | 10 +- docs/interfaces/DT_TEFootprintDecal.html | 12 +- docs/interfaces/DT_TEFoundryHelpers.html | 4 +- docs/interfaces/DT_TEGaussExplosion.html | 6 +- docs/interfaces/DT_TEGlowSprite.html | 12 +- docs/interfaces/DT_TEImpact.html | 8 +- .../DT_TEKillPlayerAttachments.html | 4 +- docs/interfaces/DT_TELargeFunnel.html | 6 +- docs/interfaces/DT_TEMetalSparks.html | 6 +- docs/interfaces/DT_TEMuzzleFlash.html | 10 +- docs/interfaces/DT_TEParticleSystem.html | 8 +- docs/interfaces/DT_TEPhysicsProp.html | 22 +- docs/interfaces/DT_TEPlantBomb.html | 8 +- docs/interfaces/DT_TEPlayerAnimEvent.html | 8 +- docs/interfaces/DT_TEPlayerDecal.html | 14 +- docs/interfaces/DT_TEProjectedDecal.html | 10 +- docs/interfaces/DT_TERadioIcon.html | 4 +- docs/interfaces/DT_TEShatterSurface.html | 30 +- docs/interfaces/DT_TEShowLine.html | 4 +- docs/interfaces/DT_TESmoke.html | 10 +- docs/interfaces/DT_TESparks.html | 8 +- docs/interfaces/DT_TESprite.html | 10 +- docs/interfaces/DT_TESpriteSpray.html | 14 +- docs/interfaces/DT_TEWorldDecal.html | 6 +- docs/interfaces/DT_Team.html | 34 +- .../DT_TeamplayRoundBasedRules.html | 22 +- .../DT_TeamplayRoundBasedRulesProxy.html | 2 +- docs/interfaces/DT_Tesla.html | 6 +- docs/interfaces/DT_TestTraceline.html | 14 +- docs/interfaces/DT_TriggerPlayerMovement.html | 2 +- docs/interfaces/DT_TriggerSoundOperator.html | 4 +- docs/interfaces/DT_VGuiScreen.html | 16 +- docs/interfaces/DT_VoteController.html | 10 +- docs/interfaces/DT_WORLD.html | 22 +- docs/interfaces/DT_WaterBullet.html | 2 +- docs/interfaces/DT_WaterLODControl.html | 6 +- docs/interfaces/DT_WeaponAK47.html | 2 +- docs/interfaces/DT_WeaponAWP.html | 2 +- docs/interfaces/DT_WeaponAug.html | 2 +- docs/interfaces/DT_WeaponBaseItem.html | 4 +- docs/interfaces/DT_WeaponBizon.html | 2 +- docs/interfaces/DT_WeaponBreachCharge.html | 2 +- docs/interfaces/DT_WeaponBumpMine.html | 2 +- docs/interfaces/DT_WeaponC4.html | 12 +- docs/interfaces/DT_WeaponCSBase.html | 26 +- docs/interfaces/DT_WeaponCSBaseGun.html | 6 +- docs/interfaces/DT_WeaponCycler.html | 2 +- docs/interfaces/DT_WeaponDEagle.html | 2 +- docs/interfaces/DT_WeaponElite.html | 2 +- docs/interfaces/DT_WeaponFamas.html | 2 +- docs/interfaces/DT_WeaponFists.html | 4 +- docs/interfaces/DT_WeaponFiveSeven.html | 2 +- docs/interfaces/DT_WeaponG3SG1.html | 2 +- docs/interfaces/DT_WeaponGalil.html | 2 +- docs/interfaces/DT_WeaponGalilAR.html | 2 +- docs/interfaces/DT_WeaponGlock.html | 2 +- docs/interfaces/DT_WeaponHKP2000.html | 2 +- docs/interfaces/DT_WeaponKnife.html | 2 +- docs/interfaces/DT_WeaponKnifeGG.html | 2 +- docs/interfaces/DT_WeaponM249.html | 2 +- docs/interfaces/DT_WeaponM3.html | 4 +- docs/interfaces/DT_WeaponM4A1.html | 2 +- docs/interfaces/DT_WeaponMAC10.html | 2 +- docs/interfaces/DT_WeaponMP5Navy.html | 2 +- docs/interfaces/DT_WeaponMP7.html | 2 +- docs/interfaces/DT_WeaponMP9.html | 2 +- docs/interfaces/DT_WeaponMag7.html | 2 +- docs/interfaces/DT_WeaponMelee.html | 4 +- docs/interfaces/DT_WeaponNOVA.html | 4 +- docs/interfaces/DT_WeaponNegev.html | 2 +- docs/interfaces/DT_WeaponP228.html | 2 +- docs/interfaces/DT_WeaponP250.html | 2 +- docs/interfaces/DT_WeaponP90.html | 2 +- docs/interfaces/DT_WeaponSCAR17.html | 2 +- docs/interfaces/DT_WeaponSCAR20.html | 2 +- docs/interfaces/DT_WeaponSG550.html | 2 +- docs/interfaces/DT_WeaponSG552.html | 2 +- docs/interfaces/DT_WeaponSG556.html | 2 +- docs/interfaces/DT_WeaponSSG08.html | 2 +- docs/interfaces/DT_WeaponSawedoff.html | 4 +- docs/interfaces/DT_WeaponScout.html | 2 +- docs/interfaces/DT_WeaponShield.html | 4 +- docs/interfaces/DT_WeaponTMP.html | 2 +- docs/interfaces/DT_WeaponTablet.html | 28 +- docs/interfaces/DT_WeaponTaser.html | 4 +- docs/interfaces/DT_WeaponTec9.html | 2 +- docs/interfaces/DT_WeaponUMP45.html | 2 +- docs/interfaces/DT_WeaponUSP.html | 2 +- docs/interfaces/DT_WeaponXM1014.html | 4 +- docs/interfaces/DT_WeaponZoneRepulsor.html | 2 +- docs/interfaces/DT_WearableItem.html | 2 +- docs/interfaces/DT_WorldVguiText.html | 14 +- docs/interfaces/DustTrail.html | 10 +- docs/interfaces/IBaselineUpdateEvent.html | 8 +- docs/interfaces/ICrosshairInfo.html | 36 +- docs/interfaces/IDemoEndEvent.html | 6 +- docs/interfaces/IDemoStartEvent.html | 4 +- docs/interfaces/IDemoWarningEvent.html | 4 +- docs/interfaces/IEntityBeforeRemoveEvent.html | 6 +- docs/interfaces/IEntityChangeEvent.html | 6 +- docs/interfaces/IEntityCreationEvent.html | 4 +- docs/interfaces/IEntityPropChange.html | 10 +- docs/interfaces/IEntityRemoveEvent.html | 4 +- docs/interfaces/IEventAchievementEarned.html | 6 +- docs/interfaces/IEventAnnouncePhaseEnd.html | 2 +- docs/interfaces/IEventBeginNewMatch.html | 2 +- docs/interfaces/IEventBombBegindefuse.html | 8 +- docs/interfaces/IEventBombBeginplant.html | 8 +- docs/interfaces/IEventBombDefused.html | 8 +- docs/interfaces/IEventBombDropped.html | 10 +- docs/interfaces/IEventBombExploded.html | 8 +- docs/interfaces/IEventBombPickup.html | 6 +- docs/interfaces/IEventBombPlanted.html | 8 +- docs/interfaces/IEventBotTakeover.html | 12 +- docs/interfaces/IEventBuytimeEnded.html | 2 +- .../IEventChoppersIncomingWarning.html | 4 +- docs/interfaces/IEventCsGameDisconnected.html | 2 +- docs/interfaces/IEventCsMatchEndRestart.html | 2 +- docs/interfaces/IEventCsPreRestart.html | 2 +- docs/interfaces/IEventCsRoundFinalBeep.html | 2 +- docs/interfaces/IEventCsRoundStartBeep.html | 2 +- docs/interfaces/IEventCsWinPanelMatch.html | 2 +- docs/interfaces/IEventCsWinPanelRound.html | 22 +- docs/interfaces/IEventDecoyDetonate.html | 16 +- docs/interfaces/IEventDecoyStarted.html | 16 +- docs/interfaces/IEventDefuserDropped.html | 6 +- docs/interfaces/IEventDefuserPickup.html | 10 +- docs/interfaces/IEventDmBonusWeaponStart.html | 6 +- .../IEventEndmatchCmmStartRevealItems.html | 2 +- .../IEventEndmatchMapvoteSelectingMap.html | 24 +- .../IEventFirstbombsIncomingWarning.html | 4 +- docs/interfaces/IEventFlashbangDetonate.html | 16 +- docs/interfaces/IEventGameNewmap.html | 4 +- docs/interfaces/IEventHegrenadeDetonate.html | 16 +- docs/interfaces/IEventHltvChat.html | 4 +- docs/interfaces/IEventHltvStatus.html | 14 +- docs/interfaces/IEventHostageHurt.html | 10 +- docs/interfaces/IEventHostageKilled.html | 10 +- docs/interfaces/IEventHostageRescued.html | 12 +- docs/interfaces/IEventHostageRescuedAll.html | 2 +- docs/interfaces/IEventInfernoExpire.html | 12 +- docs/interfaces/IEventInfernoStartburn.html | 12 +- docs/interfaces/IEventItemEquip.html | 24 +- docs/interfaces/IEventItemFound.html | 12 +- docs/interfaces/IEventItemPickup.html | 14 +- docs/interfaces/IEventItemRemove.html | 12 +- docs/interfaces/IEventItemsGifted.html | 14 +- docs/interfaces/IEventOtherDeath.html | 36 +- docs/interfaces/IEventPlayerBlind.html | 16 +- docs/interfaces/IEventPlayerChangename.html | 10 +- docs/interfaces/IEventPlayerChat.html | 10 +- docs/interfaces/IEventPlayerConnect.html | 12 +- docs/interfaces/IEventPlayerConnectFull.html | 8 +- docs/interfaces/IEventPlayerDeath.html | 50 +- docs/interfaces/IEventPlayerDisconnect.html | 12 +- docs/interfaces/IEventPlayerFalldamage.html | 8 +- docs/interfaces/IEventPlayerFootstep.html | 6 +- docs/interfaces/IEventPlayerHurt.html | 22 +- docs/interfaces/IEventPlayerInfo.html | 14 +- docs/interfaces/IEventPlayerJump.html | 6 +- docs/interfaces/IEventPlayerSpawn.html | 8 +- docs/interfaces/IEventPlayerTeam.html | 18 +- docs/interfaces/IEventRoundAnnounceFinal.html | 2 +- .../IEventRoundAnnounceLastRoundHalf.html | 2 +- .../IEventRoundAnnounceMatchPoint.html | 2 +- .../IEventRoundAnnounceMatchStart.html | 2 +- .../interfaces/IEventRoundAnnounceWarmup.html | 2 +- docs/interfaces/IEventRoundEnd.html | 14 +- docs/interfaces/IEventRoundFreezeEnd.html | 2 +- docs/interfaces/IEventRoundMvp.html | 14 +- .../IEventRoundOfficiallyEnded.html | 2 +- docs/interfaces/IEventRoundPoststart.html | 2 +- docs/interfaces/IEventRoundPrestart.html | 2 +- docs/interfaces/IEventRoundStart.html | 8 +- docs/interfaces/IEventRoundTimeWarning.html | 2 +- docs/interfaces/IEventSeasoncoinLevelup.html | 8 +- docs/interfaces/IEventServerCvar.html | 6 +- docs/interfaces/IEventServerSpawn.html | 22 +- .../IEventSmokegrenadeDetonate.html | 16 +- .../interfaces/IEventSmokegrenadeExpired.html | 16 +- .../IEventSurvivalParadropBreak.html | 6 +- .../IEventSurvivalParadropSpawn.html | 6 +- .../IEventTeamplayBroadcastAudio.html | 6 +- docs/interfaces/IEventTournamentReward.html | 12 +- docs/interfaces/IEventWeaponFire.html | 10 +- docs/interfaces/IEventWeaponFireOnEmpty.html | 8 +- docs/interfaces/IEventWeaponOutofammo.html | 6 +- docs/interfaces/IEventWeaponReload.html | 6 +- docs/interfaces/IEventWeaponZoom.html | 6 +- docs/interfaces/IFlattenedSendProp.html | 10 +- ...NonSpecificGameEventAchievementEarned.html | 6 +- ...INonSpecificGameEventAnnouncePhaseEnd.html | 6 +- .../INonSpecificGameEventBeginNewMatch.html | 6 +- .../INonSpecificGameEventBombBegindefuse.html | 6 +- .../INonSpecificGameEventBombBeginplant.html | 6 +- .../INonSpecificGameEventBombDefused.html | 6 +- .../INonSpecificGameEventBombDropped.html | 6 +- .../INonSpecificGameEventBombExploded.html | 6 +- .../INonSpecificGameEventBombPickup.html | 6 +- .../INonSpecificGameEventBombPlanted.html | 6 +- .../INonSpecificGameEventBotTakeover.html | 6 +- .../INonSpecificGameEventBuytimeEnded.html | 6 +- ...cificGameEventChoppersIncomingWarning.html | 6 +- ...onSpecificGameEventCsGameDisconnected.html | 6 +- ...NonSpecificGameEventCsMatchEndRestart.html | 6 +- .../INonSpecificGameEventCsPreRestart.html | 6 +- ...INonSpecificGameEventCsRoundFinalBeep.html | 6 +- ...INonSpecificGameEventCsRoundStartBeep.html | 6 +- .../INonSpecificGameEventCsWinPanelMatch.html | 6 +- .../INonSpecificGameEventCsWinPanelRound.html | 6 +- .../INonSpecificGameEventDecoyDetonate.html | 6 +- .../INonSpecificGameEventDecoyStarted.html | 6 +- .../INonSpecificGameEventDefuserDropped.html | 6 +- .../INonSpecificGameEventDefuserPickup.html | 6 +- ...onSpecificGameEventDmBonusWeaponStart.html | 6 +- ...cGameEventEndmatchCmmStartRevealItems.html | 6 +- ...cGameEventEndmatchMapvoteSelectingMap.html | 6 +- ...ficGameEventFirstbombsIncomingWarning.html | 6 +- ...NonSpecificGameEventFlashbangDetonate.html | 6 +- .../INonSpecificGameEventGameNewmap.html | 6 +- ...NonSpecificGameEventHegrenadeDetonate.html | 6 +- .../INonSpecificGameEventHltvChat.html | 6 +- .../INonSpecificGameEventHltvStatus.html | 6 +- .../INonSpecificGameEventHostageHurt.html | 6 +- .../INonSpecificGameEventHostageKilled.html | 6 +- .../INonSpecificGameEventHostageRescued.html | 6 +- ...NonSpecificGameEventHostageRescuedAll.html | 6 +- .../INonSpecificGameEventInfernoExpire.html | 6 +- ...INonSpecificGameEventInfernoStartburn.html | 6 +- .../INonSpecificGameEventItemEquip.html | 6 +- .../INonSpecificGameEventItemFound.html | 6 +- .../INonSpecificGameEventItemPickup.html | 6 +- .../INonSpecificGameEventItemRemove.html | 6 +- .../INonSpecificGameEventItemsGifted.html | 6 +- .../INonSpecificGameEventOtherDeath.html | 6 +- .../INonSpecificGameEventPlayerBlind.html | 6 +- ...INonSpecificGameEventPlayerChangename.html | 6 +- .../INonSpecificGameEventPlayerChat.html | 6 +- .../INonSpecificGameEventPlayerConnect.html | 6 +- ...NonSpecificGameEventPlayerConnectFull.html | 6 +- .../INonSpecificGameEventPlayerDeath.html | 6 +- ...INonSpecificGameEventPlayerDisconnect.html | 6 +- ...INonSpecificGameEventPlayerFalldamage.html | 6 +- .../INonSpecificGameEventPlayerFootstep.html | 6 +- .../INonSpecificGameEventPlayerHurt.html | 6 +- .../INonSpecificGameEventPlayerInfo.html | 6 +- .../INonSpecificGameEventPlayerJump.html | 6 +- .../INonSpecificGameEventPlayerSpawn.html | 6 +- .../INonSpecificGameEventPlayerTeam.html | 6 +- ...onSpecificGameEventRoundAnnounceFinal.html | 6 +- ...icGameEventRoundAnnounceLastRoundHalf.html | 6 +- ...cificGameEventRoundAnnounceMatchPoint.html | 6 +- ...cificGameEventRoundAnnounceMatchStart.html | 6 +- ...nSpecificGameEventRoundAnnounceWarmup.html | 6 +- .../INonSpecificGameEventRoundEnd.html | 6 +- .../INonSpecificGameEventRoundFreezeEnd.html | 6 +- .../INonSpecificGameEventRoundMvp.html | 6 +- ...SpecificGameEventRoundOfficiallyEnded.html | 6 +- .../INonSpecificGameEventRoundPoststart.html | 6 +- .../INonSpecificGameEventRoundPrestart.html | 6 +- .../INonSpecificGameEventRoundStart.html | 6 +- ...INonSpecificGameEventRoundTimeWarning.html | 6 +- ...NonSpecificGameEventSeasoncoinLevelup.html | 6 +- .../INonSpecificGameEventServerCvar.html | 6 +- .../INonSpecificGameEventServerSpawn.html | 6 +- ...SpecificGameEventSmokegrenadeDetonate.html | 6 +- ...nSpecificGameEventSmokegrenadeExpired.html | 6 +- ...pecificGameEventSurvivalParadropBreak.html | 6 +- ...pecificGameEventSurvivalParadropSpawn.html | 6 +- ...ecificGameEventTeamplayBroadcastAudio.html | 6 +- ...INonSpecificGameEventTournamentReward.html | 6 +- .../INonSpecificGameEventWeaponFire.html | 6 +- ...NonSpecificGameEventWeaponFireOnEmpty.html | 6 +- .../INonSpecificGameEventWeaponOutofammo.html | 6 +- .../INonSpecificGameEventWeaponReload.html | 6 +- .../INonSpecificGameEventWeaponZoom.html | 6 +- docs/interfaces/IPlayerInfo.html | 18 +- docs/interfaces/IPlayerRoundStats.html | 22 +- docs/interfaces/IPropUpdate.html | 6 +- docs/interfaces/IServerClass.html | 10 +- docs/interfaces/IStringTable.html | 12 +- docs/interfaces/IStringTableEntry.html | 6 +- docs/interfaces/IStringTableUpdateEvent.html | 12 +- docs/interfaces/ITempEntEvent.html | 10 +- docs/interfaces/IUserCmd.html | 30 +- docs/interfaces/MovieExplosion.html | 8 +- docs/interfaces/NetworkableConstructor.html | 4 +- docs/interfaces/ParticleSmokeGrenade.html | 10 +- docs/interfaces/RocketTrail.html | 10 +- docs/interfaces/SmokeTrail.html | 10 +- docs/interfaces/SporeExplosion.html | 10 +- docs/interfaces/SporeTrail.html | 10 +- docs/interfaces/UnknownEntityProps.html | 2 +- docs/interfaces/Vector.html | 8 +- docs/interfaces/_LPT_m_AnimOverlay_15.html | 4 +- docs/interfaces/_LPT_m_Attributes_32.html | 4 +- docs/interfaces/_LPT_m_hActorList_16.html | 4 +- docs/interfaces/_ST_m_AnimOverlay_15.html | 2 +- docs/interfaces/_ST_m_Attributes_32.html | 2 +- docs/interfaces/_ST_m_hActorList_16.html | 34 +- docs/interfaces/m_DangerZones.html | 86 +- .../m_EquippedLoadoutItemDefIndices.html | 116 +- ...GGProgressiveWeaponKillUpgradeOrderCT.html | 122 +- ..._GGProgressiveWeaponKillUpgradeOrderT.html | 122 +- .../m_GGProgressiveWeaponOrderCT.html | 122 +- .../m_GGProgressiveWeaponOrderT.html | 122 +- docs/interfaces/m_RawPanelBitVec.html | 514 +- docs/interfaces/m_SpawnTileState.html | 450 +- .../m_SurvivalGameRuleDecisionTypes.html | 34 +- .../m_SurvivalGameRuleDecisionValues.html | 34 +- docs/interfaces/m_TeamRespawnWaveTimes.html | 132 +- .../m_arrFeaturedGiftersAccounts.html | 10 +- .../interfaces/m_arrFeaturedGiftersGifts.html | 10 +- .../m_arrProhibitedItemIndices.html | 202 +- .../m_arrTournamentActiveCasterAccounts.html | 10 +- docs/interfaces/m_bAlive.html | 132 +- docs/interfaces/m_bBlocked.html | 18 +- docs/interfaces/m_bCPIsVisible.html | 18 +- docs/interfaces/m_bConnected.html | 132 +- docs/interfaces/m_bControllingBot.html | 132 +- docs/interfaces/m_bFireIsBurning.html | 130 +- .../m_bHasCommunicationAbuseMute.html | 132 +- docs/interfaces/m_bHasDefuser.html | 132 +- docs/interfaces/m_bHasHelmet.html | 132 +- docs/interfaces/m_bHostageAlive.html | 26 +- docs/interfaces/m_bInMiniRound.html | 18 +- docs/interfaces/m_bPlayerDominated.html | 132 +- docs/interfaces/m_bPlayerDominatingMe.html | 132 +- docs/interfaces/m_bSpottedByMask.html | 6 +- docs/interfaces/m_bTeamCanCap.html | 130 +- docs/interfaces/m_bTeamReady.html | 66 +- docs/interfaces/m_chAreaBits.html | 66 +- docs/interfaces/m_chAreaPortalBits.html | 50 +- docs/interfaces/m_chCurrentSlideLists.html | 34 +- docs/interfaces/m_chPoseIndex.html | 10 +- docs/interfaces/m_fireXDelta.html | 130 +- docs/interfaces/m_fireYDelta.html | 130 +- docs/interfaces/m_fireZDelta.html | 130 +- docs/interfaces/m_flEncodedController.html | 10 +- docs/interfaces/m_flFrozenPerHitbox.html | 102 +- docs/interfaces/m_flLazyCapPerc.html | 18 +- docs/interfaces/m_flNextRespawnWave.html | 132 +- docs/interfaces/m_flPathDistance.html | 18 +- docs/interfaces/m_flPoseParameter.html | 50 +- .../interfaces/m_flPostProcessParameters.html | 24 +- docs/interfaces/m_flTeamCapTime.html | 130 +- docs/interfaces/m_flWaveEndTimes.html | 12 +- docs/interfaces/m_flexWeight.html | 194 +- docs/interfaces/m_hAttachEntity.html | 22 +- docs/interfaces/m_hControlPointEnts.html | 128 +- docs/interfaces/m_hMyWeapons.html | 130 +- docs/interfaces/m_hMyWearables.html | 4 +- docs/interfaces/m_hProps.html | 10 +- docs/interfaces/m_hostageRescueX.html | 10 +- docs/interfaces/m_hostageRescueY.html | 10 +- docs/interfaces/m_hostageRescueZ.html | 10 +- docs/interfaces/m_iAmmo.html | 66 +- docs/interfaces/m_iArmor.html | 132 +- docs/interfaces/m_iAssists.html | 132 +- docs/interfaces/m_iBaseControlPoints.html | 66 +- docs/interfaces/m_iBotDifficulty.html | 132 +- docs/interfaces/m_iCappingTeam.html | 18 +- docs/interfaces/m_iCashSpentThisRound.html | 132 +- docs/interfaces/m_iCoachingTeam.html | 132 +- docs/interfaces/m_iCompTeammateColor.html | 132 +- docs/interfaces/m_iCompetitiveRankType.html | 132 +- docs/interfaces/m_iCompetitiveRanking.html | 132 +- docs/interfaces/m_iCompetitiveWins.html | 132 +- docs/interfaces/m_iControlPointParents.html | 128 +- docs/interfaces/m_iControlledByPlayer.html | 132 +- docs/interfaces/m_iControlledPlayer.html | 132 +- docs/interfaces/m_iDeaths.html | 132 +- docs/interfaces/m_iGunGameLevel.html | 132 +- docs/interfaces/m_iHealth.html | 132 +- docs/interfaces/m_iHostageEntityIDs.html | 26 +- docs/interfaces/m_iKills.html | 132 +- docs/interfaces/m_iLifetimeEnd.html | 132 +- docs/interfaces/m_iLifetimeStart.html | 132 +- docs/interfaces/m_iMVPs.html | 132 +- docs/interfaces/m_iMatchStats_3k_Total.html | 132 +- docs/interfaces/m_iMatchStats_4k_Total.html | 132 +- docs/interfaces/m_iMatchStats_5k_Total.html | 132 +- docs/interfaces/m_iMatchStats_Assists.html | 62 +- .../m_iMatchStats_Assists_Total.html | 132 +- docs/interfaces/m_iMatchStats_CashEarned.html | 62 +- .../m_iMatchStats_CashEarned_Total.html | 132 +- docs/interfaces/m_iMatchStats_Damage.html | 62 +- .../m_iMatchStats_Damage_Total.html | 132 +- docs/interfaces/m_iMatchStats_Deaths.html | 62 +- .../m_iMatchStats_Deaths_Total.html | 132 +- .../m_iMatchStats_EnemiesFlashed.html | 62 +- .../m_iMatchStats_EnemiesFlashed_Total.html | 132 +- .../m_iMatchStats_EquipmentValue.html | 62 +- .../m_iMatchStats_EquipmentValue_Total.html | 132 +- .../m_iMatchStats_HeadShotKills.html | 62 +- .../m_iMatchStats_HeadShotKills_Total.html | 132 +- docs/interfaces/m_iMatchStats_KillReward.html | 62 +- .../m_iMatchStats_KillReward_Total.html | 132 +- docs/interfaces/m_iMatchStats_Kills.html | 62 +- .../interfaces/m_iMatchStats_Kills_Total.html | 132 +- docs/interfaces/m_iMatchStats_LiveTime.html | 62 +- .../m_iMatchStats_LiveTime_Total.html | 132 +- docs/interfaces/m_iMatchStats_MoneySaved.html | 62 +- docs/interfaces/m_iMatchStats_Objective.html | 62 +- .../m_iMatchStats_Objective_Total.html | 132 +- .../m_iMatchStats_PlayersAlive_CT.html | 62 +- .../m_iMatchStats_PlayersAlive_T.html | 62 +- .../m_iMatchStats_RoundResults.html | 62 +- .../m_iMatchStats_UtilityDamage.html | 62 +- .../m_iMatchStats_UtilityDamage_Total.html | 132 +- docs/interfaces/m_iNumTeamMembers.html | 130 +- docs/interfaces/m_iOwner.html | 18 +- docs/interfaces/m_iPendingTeam.html | 132 +- docs/interfaces/m_iPing.html | 132 +- docs/interfaces/m_iPlayerSpawnHexIndices.html | 130 +- docs/interfaces/m_iPreviousPoints.html | 386 +- docs/interfaces/m_iScore.html | 132 +- .../m_iServerControlPointAssignments.html | 10 +- docs/interfaces/m_iTeam.html | 132 +- docs/interfaces/m_iTeamBaseIcons.html | 66 +- docs/interfaces/m_iTeamIcons.html | 130 +- docs/interfaces/m_iTeamInZone.html | 18 +- docs/interfaces/m_iTeamOverlays.html | 130 +- docs/interfaces/m_iTeamReqCappers.html | 130 +- docs/interfaces/m_iTotalCashSpent.html | 132 +- docs/interfaces/m_iWarnOnCap.html | 18 +- .../m_iWeaponPurchasesThisMatch.html | 514 +- .../m_iWeaponPurchasesThisRound.html | 514 +- .../m_isHostageFollowingSomeone.html | 26 +- docs/interfaces/m_nAccountIDs.html | 130 +- docs/interfaces/m_nActiveCoinRank.html | 132 +- docs/interfaces/m_nAttachIndex.html | 22 +- docs/interfaces/m_nCharacterDefIndex.html | 132 +- .../m_nEndMatchMapGroupVoteOptions.html | 22 +- .../m_nEndMatchMapGroupVoteTypes.html | 22 +- docs/interfaces/m_nEndMatchNextMapVotes.html | 132 +- docs/interfaces/m_nMapId0.html | 130 +- docs/interfaces/m_nMapId1.html | 130 +- docs/interfaces/m_nMapId2.html | 130 +- docs/interfaces/m_nMapId3.html | 130 +- docs/interfaces/m_nMapId4.html | 130 +- docs/interfaces/m_nMapId5.html | 130 +- docs/interfaces/m_nMusicID.html | 132 +- .../m_nPersonaDataPublicCommendsFriendly.html | 132 +- .../m_nPersonaDataPublicCommendsLeader.html | 132 +- .../m_nPersonaDataPublicCommendsTeacher.html | 132 +- .../interfaces/m_nPersonaDataPublicLevel.html | 132 +- docs/interfaces/m_nStartingSide0.html | 130 +- docs/interfaces/m_nTeamWithFirstChoice.html | 130 +- docs/interfaces/m_nVoteMapIdsList.html | 16 +- docs/interfaces/m_nVoteOptionCount.html | 12 +- docs/interfaces/m_passiveItems.html | 10 +- docs/interfaces/m_rank.html | 14 +- .../m_roundData_playerPositions.html | 132 +- docs/interfaces/m_roundData_playerTeams.html | 132 +- docs/interfaces/m_roundData_playerXuids.html | 132 +- docs/interfaces/m_szClan.html | 132 +- docs/interfaces/m_szCrosshairCodes.html | 132 +- docs/interfaces/m_ubSignature.html | 258 +- docs/interfaces/m_vServerControlPoints.html | 10 +- .../m_vecPlayerPatchEconIndices.html | 12 +- docs/types/GrenadeType.html | 2 +- docs/types/IDataTable.html | 2 +- docs/types/INonSpecificGameEvent.html | 2 +- docs/types/ISendProp.html | 2 +- docs/types/InputButton.html | 2 +- docs/types/ItemQuality.html | 2 +- docs/types/TeamName.html | 2 +- docs/types/TransmitEntities.html | 2 +- docs/types/WellKnownStringTable.html | 2 +- 996 files changed, 22015 insertions(+), 15316 deletions(-) diff --git a/browser/bundle.js b/browser/bundle.js index 657ac2e1e..1b4de125b 100644 --- a/browser/bundle.js +++ b/browser/bundle.js @@ -2,7 +2,7 @@ window.Buffer = require("buffer").Buffer; window.demofile = require("../dist/demo"); -},{"../dist/demo":6,"buffer":80}],2:[function(require,module,exports){ +},{"../dist/demo":6,"buffer":81}],2:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); function assertExists(value, message) { @@ -65,7 +65,7 @@ class ConVars extends events_1.EventEmitter { } exports.ConVars = ConVars; -},{"events":82}],5:[function(require,module,exports){ +},{"events":84}],5:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.decodeCrosshairCode = exports.CrosshairStyle = void 0; @@ -115,6 +115,8 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.DemoFile = exports.parseHeader = void 0; const events_1 = require("events"); const timers = require("timers"); +const url_1 = require("url"); +const https = require("https"); const ByteBuffer = require("bytebuffer"); const bitbuffer_1 = require("./ext/bitbuffer"); const assert = require("assert"); @@ -130,6 +132,26 @@ const assert_exists_1 = require("./assert-exists"); const grenadetrajectory_1 = require("./supplements/grenadetrajectory"); const molotovdetonate_1 = require("./supplements/molotovdetonate"); const itempurchase_1 = require("./supplements/itempurchase"); +function httpGet(url) { + return new Promise((resolve, reject) => { + https + .request(url, res => { + const chunks = []; + res.on("data", chunk => { + chunks.push(chunk); + }); + res.on("end", () => { + if (res.statusCode == 200) { + resolve(Buffer.concat(chunks)); + } + else { + reject(`request '${url}' failed: ${res.statusCode} (${res.statusMessage})`); + } + }); + }) + .end(); + }); +} function parseHeaderBytebuf(bytebuf) { return { magic: bytebuf.readString(8, ByteBuffer.METRICS_BYTES).split("\0", 2)[0], @@ -202,6 +224,7 @@ class DemoFile extends events_1.EventEmitter { this._timeoutTimerToken = null; this._encryptionKey = null; this._hasEnded = false; + this._isBroadcastFragment = false; this._supplementEvents = [ grenadetrajectory_1.default, molotovdetonate_1.default, @@ -301,6 +324,89 @@ class DemoFile extends events_1.EventEmitter { } return null; } + /** + * Start streaming a GOTV broadcast over HTTP. + * Will keep streaming until the broadcast finishes. + * + * @param url URL to the GOTV broadcast. + * @returns Promise that resolves then the broadcast finishes. + */ + async parseBroadcast(url) { + if (!url.endsWith("/")) + url += "/"; + // Some packets are formatted slightly differently in + // broadcast fragments compared to a normal demo file. + this._isBroadcastFragment = true; + const syncUrl = new url_1.URL("sync", url).toString(); + const syncResponse = await httpGet(syncUrl); + const syncDto = JSON.parse(syncResponse.toString()); + if (syncDto.protocol !== 4) { + throw new Error(`expected protocol version 4, got: ${syncDto.protocol}`); + } + if (syncDto.token_redirect != null) { + url = new url_1.URL(syncDto.token_redirect, url).toString(); + if (!url.endsWith("/")) + url += "/"; + } + this.header = { + magic: "HL2DEMO", + protocol: syncDto.protocol, + networkProtocol: 0, + serverName: `GOTV Broadcast: ${url}`, + clientName: "GOTV Demo", + mapName: syncDto.map, + gameDirectory: "csgo", + playbackTime: 0, + playbackTicks: 0, + playbackFrames: 0, + signonLength: 0 + }; + this.tickInterval = 1 / syncDto.tps; + let cancelled = false; + this.emit("start", { + cancel() { + cancelled = true; + } + }); + // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition + if (cancelled) { + return; + } + const startUrl = new url_1.URL(`${syncDto.signup_fragment | 0}/start`, url).toString(); + const startResponse = await httpGet(startUrl); + // Read the signon fragment + this._bytebuf = ByteBuffer.wrap(startResponse, true); + while (this._bytebuf.remaining() > 0) { + this._readCommand(); + } + // Keep reading fragments until we run out + let fragment = syncDto.fragment | 0; + let fragmentType = "full"; + while (!this._hasEnded) { + const fragmentUrl = new url_1.URL(`${fragment}/${fragmentType}`, url).toString(); + let fragmentResponse; + try { + fragmentResponse = await httpGet(fragmentUrl); + } + catch { + // HTTP 404 errors are expected - each fragment only lasts for a few seconds. + // Wait for 1-2 secs before retrying to avoid spamming the relay. + await new Promise(resolve => setTimeout(resolve, 1000 + Math.random() * 1000)); + continue; + } + // We need to request {fragment}/full + {fragment}/delta + if (fragmentType == "full") { + fragmentType = "delta"; + } + else { + fragment += 1; + } + this._bytebuf = ByteBuffer.wrap(fragmentResponse, true); + while (this._bytebuf.remaining() > 0) { + this._readCommand(); + } + } + } parseStream(stream) { this._hasEnded = false; const onReceiveChunk = (chunk) => { @@ -476,12 +582,14 @@ class DemoFile extends events_1.EventEmitter { * @event DemoFile#net_MessageName */ _handleDemoPacket() { - this._ensureRemaining(160); - // skip cmd info - this._bytebuf.skip(152); - // skip over sequence info - this._bytebuf.readInt32(); - this._bytebuf.readInt32(); + if (!this._isBroadcastFragment) { + this._ensureRemaining(160); + // skip cmd info + this._bytebuf.skip(152); + // skip over sequence info + this._bytebuf.readInt32(); + this._bytebuf.readInt32(); + } const chunk = this._readIBytes(); while (chunk.remaining()) { const cmd = chunk.readVarint32(); @@ -502,7 +610,9 @@ class DemoFile extends events_1.EventEmitter { this._readIBytes(); } _handleDataTables() { - const chunk = this._readIBytes(); + const chunk = this._isBroadcastFragment + ? this._bytebuf + : this._readIBytes(); this.entities.handleDataTables(chunk); } _handleUserCmd() { @@ -674,33 +784,33 @@ class DemoFile extends events_1.EventEmitter { this.emit("tickstart", this.currentTick); } switch (command) { - case 2 /* Packet */: - case 1 /* Signon */: + case 2 /* DemoCommands.Packet */: + case 1 /* DemoCommands.Signon */: this._handleDemoPacket(); break; - case 6 /* DataTables */: + case 6 /* DemoCommands.DataTables */: this._handleDataTables(); break; - case 9 /* StringTables */: + case 9 /* DemoCommands.StringTables */: this._handleStringTables(); break; - case 4 /* ConsoleCmd */: // TODO + case 4 /* DemoCommands.ConsoleCmd */: // TODO this._handleDataChunk(); break; - case 5 /* UserCmd */: + case 5 /* DemoCommands.UserCmd */: this._handleUserCmd(); break; - case 7 /* Stop */: + case 7 /* DemoCommands.Stop */: this.cancel(); this.emit("tickend", this.currentTick); this._emitEnd({ incomplete: false }); return; - case 8 /* CustomData */: + case 8 /* DemoCommands.CustomData */: throw new Error("Custom data not supported"); - case 3 /* SyncTick */: + case 3 /* DemoCommands.SyncTick */: break; default: - throw new Error("Unrecognised command"); + throw new Error(`Unrecognised command: ${command}`); } } _parseRecurse() { @@ -739,7 +849,7 @@ exports.DemoFile = DemoFile; }).call(this)}).call(this,require("buffer").Buffer) -},{"./assert-exists":2,"./consts":3,"./convars":4,"./entities":7,"./ext/bitbuffer":18,"./gameevents":20,"./icekey":21,"./net":22,"./stringtables":29,"./supplements/grenadetrajectory":30,"./supplements/itempurchase":31,"./supplements/molotovdetonate":32,"./usermessages":33,"assert":73,"buffer":80,"bytebuffer":81,"events":82,"timers":697}],7:[function(require,module,exports){ +},{"./assert-exists":2,"./consts":3,"./convars":4,"./entities":7,"./ext/bitbuffer":18,"./gameevents":20,"./icekey":21,"./net":22,"./stringtables":29,"./supplements/grenadetrajectory":30,"./supplements/itempurchase":31,"./supplements/molotovdetonate":32,"./usermessages":33,"assert":73,"buffer":81,"bytebuffer":83,"events":84,"https":85,"timers":752,"url":753}],7:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Entities = void 0; @@ -1033,7 +1143,6 @@ class Entities extends events_1.EventEmitter { delete this.pendingBaselines[classId]; } } - assert.equal(chunk.remaining(), 0); this.emit("datatablesready"); } _gatherExcludes(table) { @@ -1042,7 +1151,7 @@ class Entities extends events_1.EventEmitter { if ((prop.flags & props_1.SPROP_EXCLUDE) !== 0) { excludes.push(prop); } - if (prop.type === 6 /* DataTable */) { + if (prop.type === 6 /* PropType.DataTable */) { const subTable = (0, assert_exists_1.default)(this._findTableByName(prop.dtName)); excludes.push(...this._gatherExcludes(subTable)); } @@ -1058,7 +1167,7 @@ class Entities extends events_1.EventEmitter { isPropExcluded(excludes, table, prop)) { continue; } - if (prop.type === 6 /* DataTable */) { + if (prop.type === 6 /* PropType.DataTable */) { const subTable = (0, assert_exists_1.default)(this._findTableByName(prop.dtName)); const childProps = this._gatherProps(subTable, excludes); if ((prop.flags & props_1.SPROP_COLLAPSIBLE) === 0) { @@ -1072,7 +1181,7 @@ class Entities extends events_1.EventEmitter { flattened.push({ prop, table, - decode: (0, props_1.makeDecoder)(prop, prop.type === 5 /* Array */ ? table.props[index - 1] : undefined), + decode: (0, props_1.makeDecoder)(prop, prop.type === 5 /* PropType.Array */ ? table.props[index - 1] : undefined), collapsible: true }); } @@ -1133,6 +1242,7 @@ class Entities extends events_1.EventEmitter { } const klass = this._serverClassConstructor.get(classId) || networkable_1.Networkable; const entity = new klass(this._demo, index, classId, serialNum, props); + // eslint-disable-next-line @typescript-eslint/no-unsafe-argument this.entities.set(index, entity); return entity; } @@ -1307,6 +1417,7 @@ class Entities extends events_1.EventEmitter { : undefined; const existingEntity = this.entities.get(entityIndex); const entity = this._addEntity(entityIndex, classId, serialNum, existingEntity, entityBaselineProps); + // eslint-disable-next-line @typescript-eslint/no-unsafe-argument this._readNewEntity(entityBitBuffer, entity); if (entity !== existingEntity) { const eventVars = { entity }; @@ -1318,6 +1429,7 @@ class Entities extends events_1.EventEmitter { if (msg.updateBaseline) { this._entityBaselines[msg.baseline ? 0 : 1].set(entityIndex, { classId, + // eslint-disable-next-line @typescript-eslint/no-unsafe-argument props: cloneProps(entity.props) }); } @@ -1390,13 +1502,14 @@ class Entities extends events_1.EventEmitter { this._handleUserInfoUpdate(event.entryIndex, event.oldUserData, event.userData); } else if (event.table.name === "instancebaseline") { + // eslint-disable-next-line @typescript-eslint/no-unsafe-argument this._handleInstanceBaselineUpdate(event); } } } exports.Entities = Entities; -},{"./assert-exists":2,"./consts":3,"./entities/baseentity":8,"./entities/gamerules":9,"./entities/networkable":11,"./entities/player":12,"./entities/projectile":13,"./entities/team":14,"./entities/weapon":15,"./ext/bitbuffer":18,"./net":22,"./props":23,"assert":73,"events":82,"immutable":84,"iter-tools":453,"long":682}],8:[function(require,module,exports){ +},{"./assert-exists":2,"./consts":3,"./entities/baseentity":8,"./entities/gamerules":9,"./entities/networkable":11,"./entities/player":12,"./entities/projectile":13,"./entities/team":14,"./entities/weapon":15,"./ext/bitbuffer":18,"./net":22,"./props":23,"assert":73,"events":84,"immutable":87,"iter-tools":473,"long":712}],8:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.BaseEntity = void 0; @@ -5932,6 +6045,74 @@ exports.paintKitIndexMap = { name: "cu_ak47_nightwish", tag: "Nightwish" }, + "1142": { + name: "cu_usp_printstream", + tag: "Printstream" + }, + "1143": { + name: "cu_ak47_cogthings", + tag: "Ice Coaled" + }, + "1144": { + name: "cu_awp_chroma_pink", + tag: "Chromatic Aberration" + }, + "1145": { + name: "gs_revolver_purple_elite", + tag: "Crazy 8" + }, + "1146": { + name: "gs_famas_corp_meow", + tag: "Meow 36" + }, + "1147": { + name: "cu_galil_destroyer", + tag: "Destroyer" + }, + "1148": { + name: "cu_m249_downvote", + tag: "Downtown" + }, + "1149": { + name: "cu_m4a4_elite_tactical", + tag: "Poly Mag" + }, + "1150": { + name: "cu_mac10_monkeyflage", + tag: "Monkeyflage" + }, + "1151": { + name: "cu_sg553_cyber_dragon", + tag: "Dragon Tech" + }, + "1152": { + name: "cu_negev_clear_sky", + tag: "Drop Me" + }, + "1153": { + name: "gs_p250_visions", + tag: "Visions" + }, + "1154": { + name: "gs_p90_tangled", + tag: "Vent Rush" + }, + "1155": { + name: "cu_sawedoff_kisslove", + tag: "Kiss♥Love" + }, + "1156": { + name: "cu_dual_elites_evil_flora", + tag: "Flora Carnivora" + }, + "1157": { + name: "gs_ump_roadblock", + tag: "Roadblock" + }, + "1158": { + name: "gs_glock_elite_camo", + tag: "Winterized" + }, "10006": { name: "bloodhound_black_silver", tag: "Charred" @@ -6377,7 +6558,7 @@ class Player extends baseentity_1.BaseEntity { * @returns lifeState == 0 */ get isAlive() { - return this.lifeState === 0 /* Alive */; + return this.lifeState === 0 /* LifeState.Alive */; } /** * @returns User info associated with this player @@ -6922,7 +7103,7 @@ exports.EntityHandle = EntityHandle; },{"./consts":3}],17:[function(require,module,exports){ "use strict"; -/* eslint-disable @typescript-eslint/no-unsafe-member-access, @typescript-eslint/explicit-module-boundary-types, sonarjs/no-duplicated-branches */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-argument, sonarjs/no-duplicated-branches */ // DO NOT MODIFY! // Auto-generated by ./generators/eventtypes.ts Object.defineProperty(exports, "__esModule", { value: true }); @@ -7131,7 +7312,7 @@ function annotateEvent(entities, eventName, event) { } exports.annotateEvent = annotateEvent; -},{"./entities/itemdefs":10,"long":682}],18:[function(require,module,exports){ +},{"./entities/itemdefs":10,"long":712}],18:[function(require,module,exports){ (function (Buffer){(function (){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); @@ -7337,7 +7518,7 @@ bit_buffer_1.BitStream.prototype.writeUInt32 = bit_buffer_1.BitStream.prototype. }).call(this)}).call(this,require("buffer").Buffer) -},{"bit-buffer":79,"buffer":80}],19:[function(require,module,exports){ +},{"bit-buffer":79,"buffer":81}],19:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.GameEvent = void 0; @@ -7448,7 +7629,7 @@ class GameEvents extends events_1.EventEmitter { } exports.GameEvents = GameEvents; -},{"./eventtypes":17,"./gameevent":19,"events":82}],21:[function(require,module,exports){ +},{"./eventtypes":17,"./gameevent":19,"events":84}],21:[function(require,module,exports){ "use strict"; // Copied from https://github.com/DSergiu/node-ice // --- @@ -7713,38 +7894,12 @@ IceKey.sXor = [ [0xea, 0xcb, 0x2e, 0x04] ]; IceKey.pBox = [ - 0x00000001, - 0x00000080, - 0x00000400, - 0x00002000, - 0x00080000, - 0x00200000, - 0x01000000, - 0x40000000, - 0x00000008, - 0x00000020, - 0x00000100, - 0x00004000, - 0x00010000, - 0x00800000, - 0x04000000, - 0x20000000, - 0x00000004, - 0x00000010, - 0x00000200, - 0x00008000, - 0x00020000, - 0x00400000, - 0x08000000, - 0x10000000, - 0x00000002, - 0x00000040, - 0x00000800, - 0x00001000, - 0x00040000, - 0x00100000, - 0x02000000, - 0x80000000 + 0x00000001, 0x00000080, 0x00000400, 0x00002000, 0x00080000, 0x00200000, + 0x01000000, 0x40000000, 0x00000008, 0x00000020, 0x00000100, 0x00004000, + 0x00010000, 0x00800000, 0x04000000, 0x20000000, 0x00000004, 0x00000010, + 0x00000200, 0x00008000, 0x00020000, 0x00400000, 0x08000000, 0x10000000, + 0x00000002, 0x00000040, 0x00000800, 0x00001000, 0x00040000, 0x00100000, + 0x02000000, 0x80000000 ]; IceKey.keyrot = [0, 1, 2, 3, 2, 1, 3, 0, 1, 3, 2, 0, 3, 1, 0, 2]; @@ -8078,17 +8233,17 @@ function makeInt64Decoder(sendProp) { } function makeValueDecoder(sendProp) { switch (sendProp.type) { - case 0 /* Int */: + case 0 /* PropType.Int */: return makeIntDecoder(sendProp); - case 1 /* Float */: + case 1 /* PropType.Float */: return makeFloatDecoder(sendProp); - case 2 /* Vector */: + case 2 /* PropType.Vector */: return makeVectorDecoder(sendProp); - case 3 /* VectorXY */: + case 3 /* PropType.VectorXY */: return makeVectorXYDecoder(sendProp); - case 4 /* String */: + case 4 /* PropType.String */: return makeStringDecoder(sendProp); - case 7 /* Int64 */: + case 7 /* PropType.Int64 */: return makeInt64Decoder(sendProp); default: throw new Error(`Unsupported send prop type ${sendProp.type}`); @@ -8109,8 +8264,8 @@ function makeArrayDecoder(sendProp, arrayElementProp) { } function makeDecoder(sendProp, arrayElementProp) { const type = sendProp.type; - assert(type !== 6 /* DataTable */); - if (type === 5 /* Array */) { + assert(type !== 6 /* PropType.DataTable */); + if (type === 5 /* PropType.Array */) { return makeArrayDecoder(sendProp, (0, assert_exists_1.default)(arrayElementProp, "array prop with no element prop")); } else { @@ -8119,7 +8274,7 @@ function makeDecoder(sendProp, arrayElementProp) { } exports.makeDecoder = makeDecoder; -},{"./assert-exists":2,"./consts":3,"./entityhandle":16,"assert":73,"long":682}],24:[function(require,module,exports){ +},{"./assert-exists":2,"./consts":3,"./entityhandle":16,"assert":73,"long":712}],24:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CMsgGCCStrike15V2MatchmakingServerRoundStats_DropInfo = exports.CMsgGCCStrike15V2MatchmakingServerRoundStats = exports.CMsgGCCStrike15V2MatchmakingGC2ClientReserve = exports.CMsgGCCStrike15V2MatchmakingServerReservationResponse = exports.CMsgGCCStrike15V2MatchmakingGC2ServerReserve = exports.CPreMatchInfoData_TeamStats = exports.CPreMatchInfoData = exports.CDataGCCStrike15V2TournamentMatchDraft_Entry = exports.CDataGCCStrike15V2TournamentMatchDraft = exports.CMsgGCCStrike15V2MatchmakingGC2ClientUpdate_Note = exports.CMsgGCCStrike15V2MatchmakingGC2ClientUpdate = exports.CMsgGCCStrike15V2MatchmakingClient2ServerPing = exports.CMsgGCCStrike15V2MatchmakingStop = exports.CMsgGCCStrike15V2MatchmakingStart = exports.CMsgGCCStrike15V2GC2ServerReservationUpdate = exports.CMsgGCCStrike15V2MatchmakingGC2ServerConfirm = exports.CMsgGCCStrike15V2MatchmakingGCOperationalStats = exports.CMsgGCServerQuestUpdateData = exports.DeepPlayerMatchEvent = exports.DeepPlayerStatsEntry = exports.PlayerQuestData_QuestItemData = exports.PlayerQuestData = exports.ScoreLeaderboardData_AccountEntries = exports.ScoreLeaderboardData_Entry = exports.ScoreLeaderboardData = exports.MatchEndItemUpdates = exports.XpProgressData = exports.CMsgCsgoSteamUserStatChange = exports.IpAddressMask = exports.ServerHltvInfo = exports.TournamentMatchSetup = exports.AccountActivity = exports.PlayerMedalsInfo = exports.PlayerCommendationInfo = exports.PlayerRankingInfo = exports.OperationalStatisticsPacket = exports.OperationalStatisticElement = exports.OperationalStatisticDescription = exports.GlobalStatistics = exports.TournamentEvent = exports.TournamentTeam = exports.TournamentPlayer = exports.DetailedSearchStatistic = exports.DataCenterPing = exports.GameServerPing = exports.EInitSystemResult = exports.EClientReportingVersion = exports.ECsgoSteamUserStat = exports.ECsgoGCMsg = exports.protobufPackage = void 0; @@ -11684,7 +11839,8 @@ exports.CMsgGCCStrike15V2MatchmakingServerReservationResponse = { message.reservationid = reader.uint64(); break; case 2: - message.reservation = exports.CMsgGCCStrike15V2MatchmakingGC2ServerReserve.decode(reader, reader.uint32()); + message.reservation = + exports.CMsgGCCStrike15V2MatchmakingGC2ServerReserve.decode(reader, reader.uint32()); break; case 3: message.map = reader.string(); @@ -11847,7 +12003,8 @@ exports.CMsgGCCStrike15V2MatchmakingGC2ClientReserve = { message.reservationid = reader.uint64(); break; case 5: - message.reservation = exports.CMsgGCCStrike15V2MatchmakingGC2ServerReserve.decode(reader, reader.uint32()); + message.reservation = + exports.CMsgGCCStrike15V2MatchmakingGC2ServerReserve.decode(reader, reader.uint32()); break; case 6: message.map = reader.string(); @@ -12059,7 +12216,8 @@ exports.CMsgGCCStrike15V2MatchmakingServerRoundStats = { message.reservationid = reader.uint64(); break; case 2: - message.reservation = exports.CMsgGCCStrike15V2MatchmakingGC2ServerReserve.decode(reader, reader.uint32()); + message.reservation = + exports.CMsgGCCStrike15V2MatchmakingGC2ServerReserve.decode(reader, reader.uint32()); break; case 3: message.map = reader.string(); @@ -12235,7 +12393,8 @@ exports.CMsgGCCStrike15V2MatchmakingServerRoundStats = { } break; case 26: - message.dropInfo = exports.CMsgGCCStrike15V2MatchmakingServerRoundStats_DropInfo.decode(reader, reader.uint32()); + message.dropInfo = + exports.CMsgGCCStrike15V2MatchmakingServerRoundStats_DropInfo.decode(reader, reader.uint32()); break; case 27: message.bSwitchedTeams = reader.bool(); @@ -12487,7 +12646,8 @@ exports.CMsgGCCStrike15V2MatchmakingGC2ClientHello = { message.accountId = reader.uint32(); break; case 2: - message.ongoingmatch = exports.CMsgGCCStrike15V2MatchmakingGC2ClientReserve.decode(reader, reader.uint32()); + message.ongoingmatch = + exports.CMsgGCCStrike15V2MatchmakingGC2ClientReserve.decode(reader, reader.uint32()); break; case 3: message.globalStats = exports.GlobalStatistics.decode(reader, reader.uint32()); @@ -12711,7 +12871,8 @@ exports.CMsgGCCStrike15V2MatchmakingGC2ClientAbandon = { message.accountId = reader.uint32(); break; case 2: - message.abandonedMatch = exports.CMsgGCCStrike15V2MatchmakingGC2ClientReserve.decode(reader, reader.uint32()); + message.abandonedMatch = + exports.CMsgGCCStrike15V2MatchmakingGC2ClientReserve.decode(reader, reader.uint32()); break; case 3: message.penaltySeconds = reader.uint32(); @@ -14515,7 +14676,8 @@ exports.CMsgGCCStrike15V2MatchEndRunRewardDrops = { const tag = reader.uint32(); switch (tag >>> 3) { case 3: - message.serverinfo = exports.CMsgGCCStrike15V2MatchmakingServerReservationResponse.decode(reader, reader.uint32()); + message.serverinfo = + exports.CMsgGCCStrike15V2MatchmakingServerReservationResponse.decode(reader, reader.uint32()); break; case 4: message.matchEndQuestData = exports.CMsgGCServerQuestUpdateData.decode(reader, reader.uint32()); @@ -15192,7 +15354,8 @@ exports.CDataGCCStrike15V2MatchInfo = { message.watchablematchinfo = exports.WatchableMatchInfo.decode(reader, reader.uint32()); break; case 4: - message.roundstatsLegacy = exports.CMsgGCCStrike15V2MatchmakingServerRoundStats.decode(reader, reader.uint32()); + message.roundstatsLegacy = + exports.CMsgGCCStrike15V2MatchmakingServerRoundStats.decode(reader, reader.uint32()); break; case 5: message.roundstatsall.push(exports.CMsgGCCStrike15V2MatchmakingServerRoundStats.decode(reader, reader.uint32())); @@ -19139,11 +19302,11 @@ if (minimal_1.util.Long !== Long) { (0, minimal_1.configure)(); } -},{"./engine_gcmessages":26,"long":682,"protobufjs/minimal":685}],25:[function(require,module,exports){ +},{"./engine_gcmessages":26,"long":712,"protobufjs/minimal":715}],25:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CCSUsrMsgVoteStart = exports.CCSUsrMsgCallVoteFailed = exports.CCSUsrMsgXRankUpd = exports.CCSUsrMsgXRankGet = exports.CCSUsrMsgPlayerDecalDigitalSignature = exports.CCSUsrMsgScoreLeaderboardData = exports.CCSUsrMsgQuestProgress = exports.CCSUsrMsgDisplayInventory = exports.CCSUsrMsgPlayerStatsUpdate_Stat = exports.CCSUsrMsgPlayerStatsUpdate = exports.CCSUsrMsgMatchEndConditions = exports.CCSUsrMsgAchievementEvent = exports.CCSUsrMsgCurrentTimescale = exports.CCSUsrMsgDesiredTimescale = exports.CCSUsrMsgKillCam = exports.CCSUsrMsgReportHit = exports.CCSUsrMsgAdjustMoney = exports.CCSUsrMsgEntityOutlineHighlight = exports.CCSUsrMsgUpdateScreenHealthBar = exports.CCSUsrMsgWeaponSound = exports.CCSUsrMsgReloadEffect = exports.CCSUsrMsgSendPlayerItemFound = exports.CCSUsrMsgSendPlayerItemDrops = exports.CCSUsrMsgProcessSpottedEntityUpdate_SpottedEntityUpdate = exports.CCSUsrMsgProcessSpottedEntityUpdate = exports.CCSUsrMsgKeyHintText = exports.CCSUsrMsgHintText = exports.CCSUsrMsgRadioText = exports.CCSUsrMsgDamage = exports.CCSUsrMsgVoiceMask_PlayerMask = exports.CCSUsrMsgVoiceMask = exports.CCSUsrMsgRawAudio = exports.CCSUsrMsgSendAudio = exports.CCSUsrMsgCloseCaptionDirect = exports.CCSUsrMsgCloseCaption = exports.CCSUsrMsgRumble = exports.CCSUsrMsgFade = exports.CCSUsrMsgShake = exports.CCSUsrMsgHudMsg = exports.CCSUsrMsgTextMsg = exports.CCSUsrMsgSayText2 = exports.CCSUsrMsgSayText = exports.CCSUsrMsgHudText = exports.CCSUsrMsgTrain = exports.CCSUsrMsgGeiger = exports.CCSUsrMsgVGUIMenu_Subkey = exports.CCSUsrMsgVGUIMenu = exports.ECSUsrMsgDisconnectToLobbyAction = exports.ECstrike15UserMessages = exports.protobufPackage = void 0; -exports.CCSUsrMsgServerRankRevealAll = exports.CCSUsrMsgClientInfo = exports.CCSUsrMsgWarmupHasEnded = exports.CCSUsrMsgDisconnectToLobby = exports.CCSUsrMsgStopSpectatorMode = exports.CCSUsrMsgRequestState = exports.CCSUsrMsgGameTitle = exports.CCSUsrMsgResetHud = exports.CCSUsrMsgDeepStats = exports.CCSUsrMsgCurrentRoundOdds = exports.CCSUsrMsgRoundImpactScoreData_InitialConditions = exports.CCSUsrMsgRoundImpactScoreData_RisEvent_Damage = exports.CCSUsrMsgRoundImpactScoreData_RisEvent_Objective = exports.CCSUsrMsgRoundImpactScoreData_RisEvent_Victim = exports.CCSUsrMsgRoundImpactScoreData_RisEvent = exports.CCSUsrMsgRoundImpactScoreData = exports.CCSUsrMsgEndOfMatchAllPlayersData_PlayerData = exports.CCSUsrMsgEndOfMatchAllPlayersData_Accolade = exports.CCSUsrMsgEndOfMatchAllPlayersData = exports.CCSUsrMsgSurvivalStats_Damage = exports.CCSUsrMsgSurvivalStats_Placement = exports.CCSUsrMsgSurvivalStats_Fact = exports.CCSUsrMsgSurvivalStats = exports.CCSUsrMsgSSUI = exports.CCSUsrMsgRoundBackupFilenames = exports.CCSUsrMsgGlowPropTurnOff = exports.CCSUsrMsgItemDrop = exports.CCSUsrMsgMatchStatsUpdate = exports.CCSUsrMsgMarkAchievement = exports.CCSUsrMsgAmmoDenied = exports.CCSUsrMsgBarTime = exports.CCSUsrMsgShowMenu = exports.CCSUsrMsgItemPickup = exports.CCSUsrMsgXpUpdate = exports.CCSUsrMsgServerRankUpdate_RankUpdate = exports.CCSUsrMsgServerRankUpdate = exports.CCSUsrMsgSendLastKillerDamageToClient = exports.CCSUsrMsgVoteSetup = exports.CCSUsrMsgVoteFailed = exports.CCSUsrMsgVotePass = void 0; +exports.CCSUsrMsgUtilMsg = exports.CCSUsrMsgServerRankRevealAll = exports.CCSUsrMsgClientInfo = exports.CCSUsrMsgWarmupHasEnded = exports.CCSUsrMsgDisconnectToLobby = exports.CCSUsrMsgStopSpectatorMode = exports.CCSUsrMsgRequestState = exports.CCSUsrMsgGameTitle = exports.CCSUsrMsgResetHud = exports.CCSUsrMsgDeepStats = exports.CCSUsrMsgCurrentRoundOdds = exports.CCSUsrMsgRoundImpactScoreData_InitialConditions = exports.CCSUsrMsgRoundImpactScoreData_RisEvent_Damage = exports.CCSUsrMsgRoundImpactScoreData_RisEvent_Objective = exports.CCSUsrMsgRoundImpactScoreData_RisEvent_Victim = exports.CCSUsrMsgRoundImpactScoreData_RisEvent = exports.CCSUsrMsgRoundImpactScoreData = exports.CCSUsrMsgEndOfMatchAllPlayersData_PlayerData = exports.CCSUsrMsgEndOfMatchAllPlayersData_Accolade = exports.CCSUsrMsgEndOfMatchAllPlayersData = exports.CCSUsrMsgSurvivalStats_Damage = exports.CCSUsrMsgSurvivalStats_Placement = exports.CCSUsrMsgSurvivalStats_Fact = exports.CCSUsrMsgSurvivalStats = exports.CCSUsrMsgSSUI = exports.CCSUsrMsgRoundBackupFilenames = exports.CCSUsrMsgGlowPropTurnOff = exports.CCSUsrMsgItemDrop = exports.CCSUsrMsgMatchStatsUpdate = exports.CCSUsrMsgMarkAchievement = exports.CCSUsrMsgAmmoDenied = exports.CCSUsrMsgBarTime = exports.CCSUsrMsgShowMenu = exports.CCSUsrMsgItemPickup = exports.CCSUsrMsgXpUpdate = exports.CCSUsrMsgServerRankUpdate_RankUpdate = exports.CCSUsrMsgServerRankUpdate = exports.CCSUsrMsgSendLastKillerDamageToClient = exports.CCSUsrMsgVoteSetup = exports.CCSUsrMsgVoteFailed = exports.CCSUsrMsgVotePass = void 0; /* eslint-disable */ const minimal_1 = require("protobufjs/minimal"); const Long = require("long"); @@ -19226,6 +19389,7 @@ var ECstrike15UserMessages; ECstrike15UserMessages[ECstrike15UserMessages["CS_UM_RoundImpactScoreData"] = 79] = "CS_UM_RoundImpactScoreData"; ECstrike15UserMessages[ECstrike15UserMessages["CS_UM_CurrentRoundOdds"] = 80] = "CS_UM_CurrentRoundOdds"; ECstrike15UserMessages[ECstrike15UserMessages["CS_UM_DeepStats"] = 81] = "CS_UM_DeepStats"; + ECstrike15UserMessages[ECstrike15UserMessages["CS_UM_UtilMsg"] = 82] = "CS_UM_UtilMsg"; })(ECstrike15UserMessages = exports.ECstrike15UserMessages || (exports.ECstrike15UserMessages = {})); var ECSUsrMsgDisconnectToLobbyAction; (function (ECSUsrMsgDisconnectToLobbyAction) { @@ -22715,7 +22879,8 @@ exports.CCSUsrMsgEndOfMatchAllPlayersData_PlayerData = { message.teamnumber = reader.int32(); break; case 5: - message.nomination = exports.CCSUsrMsgEndOfMatchAllPlayersData_Accolade.decode(reader, reader.uint32()); + message.nomination = + exports.CCSUsrMsgEndOfMatchAllPlayersData_Accolade.decode(reader, reader.uint32()); break; case 6: message.items.push(cstrike15_gcmessages_1.CEconItemPreviewDataBlock.decode(reader, reader.uint32())); @@ -22775,7 +22940,8 @@ exports.CCSUsrMsgRoundImpactScoreData = { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.initConditions = exports.CCSUsrMsgRoundImpactScoreData_InitialConditions.decode(reader, reader.uint32()); + message.initConditions = + exports.CCSUsrMsgRoundImpactScoreData_InitialConditions.decode(reader, reader.uint32()); break; case 2: message.allRisEventData.push(exports.CCSUsrMsgRoundImpactScoreData_RisEvent.decode(reader, reader.uint32())); @@ -22855,10 +23021,12 @@ exports.CCSUsrMsgRoundImpactScoreData_RisEvent = { message.tAlive = reader.int32(); break; case 5: - message.victimData = exports.CCSUsrMsgRoundImpactScoreData_RisEvent_Victim.decode(reader, reader.uint32()); + message.victimData = + exports.CCSUsrMsgRoundImpactScoreData_RisEvent_Victim.decode(reader, reader.uint32()); break; case 6: - message.objectiveData = exports.CCSUsrMsgRoundImpactScoreData_RisEvent_Objective.decode(reader, reader.uint32()); + message.objectiveData = + exports.CCSUsrMsgRoundImpactScoreData_RisEvent_Objective.decode(reader, reader.uint32()); break; case 7: message.allDamageData.push(exports.CCSUsrMsgRoundImpactScoreData_RisEvent_Damage.decode(reader, reader.uint32())); @@ -23462,7 +23630,8 @@ exports.CCSUsrMsgServerRankRevealAll = { message.secondsTillShutdown = reader.int32(); break; case 2: - message.reservation = cstrike15_gcmessages_1.CMsgGCCStrike15V2MatchmakingGC2ServerReserve.decode(reader, reader.uint32()); + message.reservation = + cstrike15_gcmessages_1.CMsgGCCStrike15V2MatchmakingGC2ServerReserve.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -23482,6 +23651,75 @@ exports.CCSUsrMsgServerRankRevealAll = { return message; } }; +function createBaseCCSUsrMsgUtilMsg() { + return { utilAction: "", util1: 0, util2: 0, util3: 0, util4: 0, util5: 0 }; +} +exports.CCSUsrMsgUtilMsg = { + encode(message, writer = minimal_1.Writer.create()) { + if (message.utilAction !== "") { + writer.uint32(10).string(message.utilAction); + } + if (message.util1 !== 0) { + writer.uint32(16).int32(message.util1); + } + if (message.util2 !== 0) { + writer.uint32(24).int32(message.util2); + } + if (message.util3 !== 0) { + writer.uint32(32).int32(message.util3); + } + if (message.util4 !== 0) { + writer.uint32(40).int32(message.util4); + } + if (message.util5 !== 0) { + writer.uint32(48).int32(message.util5); + } + return writer; + }, + decode(input, length) { + const reader = input instanceof minimal_1.Reader ? input : new minimal_1.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCCSUsrMsgUtilMsg(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.utilAction = reader.string(); + break; + case 2: + message.util1 = reader.int32(); + break; + case 3: + message.util2 = reader.int32(); + break; + case 4: + message.util3 = reader.int32(); + break; + case 5: + message.util4 = reader.int32(); + break; + case 6: + message.util5 = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object) { + var _a, _b, _c, _d, _e, _f; + const message = createBaseCCSUsrMsgUtilMsg(); + message.utilAction = (_a = object.utilAction) !== null && _a !== void 0 ? _a : ""; + message.util1 = (_b = object.util1) !== null && _b !== void 0 ? _b : 0; + message.util2 = (_c = object.util2) !== null && _c !== void 0 ? _c : 0; + message.util3 = (_d = object.util3) !== null && _d !== void 0 ? _d : 0; + message.util4 = (_e = object.util4) !== null && _e !== void 0 ? _e : 0; + message.util5 = (_f = object.util5) !== null && _f !== void 0 ? _f : 0; + return message; + } +}; // If you get a compile-error about 'Constructor and ... have no overlap', // add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. if (minimal_1.util.Long !== Long) { @@ -23489,7 +23727,7 @@ if (minimal_1.util.Long !== Long) { (0, minimal_1.configure)(); } -},{"./cstrike15_gcmessages":24,"./netmessages":27,"long":682,"protobufjs/minimal":685}],26:[function(require,module,exports){ +},{"./cstrike15_gcmessages":24,"./netmessages":27,"long":712,"protobufjs/minimal":715}],26:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CEngineGotvSyncPacket = exports.protobufPackage = void 0; @@ -23615,7 +23853,7 @@ if (minimal_1.util.Long !== Long) { (0, minimal_1.configure)(); } -},{"long":682,"protobufjs/minimal":685}],27:[function(require,module,exports){ +},{"long":712,"protobufjs/minimal":715}],27:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CSVCMsgGetCvarValue = exports.CSVCMsgSplitScreen = exports.CSVCMsgBSPDecal = exports.CSVCMsgPrefetch = exports.CSVCMsgCrosshairAngle = exports.CSVCMsgFixAngle = exports.CSVCMsgVoiceData = exports.CSVCMsgVoiceInit = exports.CSVCMsgUpdateStringTable = exports.CSVCMsgCreateStringTable = exports.CSVCMsgSetView = exports.CSVCMsgSetPause = exports.CSVCMsgPrint = exports.CSVCMsgSendTable_sendpropT = exports.CSVCMsgSendTable = exports.CSVCMsgClassInfo_classT = exports.CSVCMsgClassInfo = exports.CSVCMsgServerInfo = exports.CCLCMsgCmdKeyValues = exports.CCLCMsgSplitPlayerConnect = exports.CCLCMsgLoadingProgress = exports.CCLCMsgFileCRCCheck = exports.CCLCMsgRespondCvarValue = exports.CCLCMsgListenEvents = exports.CCLCMsgBaselineAck = exports.CCLCMsgVoiceData = exports.CCLCMsgMove = exports.CCLCMsgClientInfo = exports.CNETMsgPlayerAvatarData = exports.CNETMsgSplitScreenUser = exports.CNETMsgFile = exports.CNETMsgDisconnect = exports.CNETMsgNOP = exports.CNETMsgSetConVar = exports.CMsgCVars_CVar = exports.CMsgCVars = exports.CNETMsgSignonState = exports.CNETMsgStringCmd = exports.CNETMsgTick = exports.CMsgRGBA = exports.CMsgQAngle = exports.CMsgVector2D = exports.CMsgVector = exports.ReplayEventTypeT = exports.SVCMessages = exports.ESplitScreenMessageType = exports.VoiceDataFormatT = exports.CLCMessages = exports.NETMessages = exports.protobufPackage = void 0; @@ -27144,7 +27382,7 @@ if (minimal_1.util.Long !== Long) { (0, minimal_1.configure)(); } -},{"long":682,"protobufjs/minimal":685}],28:[function(require,module,exports){ +},{"long":712,"protobufjs/minimal":715}],28:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.decodeShareCode = void 0; @@ -27390,7 +27628,7 @@ exports.StringTables = StringTables; }).call(this)}).call(this,require("buffer").Buffer) -},{"./assert-exists":2,"./consts":3,"./ext/bitbuffer":18,"assert":73,"buffer":80,"bytebuffer":81,"events":82,"long":682}],30:[function(require,module,exports){ +},{"./assert-exists":2,"./consts":3,"./ext/bitbuffer":18,"assert":73,"buffer":81,"bytebuffer":83,"events":84,"long":712}],30:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const assert = require("assert"); @@ -27635,7 +27873,7 @@ class UserMessages extends events_1.EventEmitter { } exports.UserMessages = UserMessages; -},{"./usermessagetypes":34,"assert":73,"events":82}],34:[function(require,module,exports){ +},{"./usermessagetypes":34,"assert":73,"events":84}],34:[function(require,module,exports){ "use strict"; // DO NOT MODIFY! // Auto-generated by ./generators/usermessagetypes.ts @@ -27931,6 +28169,10 @@ exports.userMessages[um.ECstrike15UserMessages.CS_UM_DeepStats] = { name: "DeepStats", class: um.CCSUsrMsgDeepStats }; +exports.userMessages[um.ECstrike15UserMessages.CS_UM_UtilMsg] = { + name: "UtilMsg", + class: um.CCSUsrMsgUtilMsg +}; },{"./protobufs/cstrike15_usermessages":25}],35:[function(require,module,exports){ var AwaitValue = require("./AwaitValue.js"); @@ -28521,7 +28763,7 @@ module.exports = _wrapAsyncGenerator, module.exports.__esModule = true, module.e },{"./AsyncGenerator.js":35}],65:[function(require,module,exports){ module.exports = require("regenerator-runtime"); -},{"regenerator-runtime":696}],66:[function(require,module,exports){ +},{"regenerator-runtime":730}],66:[function(require,module,exports){ "use strict"; module.exports = asPromise; @@ -29818,7 +30060,7 @@ var objectKeys = Object.keys || function (obj) { }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"object-assign":683,"util/":76}],74:[function(require,module,exports){ +},{"object-assign":713,"util/":76}],74:[function(require,module,exports){ if (typeof Object.create === 'function') { // implementation from standard node.js 'util' module module.exports = function inherits(ctor, superCtor) { @@ -30441,7 +30683,7 @@ function hasOwnProperty(obj, prop) { }).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./support/isBuffer":75,"_process":684,"inherits":74}],77:[function(require,module,exports){ +},{"./support/isBuffer":75,"_process":714,"inherits":74}],77:[function(require,module,exports){ 'use strict' exports.byteLength = byteLength @@ -32378,7 +32620,9 @@ else if (typeof module !== 'undefined' && module.exports) { }(this)); }).call(this)}).call(this,require("buffer").Buffer) -},{"buffer":80}],80:[function(require,module,exports){ +},{"buffer":81}],80:[function(require,module,exports){ + +},{}],81:[function(require,module,exports){ (function (Buffer){(function (){ /*! * The buffer module from node.js, for the browser. @@ -34160,7 +34404,73 @@ function numberIsNaN (obj) { }).call(this)}).call(this,require("buffer").Buffer) -},{"base64-js":77,"buffer":80,"ieee754":83}],81:[function(require,module,exports){ +},{"base64-js":77,"buffer":81,"ieee754":86}],82:[function(require,module,exports){ +module.exports = { + "100": "Continue", + "101": "Switching Protocols", + "102": "Processing", + "200": "OK", + "201": "Created", + "202": "Accepted", + "203": "Non-Authoritative Information", + "204": "No Content", + "205": "Reset Content", + "206": "Partial Content", + "207": "Multi-Status", + "208": "Already Reported", + "226": "IM Used", + "300": "Multiple Choices", + "301": "Moved Permanently", + "302": "Found", + "303": "See Other", + "304": "Not Modified", + "305": "Use Proxy", + "307": "Temporary Redirect", + "308": "Permanent Redirect", + "400": "Bad Request", + "401": "Unauthorized", + "402": "Payment Required", + "403": "Forbidden", + "404": "Not Found", + "405": "Method Not Allowed", + "406": "Not Acceptable", + "407": "Proxy Authentication Required", + "408": "Request Timeout", + "409": "Conflict", + "410": "Gone", + "411": "Length Required", + "412": "Precondition Failed", + "413": "Payload Too Large", + "414": "URI Too Long", + "415": "Unsupported Media Type", + "416": "Range Not Satisfiable", + "417": "Expectation Failed", + "418": "I'm a teapot", + "421": "Misdirected Request", + "422": "Unprocessable Entity", + "423": "Locked", + "424": "Failed Dependency", + "425": "Unordered Collection", + "426": "Upgrade Required", + "428": "Precondition Required", + "429": "Too Many Requests", + "431": "Request Header Fields Too Large", + "451": "Unavailable For Legal Reasons", + "500": "Internal Server Error", + "501": "Not Implemented", + "502": "Bad Gateway", + "503": "Service Unavailable", + "504": "Gateway Timeout", + "505": "HTTP Version Not Supported", + "506": "Variant Also Negotiates", + "507": "Insufficient Storage", + "508": "Loop Detected", + "509": "Bandwidth Limit Exceeded", + "510": "Not Extended", + "511": "Network Authentication Required" +} + +},{}],83:[function(require,module,exports){ /* Copyright 2013-2014 Daniel Wirtz @@ -37908,7 +38218,7 @@ function numberIsNaN (obj) { return ByteBuffer; }); -},{"long":682}],82:[function(require,module,exports){ +},{"long":712}],84:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -38433,7 +38743,40 @@ function functionBindPolyfill(context) { }; } -},{}],83:[function(require,module,exports){ +},{}],85:[function(require,module,exports){ +var http = require('http') +var url = require('url') + +var https = module.exports + +for (var key in http) { + if (http.hasOwnProperty(key)) https[key] = http[key] +} + +https.request = function (params, cb) { + params = validateParams(params) + return http.request.call(this, params, cb) +} + +https.get = function (params, cb) { + params = validateParams(params) + return http.get.call(this, params, cb) +} + +function validateParams (params) { + if (typeof params === 'string') { + params = url.parse(params) + } + if (!params.protocol) { + params.protocol = 'https:' + } + if (params.protocol !== 'https:') { + throw new Error('Protocol "' + params.protocol + '" not supported. Expected "https:"') + } + return params +} + +},{"http":732,"url":753}],86:[function(require,module,exports){ /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */ exports.read = function (buffer, offset, isLE, mLen, nBytes) { var e, m @@ -38520,7 +38863,7 @@ exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { buffer[offset + i - d] |= s * 128 } -},{}],84:[function(require,module,exports){ +},{}],87:[function(require,module,exports){ /** * MIT License * @@ -38833,7 +39176,7 @@ exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { var Seq = /*@__PURE__*/(function (Collection) { function Seq(value) { - return value === null || value === undefined + return value === undefined || value === null ? emptySequence() : isImmutable(value) ? value.toSeq() @@ -38901,7 +39244,7 @@ exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { var KeyedSeq = /*@__PURE__*/(function (Seq) { function KeyedSeq(value) { - return value === null || value === undefined + return value === undefined || value === null ? emptySequence().toKeyedSeq() : isCollection(value) ? isKeyed(value) @@ -38925,7 +39268,7 @@ exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { var IndexedSeq = /*@__PURE__*/(function (Seq) { function IndexedSeq(value) { - return value === null || value === undefined + return value === undefined || value === null ? emptySequence() : isCollection(value) ? isKeyed(value) @@ -39031,7 +39374,9 @@ exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { var ObjectSeq = /*@__PURE__*/(function (KeyedSeq) { function ObjectSeq(object) { - var keys = Object.keys(object); + var keys = Object.keys(object).concat( + Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(object) : [] + ); this._object = object; this._keys = keys; this.size = keys.length; @@ -40891,7 +41236,7 @@ exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { var Map = /*@__PURE__*/(function (KeyedCollection) { function Map(value) { - return value === null || value === undefined + return value === undefined || value === null ? emptyMap() : isMap(value) && !isOrdered(value) ? value @@ -41682,7 +42027,7 @@ exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { var List = /*@__PURE__*/(function (IndexedCollection) { function List(value) { var empty = emptyList(); - if (value === null || value === undefined) { + if (value === undefined || value === null) { return empty; } if (isList(value)) { @@ -42332,7 +42677,7 @@ exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { var OrderedMap = /*@__PURE__*/(function (Map) { function OrderedMap(value) { - return value === null || value === undefined + return value === undefined || value === null ? emptyOrderedMap() : isOrderedMap(value) ? value @@ -42500,7 +42845,7 @@ exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { var Stack = /*@__PURE__*/(function (IndexedCollection) { function Stack(value) { - return value === null || value === undefined + return value === undefined || value === null ? emptyStack() : isStack(value) ? value @@ -42834,7 +43179,7 @@ exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { var Set = /*@__PURE__*/(function (SetCollection) { function Set(value) { - return value === null || value === undefined + return value === undefined || value === null ? emptySet() : isSet(value) && !isOrdered(value) ? value @@ -43955,7 +44300,7 @@ exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { var OrderedSet = /*@__PURE__*/(function (Set) { function OrderedSet(value) { - return value === null || value === undefined + return value === undefined || value === null ? emptyOrderedSet() : isOrderedSet(value) ? value @@ -44109,7 +44454,8 @@ exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { Record.prototype.equals = function equals (other) { return ( - this === other || (other && recordSeq(this).equals(recordSeq(other))) + this === other || + (isRecord(other) && recordSeq(this).equals(recordSeq(other))) ); }; @@ -44392,7 +44738,7 @@ exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { return isIndexed(v) ? v.toList() : isKeyed(v) ? v.toMap() : v.toSet(); } - var version = "4.0.0"; + var version = "4.1.0"; var Immutable = { version: version, @@ -44505,329 +44851,370 @@ exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { }))); -},{}],85:[function(require,module,exports){ +},{}],88:[function(require,module,exports){ +if (typeof Object.create === 'function') { + // implementation from standard node.js 'util' module + module.exports = function inherits(ctor, superCtor) { + if (superCtor) { + ctor.super_ = superCtor + ctor.prototype = Object.create(superCtor.prototype, { + constructor: { + value: ctor, + enumerable: false, + writable: true, + configurable: true + } + }) + } + }; +} else { + // old school shim for old browsers + module.exports = function inherits(ctor, superCtor) { + if (superCtor) { + ctor.super_ = superCtor + var TempCtor = function () {} + TempCtor.prototype = superCtor.prototype + ctor.prototype = new TempCtor() + ctor.prototype.constructor = ctor + } + } +} + +},{}],89:[function(require,module,exports){ module.exports = require('../impls/$append/append.js').__append; -},{"../impls/$append/append.js":246}],86:[function(require,module,exports){ +},{"../impls/$append/append.js":256}],90:[function(require,module,exports){ module.exports = require('../impls/apply/apply.js').__apply; -},{"../impls/apply/apply.js":398}],87:[function(require,module,exports){ +},{"../impls/apply/apply.js":414}],91:[function(require,module,exports){ module.exports = require('../impls/array-reverse/array-reverse.js').__arrayReverse; -},{"../impls/array-reverse/array-reverse.js":405}],88:[function(require,module,exports){ +},{"../impls/array-reverse/array-reverse.js":421}],92:[function(require,module,exports){ module.exports = require('../impls/$append/async-append.js').__asyncAppend; -},{"../impls/$append/async-append.js":247}],89:[function(require,module,exports){ +},{"../impls/$append/async-append.js":257}],93:[function(require,module,exports){ module.exports = require('../impls/$batch/async-batch.js').__asyncBatch; -},{"../impls/$batch/async-batch.js":248}],90:[function(require,module,exports){ +},{"../impls/$batch/async-batch.js":258}],94:[function(require,module,exports){ module.exports = require('../impls/$bisect/async-bisect.js').__asyncBisect; -},{"../impls/$bisect/async-bisect.js":250}],91:[function(require,module,exports){ +},{"../impls/$bisect/async-bisect.js":260}],95:[function(require,module,exports){ module.exports = require('../impls/async-buffer/async-buffer.js').__asyncBuffer; -},{"../impls/async-buffer/async-buffer.js":406}],92:[function(require,module,exports){ +},{"../impls/async-buffer/async-buffer.js":422}],96:[function(require,module,exports){ module.exports = require('../impls/$collate/async-collate.js').__asyncCollate; -},{"../impls/$collate/async-collate.js":252}],93:[function(require,module,exports){ +},{"../impls/$collate/async-collate.js":262}],97:[function(require,module,exports){ module.exports = require('../impls/$compress/async-compress.js').__asyncCompress; -},{"../impls/$compress/async-compress.js":254}],94:[function(require,module,exports){ +},{"../impls/$compress/async-compress.js":264}],98:[function(require,module,exports){ module.exports = require('../impls/$concat/async-concat.js').__asyncConcat; -},{"../impls/$concat/async-concat.js":256}],95:[function(require,module,exports){ +},{"../impls/$concat/async-concat.js":266}],99:[function(require,module,exports){ module.exports = require('../impls/$consume/async-consume.js').__asyncConsume; -},{"../impls/$consume/async-consume.js":258}],96:[function(require,module,exports){ +},{"../impls/$consume/async-consume.js":268}],100:[function(require,module,exports){ module.exports = require('../impls/$cycle-times/async-cycle-times.js').__asyncCycleTimes; -},{"../impls/$cycle-times/async-cycle-times.js":260}],97:[function(require,module,exports){ +},{"../impls/$cycle-times/async-cycle-times.js":270}],101:[function(require,module,exports){ module.exports = require('../impls/$cycle/async-cycle.js').__asyncCycle; -},{"../impls/$cycle/async-cycle.js":262}],98:[function(require,module,exports){ +},{"../impls/$cycle/async-cycle.js":272}],102:[function(require,module,exports){ module.exports = require('../impls/$deep-equal/async-deep-equal.js').__asyncDeepEqual; -},{"../impls/$deep-equal/async-deep-equal.js":264}],99:[function(require,module,exports){ +},{"../impls/$deep-equal/async-deep-equal.js":274}],103:[function(require,module,exports){ +module.exports = require('../impls/$distinct/async-distinct.js').__asyncDistinct; +},{"../impls/$distinct/async-distinct.js":276}],104:[function(require,module,exports){ module.exports = require('../impls/$drop-while/async-drop-while.js').__asyncDropWhile; -},{"../impls/$drop-while/async-drop-while.js":266}],100:[function(require,module,exports){ +},{"../impls/$drop-while/async-drop-while.js":278}],105:[function(require,module,exports){ module.exports = require('../impls/$drop/async-drop.js').__asyncDrop; -},{"../impls/$drop/async-drop.js":268}],101:[function(require,module,exports){ +},{"../impls/$drop/async-drop.js":280}],106:[function(require,module,exports){ module.exports = require('../impls/$enumerate/async-enumerate.js').__asyncEnumerate; -},{"../impls/$enumerate/async-enumerate.js":270}],102:[function(require,module,exports){ +},{"../impls/$enumerate/async-enumerate.js":282}],107:[function(require,module,exports){ module.exports = require('../impls/$equal/async-equal.js').__asyncEqual; -},{"../impls/$equal/async-equal.js":272}],103:[function(require,module,exports){ +},{"../impls/$equal/async-equal.js":284}],108:[function(require,module,exports){ module.exports = require('../impls/$every/async-every.js').__asyncEvery; -},{"../impls/$every/async-every.js":274}],104:[function(require,module,exports){ +},{"../impls/$every/async-every.js":286}],109:[function(require,module,exports){ module.exports = require('../impls/$filter/async-filter.js').__asyncFilter; -},{"../impls/$filter/async-filter.js":276}],105:[function(require,module,exports){ +},{"../impls/$filter/async-filter.js":288}],110:[function(require,module,exports){ +module.exports = require('../impls/$find-best-or/async-find-best-or.js').__asyncFindBestOr; +},{"../impls/$find-best-or/async-find-best-or.js":290}],111:[function(require,module,exports){ +module.exports = require('../impls/$find-best/async-find-best.js').__asyncFindBest; +},{"../impls/$find-best/async-find-best.js":292}],112:[function(require,module,exports){ module.exports = require('../impls/$find-or/async-find-or.js').__asyncFindOr; -},{"../impls/$find-or/async-find-or.js":278}],106:[function(require,module,exports){ +},{"../impls/$find-or/async-find-or.js":294}],113:[function(require,module,exports){ module.exports = require('../impls/$find/async-find.js').__asyncFind; -},{"../impls/$find/async-find.js":280}],107:[function(require,module,exports){ +},{"../impls/$find/async-find.js":296}],114:[function(require,module,exports){ module.exports = require('../impls/$first-or/async-first-or.js').__asyncFirstOr; -},{"../impls/$first-or/async-first-or.js":282}],108:[function(require,module,exports){ +},{"../impls/$first-or/async-first-or.js":298}],115:[function(require,module,exports){ module.exports = require('../impls/$first/async-first.js').__asyncFirst; -},{"../impls/$first/async-first.js":284}],109:[function(require,module,exports){ +},{"../impls/$first/async-first.js":300}],116:[function(require,module,exports){ module.exports = require('../impls/$flat-map/async-flat-map.js').__asyncFlatMap; -},{"../impls/$flat-map/async-flat-map.js":286}],110:[function(require,module,exports){ +},{"../impls/$flat-map/async-flat-map.js":302}],117:[function(require,module,exports){ module.exports = require('../impls/$flat/async-flat.js').__asyncFlat; -},{"../impls/$flat/async-flat.js":288}],111:[function(require,module,exports){ +},{"../impls/$flat/async-flat.js":304}],118:[function(require,module,exports){ module.exports = require('../impls/$for-each/async-for-each.js').__asyncForEach; -},{"../impls/$for-each/async-for-each.js":291}],112:[function(require,module,exports){ +},{"../impls/$for-each/async-for-each.js":307}],119:[function(require,module,exports){ module.exports = require('../impls/$fork/async-fork.js').__asyncFork; -},{"../impls/$fork/async-fork.js":293}],113:[function(require,module,exports){ +},{"../impls/$fork/async-fork.js":309}],120:[function(require,module,exports){ module.exports = require('../impls/$forkerate/async-forkerate.js').__asyncForkerate; -},{"../impls/$forkerate/async-forkerate.js":295}],114:[function(require,module,exports){ +},{"../impls/$forkerate/async-forkerate.js":311}],121:[function(require,module,exports){ module.exports = require('../impls/$includes-any-seq/async-includes-any-seq.js').__asyncIncludesAnySeq; -},{"../impls/$includes-any-seq/async-includes-any-seq.js":297}],115:[function(require,module,exports){ +},{"../impls/$includes-any-seq/async-includes-any-seq.js":313}],122:[function(require,module,exports){ module.exports = require('../impls/$includes-any/async-includes-any.js').__asyncIncludesAny; -},{"../impls/$includes-any/async-includes-any.js":299}],116:[function(require,module,exports){ +},{"../impls/$includes-any/async-includes-any.js":315}],123:[function(require,module,exports){ module.exports = require('../impls/$includes-seq/async-includes-seq.js').__asyncIncludesSeq; -},{"../impls/$includes-seq/async-includes-seq.js":301}],117:[function(require,module,exports){ +},{"../impls/$includes-seq/async-includes-seq.js":317}],124:[function(require,module,exports){ module.exports = require('../impls/$includes/async-includes.js').__asyncIncludes; -},{"../impls/$includes/async-includes.js":303}],118:[function(require,module,exports){ +},{"../impls/$includes/async-includes.js":319}],125:[function(require,module,exports){ module.exports = require('../impls/async-interleave-ready/async-interleave-ready.js').__asyncInterleaveReady; -},{"../impls/async-interleave-ready/async-interleave-ready.js":407}],119:[function(require,module,exports){ +},{"../impls/async-interleave-ready/async-interleave-ready.js":423}],126:[function(require,module,exports){ module.exports = require('../impls/$interleave/async-interleave.js').__asyncInterleave; -},{"../impls/$interleave/async-interleave.js":305}],120:[function(require,module,exports){ +},{"../impls/$interleave/async-interleave.js":321}],127:[function(require,module,exports){ module.exports = require('../impls/$interpose-seq/async-interpose-seq.js').__asyncInterposeSeq; -},{"../impls/$interpose-seq/async-interpose-seq.js":307}],121:[function(require,module,exports){ +},{"../impls/$interpose-seq/async-interpose-seq.js":323}],128:[function(require,module,exports){ module.exports = require('../impls/$interpose/async-interpose.js').__asyncInterpose; -},{"../impls/$interpose/async-interpose.js":309}],122:[function(require,module,exports){ +},{"../impls/$interpose/async-interpose.js":325}],129:[function(require,module,exports){ module.exports = require('../impls/$is-empty/async-is-empty.js').__asyncIsEmpty; -},{"../impls/$is-empty/async-is-empty.js":311}],123:[function(require,module,exports){ +},{"../impls/$is-empty/async-is-empty.js":327}],130:[function(require,module,exports){ module.exports = require('../impls/$is-sorted/async-is-sorted.js').__asyncIsSorted; -},{"../impls/$is-sorted/async-is-sorted.js":313}],124:[function(require,module,exports){ +},{"../impls/$is-sorted/async-is-sorted.js":329}],131:[function(require,module,exports){ module.exports = require('../impls/$join-with-seq/async-join-with-seq.js').__asyncJoinWithSeq; -},{"../impls/$join-with-seq/async-join-with-seq.js":315}],125:[function(require,module,exports){ +},{"../impls/$join-with-seq/async-join-with-seq.js":331}],132:[function(require,module,exports){ module.exports = require('../impls/$join-with/async-join-with.js').__asyncJoinWith; -},{"../impls/$join-with/async-join-with.js":317}],126:[function(require,module,exports){ +},{"../impls/$join-with/async-join-with.js":333}],133:[function(require,module,exports){ module.exports = require('../impls/$join/async-join.js').__asyncJoin; -},{"../impls/$join/async-join.js":319}],127:[function(require,module,exports){ +},{"../impls/$join/async-join.js":335}],134:[function(require,module,exports){ module.exports = require('../impls/$map/async-map.js').__asyncMap; -},{"../impls/$map/async-map.js":321}],128:[function(require,module,exports){ +},{"../impls/$map/async-map.js":337}],135:[function(require,module,exports){ module.exports = require('../impls/$peekerate/async-peekerate.js').__asyncPeekerate; -},{"../impls/$peekerate/async-peekerate.js":323}],129:[function(require,module,exports){ +},{"../impls/$peekerate/async-peekerate.js":339}],136:[function(require,module,exports){ module.exports = require('../impls/$prepend/async-prepend.js').__asyncPrepend; -},{"../impls/$prepend/async-prepend.js":325}],130:[function(require,module,exports){ +},{"../impls/$prepend/async-prepend.js":341}],137:[function(require,module,exports){ module.exports = require('../impls/$reduce/async-reduce.js').__asyncReduce; -},{"../impls/$reduce/async-reduce.js":327}],131:[function(require,module,exports){ +},{"../impls/$reduce/async-reduce.js":343}],138:[function(require,module,exports){ module.exports = require('../impls/$reverse/async-reverse.js').__asyncReverse; -},{"../impls/$reverse/async-reverse.js":329}],132:[function(require,module,exports){ +},{"../impls/$reverse/async-reverse.js":345}],139:[function(require,module,exports){ module.exports = require('../impls/$round-robin/async-round-robin.js').__asyncRoundRobin; -},{"../impls/$round-robin/async-round-robin.js":331}],133:[function(require,module,exports){ +},{"../impls/$round-robin/async-round-robin.js":347}],140:[function(require,module,exports){ module.exports = require('../impls/$size/async-size.js').__asyncSize; -},{"../impls/$size/async-size.js":334}],134:[function(require,module,exports){ +},{"../impls/$size/async-size.js":350}],141:[function(require,module,exports){ module.exports = require('../impls/$slice/async-slice.js').__asyncSliceFromStart; -},{"../impls/$slice/async-slice.js":336}],135:[function(require,module,exports){ +},{"../impls/$slice/async-slice.js":352}],142:[function(require,module,exports){ module.exports = require('../impls/$some/async-some.js').__asyncSome; -},{"../impls/$some/async-some.js":339}],136:[function(require,module,exports){ +},{"../impls/$some/async-some.js":355}],143:[function(require,module,exports){ module.exports = require('../impls/$split-groups/async-split-groups.js').__asyncSplitGroups; -},{"../impls/$split-groups/async-split-groups.js":341}],137:[function(require,module,exports){ +},{"../impls/$split-groups/async-split-groups.js":357}],144:[function(require,module,exports){ module.exports = require('../impls/$split-on-any-seq/async-split-on-any-seq.js').__asyncSplitOnAnySeq; -},{"../impls/$split-on-any-seq/async-split-on-any-seq.js":343}],138:[function(require,module,exports){ +},{"../impls/$split-on-any-seq/async-split-on-any-seq.js":359}],145:[function(require,module,exports){ module.exports = require('../impls/$split-on-any/async-split-on-any.js').__asyncSplitOnAny; -},{"../impls/$split-on-any/async-split-on-any.js":345}],139:[function(require,module,exports){ +},{"../impls/$split-on-any/async-split-on-any.js":361}],146:[function(require,module,exports){ module.exports = require('../impls/$split-on-seq/async-split-on-seq.js').__asyncSplitOnSeq; -},{"../impls/$split-on-seq/async-split-on-seq.js":347}],140:[function(require,module,exports){ +},{"../impls/$split-on-seq/async-split-on-seq.js":363}],147:[function(require,module,exports){ module.exports = require('../impls/$split-on/async-split-on.js').__asyncSplitOn; -},{"../impls/$split-on/async-split-on.js":349}],141:[function(require,module,exports){ +},{"../impls/$split-on/async-split-on.js":365}],148:[function(require,module,exports){ module.exports = require('../impls/$split-when/async-split-when.js').__asyncSplitWhen; -},{"../impls/$split-when/async-split-when.js":351}],142:[function(require,module,exports){ +},{"../impls/$split-when/async-split-when.js":367}],149:[function(require,module,exports){ module.exports = require('../impls/$split/async-split.js').__asyncSplit; -},{"../impls/$split/async-split.js":353}],143:[function(require,module,exports){ +},{"../impls/$split/async-split.js":369}],150:[function(require,module,exports){ module.exports = require('../impls/$spliterate-grouped/async-spliterate-grouped.js').__asyncSpliterateGrouped; -},{"../impls/$spliterate-grouped/async-spliterate-grouped.js":355}],144:[function(require,module,exports){ +},{"../impls/$spliterate-grouped/async-spliterate-grouped.js":371}],151:[function(require,module,exports){ module.exports = require('../impls/$spliterate/async-spliterate.js').__asyncSpliterate; -},{"../impls/$spliterate/async-spliterate.js":357}],145:[function(require,module,exports){ +},{"../impls/$spliterate/async-spliterate.js":373}],152:[function(require,module,exports){ module.exports = require('../impls/$starts-with-any-seq/async-starts-with-any-seq.js').__asyncStartsWithAnySeq; -},{"../impls/$starts-with-any-seq/async-starts-with-any-seq.js":359}],146:[function(require,module,exports){ +},{"../impls/$starts-with-any-seq/async-starts-with-any-seq.js":375}],153:[function(require,module,exports){ module.exports = require('../impls/$starts-with-any/async-starts-with-any.js').__asyncStartsWithAny; -},{"../impls/$starts-with-any/async-starts-with-any.js":361}],147:[function(require,module,exports){ +},{"../impls/$starts-with-any/async-starts-with-any.js":377}],154:[function(require,module,exports){ module.exports = require('../impls/$starts-with-seq/async-starts-with-seq.js').__asyncStartsWithSeq; -},{"../impls/$starts-with-seq/async-starts-with-seq.js":363}],148:[function(require,module,exports){ +},{"../impls/$starts-with-seq/async-starts-with-seq.js":379}],155:[function(require,module,exports){ module.exports = require('../impls/$starts-with/async-starts-with.js').__asyncStartsWith; -},{"../impls/$starts-with/async-starts-with.js":365}],149:[function(require,module,exports){ +},{"../impls/$starts-with/async-starts-with.js":381}],156:[function(require,module,exports){ module.exports = require('../impls/$str/async-str.js').__asyncStr; -},{"../impls/$str/async-str.js":367}],150:[function(require,module,exports){ +},{"../impls/$str/async-str.js":383}],157:[function(require,module,exports){ module.exports = require('../impls/$take-last-or/async-take-last-or.js').__asyncTakeLastOr; -},{"../impls/$take-last-or/async-take-last-or.js":369}],151:[function(require,module,exports){ +},{"../impls/$take-last-or/async-take-last-or.js":385}],158:[function(require,module,exports){ module.exports = require('../impls/$take-last/async-take-last.js').__asyncTakeLast; -},{"../impls/$take-last/async-take-last.js":371}],152:[function(require,module,exports){ +},{"../impls/$take-last/async-take-last.js":387}],159:[function(require,module,exports){ module.exports = require('../impls/$take-sorted/async-take-sorted.js').__asyncTakeSorted; -},{"../impls/$take-sorted/async-take-sorted.js":373}],153:[function(require,module,exports){ +},{"../impls/$take-sorted/async-take-sorted.js":389}],160:[function(require,module,exports){ module.exports = require('../impls/$take-while/async-take-while.js').__asyncTakeWhile; -},{"../impls/$take-while/async-take-while.js":376}],154:[function(require,module,exports){ +},{"../impls/$take-while/async-take-while.js":392}],161:[function(require,module,exports){ module.exports = require('../impls/$take/async-take.js').__asyncTake; -},{"../impls/$take/async-take.js":378}],155:[function(require,module,exports){ +},{"../impls/$take/async-take.js":394}],162:[function(require,module,exports){ module.exports = require('../impls/$tap/async-tap.js').__asyncTap; -},{"../impls/$tap/async-tap.js":380}],156:[function(require,module,exports){ +},{"../impls/$tap/async-tap.js":396}],163:[function(require,module,exports){ module.exports = require('../impls/async-throttle/async-throttle.js').__asyncThrottle; -},{"../impls/async-throttle/async-throttle.js":409}],157:[function(require,module,exports){ +},{"../impls/async-throttle/async-throttle.js":425}],164:[function(require,module,exports){ module.exports = require('../impls/$to-array/async-to-array.js').__asyncToArray; -},{"../impls/$to-array/async-to-array.js":382}],158:[function(require,module,exports){ +},{"../impls/$to-array/async-to-array.js":398}],165:[function(require,module,exports){ module.exports = require('../impls/$to-object/async-to-object.js').__asyncToObject; -},{"../impls/$to-object/async-to-object.js":384}],159:[function(require,module,exports){ +},{"../impls/$to-object/async-to-object.js":400}],166:[function(require,module,exports){ module.exports = require('../impls/$window-ahead/async-window-ahead.js').__asyncWindowAhead; -},{"../impls/$window-ahead/async-window-ahead.js":386}],160:[function(require,module,exports){ +},{"../impls/$window-ahead/async-window-ahead.js":402}],167:[function(require,module,exports){ module.exports = require('../impls/$window-behind/async-window-behind.js').__asyncWindowBehind; -},{"../impls/$window-behind/async-window-behind.js":388}],161:[function(require,module,exports){ +},{"../impls/$window-behind/async-window-behind.js":404}],168:[function(require,module,exports){ module.exports = require('../impls/$window/async-window.js').__asyncWindow; -},{"../impls/$window/async-window.js":390}],162:[function(require,module,exports){ +},{"../impls/$window/async-window.js":406}],169:[function(require,module,exports){ module.exports = require('../impls/$zip-all/async-zip-all.js').__asyncZipAll; -},{"../impls/$zip-all/async-zip-all.js":394}],163:[function(require,module,exports){ +},{"../impls/$zip-all/async-zip-all.js":410}],170:[function(require,module,exports){ module.exports = require('../impls/$zip/async-zip.js').__asyncZip; -},{"../impls/$zip/async-zip.js":396}],164:[function(require,module,exports){ +},{"../impls/$zip/async-zip.js":412}],171:[function(require,module,exports){ module.exports = require('../impls/$batch/batch.js').__batch; -},{"../impls/$batch/batch.js":249}],165:[function(require,module,exports){ +},{"../impls/$batch/batch.js":259}],172:[function(require,module,exports){ module.exports = require('../impls/$bisect/bisect.js').__bisect; -},{"../impls/$bisect/bisect.js":251}],166:[function(require,module,exports){ +},{"../impls/$bisect/bisect.js":261}],173:[function(require,module,exports){ module.exports = require('../impls/call/call.js').__call; -},{"../impls/call/call.js":410}],167:[function(require,module,exports){ +},{"../impls/call/call.js":426}],174:[function(require,module,exports){ module.exports = require('../impls/$collate/collate.js').__collate; -},{"../impls/$collate/collate.js":253}],168:[function(require,module,exports){ +},{"../impls/$collate/collate.js":263}],175:[function(require,module,exports){ module.exports = require('../impls/$compress/compress.js').__compress; -},{"../impls/$compress/compress.js":255}],169:[function(require,module,exports){ +},{"../impls/$compress/compress.js":265}],176:[function(require,module,exports){ module.exports = require('../impls/$concat/concat.js').__concat; -},{"../impls/$concat/concat.js":257}],170:[function(require,module,exports){ +},{"../impls/$concat/concat.js":267}],177:[function(require,module,exports){ module.exports = require('../impls/$consume/consume.js').__consume; -},{"../impls/$consume/consume.js":259}],171:[function(require,module,exports){ +},{"../impls/$consume/consume.js":269}],178:[function(require,module,exports){ module.exports = require('../impls/$cycle-times/cycle-times.js').__cycleTimes; -},{"../impls/$cycle-times/cycle-times.js":261}],172:[function(require,module,exports){ +},{"../impls/$cycle-times/cycle-times.js":271}],179:[function(require,module,exports){ module.exports = require('../impls/$cycle/cycle.js').__cycle; -},{"../impls/$cycle/cycle.js":263}],173:[function(require,module,exports){ +},{"../impls/$cycle/cycle.js":273}],180:[function(require,module,exports){ module.exports = require('../impls/$deep-equal/deep-equal.js').__deepEqual; -},{"../impls/$deep-equal/deep-equal.js":265}],174:[function(require,module,exports){ +},{"../impls/$deep-equal/deep-equal.js":275}],181:[function(require,module,exports){ +module.exports = require('../impls/$distinct/distinct.js').__distinct; +},{"../impls/$distinct/distinct.js":277}],182:[function(require,module,exports){ module.exports = require('../impls/$drop-while/drop-while.js').__dropWhile; -},{"../impls/$drop-while/drop-while.js":267}],175:[function(require,module,exports){ +},{"../impls/$drop-while/drop-while.js":279}],183:[function(require,module,exports){ module.exports = require('../impls/$drop/drop.js').__drop; -},{"../impls/$drop/drop.js":269}],176:[function(require,module,exports){ +},{"../impls/$drop/drop.js":281}],184:[function(require,module,exports){ module.exports = require('../impls/$enumerate/enumerate.js').__enumerate; -},{"../impls/$enumerate/enumerate.js":271}],177:[function(require,module,exports){ +},{"../impls/$enumerate/enumerate.js":283}],185:[function(require,module,exports){ module.exports = require('../impls/$equal/equal.js').__equal; -},{"../impls/$equal/equal.js":273}],178:[function(require,module,exports){ +},{"../impls/$equal/equal.js":285}],186:[function(require,module,exports){ module.exports = require('../impls/$every/every.js').__every; -},{"../impls/$every/every.js":275}],179:[function(require,module,exports){ +},{"../impls/$every/every.js":287}],187:[function(require,module,exports){ module.exports = require('../impls/$filter/filter.js').__filter; -},{"../impls/$filter/filter.js":277}],180:[function(require,module,exports){ +},{"../impls/$filter/filter.js":289}],188:[function(require,module,exports){ +module.exports = require('../impls/$find-best-or/find-best-or.js').__findBestOr; +},{"../impls/$find-best-or/find-best-or.js":291}],189:[function(require,module,exports){ +module.exports = require('../impls/$find-best/find-best.js').__findBest; +},{"../impls/$find-best/find-best.js":293}],190:[function(require,module,exports){ module.exports = require('../impls/$find-or/find-or.js').__findOr; -},{"../impls/$find-or/find-or.js":279}],181:[function(require,module,exports){ +},{"../impls/$find-or/find-or.js":295}],191:[function(require,module,exports){ module.exports = require('../impls/$find/find.js').__find; -},{"../impls/$find/find.js":281}],182:[function(require,module,exports){ +},{"../impls/$find/find.js":297}],192:[function(require,module,exports){ module.exports = require('../impls/$first-or/first-or.js').__firstOr; -},{"../impls/$first-or/first-or.js":283}],183:[function(require,module,exports){ +},{"../impls/$first-or/first-or.js":299}],193:[function(require,module,exports){ module.exports = require('../impls/$first/first.js').__first; -},{"../impls/$first/first.js":285}],184:[function(require,module,exports){ +},{"../impls/$first/first.js":301}],194:[function(require,module,exports){ module.exports = require('../impls/$flat-map/flat-map.js').__flatMap; -},{"../impls/$flat-map/flat-map.js":287}],185:[function(require,module,exports){ +},{"../impls/$flat-map/flat-map.js":303}],195:[function(require,module,exports){ module.exports = require('../impls/$flat/flat.js').__flat; -},{"../impls/$flat/flat.js":289}],186:[function(require,module,exports){ +},{"../impls/$flat/flat.js":305}],196:[function(require,module,exports){ module.exports = require('../impls/$for-each/for-each.js').__forEach; -},{"../impls/$for-each/for-each.js":292}],187:[function(require,module,exports){ +},{"../impls/$for-each/for-each.js":308}],197:[function(require,module,exports){ module.exports = require('../impls/$fork/fork.js').__fork; -},{"../impls/$fork/fork.js":294}],188:[function(require,module,exports){ +},{"../impls/$fork/fork.js":310}],198:[function(require,module,exports){ module.exports = require('../impls/$forkerate/forkerate.js').__forkerate; -},{"../impls/$forkerate/forkerate.js":296}],189:[function(require,module,exports){ +},{"../impls/$forkerate/forkerate.js":312}],199:[function(require,module,exports){ module.exports = require('../impls/$includes-any-seq/includes-any-seq.js').__includesAnySeq; -},{"../impls/$includes-any-seq/includes-any-seq.js":298}],190:[function(require,module,exports){ +},{"../impls/$includes-any-seq/includes-any-seq.js":314}],200:[function(require,module,exports){ module.exports = require('../impls/$includes-any/includes-any.js').__includesAny; -},{"../impls/$includes-any/includes-any.js":300}],191:[function(require,module,exports){ +},{"../impls/$includes-any/includes-any.js":316}],201:[function(require,module,exports){ module.exports = require('../impls/$includes-seq/includes-seq.js').__includesSeq; -},{"../impls/$includes-seq/includes-seq.js":302}],192:[function(require,module,exports){ +},{"../impls/$includes-seq/includes-seq.js":318}],202:[function(require,module,exports){ module.exports = require('../impls/$includes/includes.js').__includes; -},{"../impls/$includes/includes.js":304}],193:[function(require,module,exports){ +},{"../impls/$includes/includes.js":320}],203:[function(require,module,exports){ module.exports = require('../impls/$interleave/interleave.js').__interleave; -},{"../impls/$interleave/interleave.js":306}],194:[function(require,module,exports){ +},{"../impls/$interleave/interleave.js":322}],204:[function(require,module,exports){ module.exports = require('../impls/$interpose-seq/interpose-seq.js').__interposeSeq; -},{"../impls/$interpose-seq/interpose-seq.js":308}],195:[function(require,module,exports){ +},{"../impls/$interpose-seq/interpose-seq.js":324}],205:[function(require,module,exports){ module.exports = require('../impls/$interpose/interpose.js').__interpose; -},{"../impls/$interpose/interpose.js":310}],196:[function(require,module,exports){ +},{"../impls/$interpose/interpose.js":326}],206:[function(require,module,exports){ module.exports = require('../impls/$is-empty/is-empty.js').__isEmpty; -},{"../impls/$is-empty/is-empty.js":312}],197:[function(require,module,exports){ +},{"../impls/$is-empty/is-empty.js":328}],207:[function(require,module,exports){ module.exports = require('../impls/$is-sorted/is-sorted.js').__isSorted; -},{"../impls/$is-sorted/is-sorted.js":314}],198:[function(require,module,exports){ +},{"../impls/$is-sorted/is-sorted.js":330}],208:[function(require,module,exports){ module.exports = require('../impls/$join-with-seq/join-with-seq.js').__joinWithSeq; -},{"../impls/$join-with-seq/join-with-seq.js":316}],199:[function(require,module,exports){ +},{"../impls/$join-with-seq/join-with-seq.js":332}],209:[function(require,module,exports){ module.exports = require('../impls/$join-with/join-with.js').__joinWith; -},{"../impls/$join-with/join-with.js":318}],200:[function(require,module,exports){ +},{"../impls/$join-with/join-with.js":334}],210:[function(require,module,exports){ module.exports = require('../impls/$join/join.js').__join; -},{"../impls/$join/join.js":320}],201:[function(require,module,exports){ +},{"../impls/$join/join.js":336}],211:[function(require,module,exports){ module.exports = require('../impls/$map/map.js').__map; -},{"../impls/$map/map.js":322}],202:[function(require,module,exports){ +},{"../impls/$map/map.js":338}],212:[function(require,module,exports){ module.exports = require('../impls/object-entries/object-entries.js').__objectEntries; -},{"../impls/object-entries/object-entries.js":438}],203:[function(require,module,exports){ +},{"../impls/object-entries/object-entries.js":458}],213:[function(require,module,exports){ module.exports = require('../impls/object-keys/object-keys.js').__objectKeys; -},{"../impls/object-keys/object-keys.js":441}],204:[function(require,module,exports){ +},{"../impls/object-keys/object-keys.js":461}],214:[function(require,module,exports){ module.exports = require('../impls/object-values/object-values.js').__objectValues; -},{"../impls/object-values/object-values.js":442}],205:[function(require,module,exports){ +},{"../impls/object-values/object-values.js":462}],215:[function(require,module,exports){ module.exports = require('../impls/$peekerate/peekerate.js').__peekerate; -},{"../impls/$peekerate/peekerate.js":324}],206:[function(require,module,exports){ +},{"../impls/$peekerate/peekerate.js":340}],216:[function(require,module,exports){ module.exports = require('../impls/$prepend/prepend.js').__prepend; -},{"../impls/$prepend/prepend.js":326}],207:[function(require,module,exports){ +},{"../impls/$prepend/prepend.js":342}],217:[function(require,module,exports){ module.exports = require('../impls/range/range.js').__range; -},{"../impls/range/range.js":444}],208:[function(require,module,exports){ +},{"../impls/range/range.js":464}],218:[function(require,module,exports){ module.exports = require('../impls/$reduce/reduce.js').__reduce; -},{"../impls/$reduce/reduce.js":328}],209:[function(require,module,exports){ +},{"../impls/$reduce/reduce.js":344}],219:[function(require,module,exports){ module.exports = require('../impls/repeat-times/repeat-times.js').__repeatTimes; -},{"../impls/repeat-times/repeat-times.js":445}],210:[function(require,module,exports){ +},{"../impls/repeat-times/repeat-times.js":465}],220:[function(require,module,exports){ module.exports = require('../impls/repeat/repeat.js').__repeat; -},{"../impls/repeat/repeat.js":446}],211:[function(require,module,exports){ +},{"../impls/repeat/repeat.js":466}],221:[function(require,module,exports){ module.exports = require('../impls/$reverse/reverse.js').__reverse; -},{"../impls/$reverse/reverse.js":330}],212:[function(require,module,exports){ +},{"../impls/$reverse/reverse.js":346}],222:[function(require,module,exports){ module.exports = require('../impls/$round-robin/round-robin.js').__roundRobin; -},{"../impls/$round-robin/round-robin.js":333}],213:[function(require,module,exports){ +},{"../impls/$round-robin/round-robin.js":349}],223:[function(require,module,exports){ module.exports = require('../impls/$size/size.js').__size; -},{"../impls/$size/size.js":335}],214:[function(require,module,exports){ +},{"../impls/$size/size.js":351}],224:[function(require,module,exports){ module.exports = require('../impls/$slice/slice.js').__sliceFromStart; -},{"../impls/$slice/slice.js":338}],215:[function(require,module,exports){ +},{"../impls/$slice/slice.js":354}],225:[function(require,module,exports){ module.exports = require('../impls/$some/some.js').__some; -},{"../impls/$some/some.js":340}],216:[function(require,module,exports){ +},{"../impls/$some/some.js":356}],226:[function(require,module,exports){ module.exports = require('../impls/$split-groups/split-groups.js').__splitGroups; -},{"../impls/$split-groups/split-groups.js":342}],217:[function(require,module,exports){ +},{"../impls/$split-groups/split-groups.js":358}],227:[function(require,module,exports){ module.exports = require('../impls/$split-on-any-seq/split-on-any-seq.js').__splitOnAnySeq; -},{"../impls/$split-on-any-seq/split-on-any-seq.js":344}],218:[function(require,module,exports){ +},{"../impls/$split-on-any-seq/split-on-any-seq.js":360}],228:[function(require,module,exports){ module.exports = require('../impls/$split-on-any/split-on-any.js').__splitOnAny; -},{"../impls/$split-on-any/split-on-any.js":346}],219:[function(require,module,exports){ +},{"../impls/$split-on-any/split-on-any.js":362}],229:[function(require,module,exports){ module.exports = require('../impls/$split-on-seq/split-on-seq.js').__splitOnSeq; -},{"../impls/$split-on-seq/split-on-seq.js":348}],220:[function(require,module,exports){ +},{"../impls/$split-on-seq/split-on-seq.js":364}],230:[function(require,module,exports){ module.exports = require('../impls/$split-on/split-on.js').__splitOn; -},{"../impls/$split-on/split-on.js":350}],221:[function(require,module,exports){ +},{"../impls/$split-on/split-on.js":366}],231:[function(require,module,exports){ module.exports = require('../impls/$split-when/split-when.js').__splitWhen; -},{"../impls/$split-when/split-when.js":352}],222:[function(require,module,exports){ +},{"../impls/$split-when/split-when.js":368}],232:[function(require,module,exports){ module.exports = require('../impls/$split/split.js').__split; -},{"../impls/$split/split.js":354}],223:[function(require,module,exports){ +},{"../impls/$split/split.js":370}],233:[function(require,module,exports){ module.exports = require('../impls/$spliterate-grouped/spliterate-grouped.js').__spliterateGrouped; -},{"../impls/$spliterate-grouped/spliterate-grouped.js":356}],224:[function(require,module,exports){ +},{"../impls/$spliterate-grouped/spliterate-grouped.js":372}],234:[function(require,module,exports){ module.exports = require('../impls/$spliterate/spliterate.js').__spliterate; -},{"../impls/$spliterate/spliterate.js":358}],225:[function(require,module,exports){ +},{"../impls/$spliterate/spliterate.js":374}],235:[function(require,module,exports){ module.exports = require('../impls/$starts-with-any-seq/starts-with-any-seq.js').__startsWithAnySeq; -},{"../impls/$starts-with-any-seq/starts-with-any-seq.js":360}],226:[function(require,module,exports){ +},{"../impls/$starts-with-any-seq/starts-with-any-seq.js":376}],236:[function(require,module,exports){ module.exports = require('../impls/$starts-with-any/starts-with-any.js').__startsWithAny; -},{"../impls/$starts-with-any/starts-with-any.js":362}],227:[function(require,module,exports){ +},{"../impls/$starts-with-any/starts-with-any.js":378}],237:[function(require,module,exports){ module.exports = require('../impls/$starts-with-seq/starts-with-seq.js').__startsWithSeq; -},{"../impls/$starts-with-seq/starts-with-seq.js":364}],228:[function(require,module,exports){ +},{"../impls/$starts-with-seq/starts-with-seq.js":380}],238:[function(require,module,exports){ module.exports = require('../impls/$starts-with/starts-with.js').__startsWith; -},{"../impls/$starts-with/starts-with.js":366}],229:[function(require,module,exports){ +},{"../impls/$starts-with/starts-with.js":382}],239:[function(require,module,exports){ module.exports = require('../impls/$str/str.js').__str; -},{"../impls/$str/str.js":368}],230:[function(require,module,exports){ +},{"../impls/$str/str.js":384}],240:[function(require,module,exports){ module.exports = require('../impls/$take-last-or/take-last-or.js').__takeLastOr; -},{"../impls/$take-last-or/take-last-or.js":370}],231:[function(require,module,exports){ +},{"../impls/$take-last-or/take-last-or.js":386}],241:[function(require,module,exports){ module.exports = require('../impls/$take-last/take-last.js').__takeLast; -},{"../impls/$take-last/take-last.js":372}],232:[function(require,module,exports){ +},{"../impls/$take-last/take-last.js":388}],242:[function(require,module,exports){ module.exports = require('../impls/$take-sorted/take-sorted.js').__takeSorted; -},{"../impls/$take-sorted/take-sorted.js":375}],233:[function(require,module,exports){ +},{"../impls/$take-sorted/take-sorted.js":391}],243:[function(require,module,exports){ module.exports = require('../impls/$take-while/take-while.js').__takeWhile; -},{"../impls/$take-while/take-while.js":377}],234:[function(require,module,exports){ +},{"../impls/$take-while/take-while.js":393}],244:[function(require,module,exports){ module.exports = require('../impls/$take/take.js').__take; -},{"../impls/$take/take.js":379}],235:[function(require,module,exports){ +},{"../impls/$take/take.js":395}],245:[function(require,module,exports){ module.exports = require('../impls/$tap/tap.js').__tap; -},{"../impls/$tap/tap.js":381}],236:[function(require,module,exports){ +},{"../impls/$tap/tap.js":397}],246:[function(require,module,exports){ module.exports = require('../impls/$to-array/to-array.js').__toArray; -},{"../impls/$to-array/to-array.js":383}],237:[function(require,module,exports){ +},{"../impls/$to-array/to-array.js":399}],247:[function(require,module,exports){ module.exports = require('../impls/$to-object/to-object.js').__toObject; -},{"../impls/$to-object/to-object.js":385}],238:[function(require,module,exports){ +},{"../impls/$to-object/to-object.js":401}],248:[function(require,module,exports){ module.exports = require('../impls/$window-ahead/window-ahead.js').__windowAhead; -},{"../impls/$window-ahead/window-ahead.js":387}],239:[function(require,module,exports){ +},{"../impls/$window-ahead/window-ahead.js":403}],249:[function(require,module,exports){ module.exports = require('../impls/$window-behind/window-behind.js').__windowBehind; -},{"../impls/$window-behind/window-behind.js":389}],240:[function(require,module,exports){ +},{"../impls/$window-behind/window-behind.js":405}],250:[function(require,module,exports){ module.exports = require('../impls/$window/window.js').__window; -},{"../impls/$window/window.js":391}],241:[function(require,module,exports){ +},{"../impls/$window/window.js":407}],251:[function(require,module,exports){ module.exports = require('../impls/wrap-entries/wrap-entries.js').__wrapEntries; -},{"../impls/wrap-entries/wrap-entries.js":450}],242:[function(require,module,exports){ +},{"../impls/wrap-entries/wrap-entries.js":470}],252:[function(require,module,exports){ module.exports = require('../impls/wrap-keys/wrap-keys.js').__wrapKeys; -},{"../impls/wrap-keys/wrap-keys.js":451}],243:[function(require,module,exports){ +},{"../impls/wrap-keys/wrap-keys.js":471}],253:[function(require,module,exports){ module.exports = require('../impls/wrap-values/wrap-values.js').__wrapValues; -},{"../impls/wrap-values/wrap-values.js":452}],244:[function(require,module,exports){ +},{"../impls/wrap-values/wrap-values.js":472}],254:[function(require,module,exports){ module.exports = require('../impls/$zip-all/zip-all.js').__zipAll; -},{"../impls/$zip-all/zip-all.js":395}],245:[function(require,module,exports){ +},{"../impls/$zip-all/zip-all.js":411}],255:[function(require,module,exports){ module.exports = require('../impls/$zip/zip.js').__zip; -},{"../impls/$zip/zip.js":397}],246:[function(require,module,exports){ +},{"../impls/$zip/zip.js":413}],256:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _marked = /*#__PURE__*/_regeneratorRuntime.mark(__append); @@ -44857,7 +45244,7 @@ function __append(source, value) { exports.__append = __append; var append = /*#__PURE__*/iterableCurry(__append); exports.append = append; -},{"../../internal/iterable.js":473,"@babel/runtime/regenerator":65}],247:[function(require,module,exports){ +},{"../../internal/iterable.js":493,"@babel/runtime/regenerator":65}],257:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _wrapAsyncGenerator = require("@babel/runtime/helpers/wrapAsyncGenerator"); @@ -44901,7 +45288,7 @@ function _asyncAppend() { var asyncAppend = /*#__PURE__*/asyncIterableCurry(__asyncAppend); exports.asyncAppend = asyncAppend; -},{"../../internal/async-iterable.js":460,"@babel/runtime/helpers/asyncGeneratorDelegate":41,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],248:[function(require,module,exports){ +},{"../../internal/async-iterable.js":480,"@babel/runtime/helpers/asyncGeneratorDelegate":41,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],258:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _awaitAsyncGenerator = require("@babel/runtime/helpers/awaitAsyncGenerator"); @@ -45041,7 +45428,7 @@ var asyncBatch = /*#__PURE__*/asyncIterableCurry(__asyncBatch, { } }); exports.asyncBatch = asyncBatch; -},{"../$spliterate/async-spliterate.js":357,"../../internal/async-iterable.js":460,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],249:[function(require,module,exports){ +},{"../$spliterate/async-spliterate.js":373,"../../internal/async-iterable.js":480,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],259:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _marked = /*#__PURE__*/_regeneratorRuntime.mark(batchSpliterator); @@ -45142,7 +45529,7 @@ var batch = /*#__PURE__*/iterableCurry(__batch, { } }); exports.batch = batch; -},{"../$spliterate/spliterate.js":358,"../../internal/iterable.js":473,"@babel/runtime/regenerator":65}],250:[function(require,module,exports){ +},{"../$spliterate/spliterate.js":374,"../../internal/iterable.js":493,"@babel/runtime/regenerator":65}],260:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _asyncIterator = require("@babel/runtime/helpers/asyncIterator"); @@ -45381,7 +45768,7 @@ var asyncBisect = /*#__PURE__*/asyncIterableCurry(__asyncBisect, { forceSync: true }); exports.asyncBisect = asyncBisect; -},{"../$peekerate/async-peekerate.js":323,"../$to-array/async-to-array.js":382,"../../internal/async-bisector.js":456,"../../internal/async-iterable.js":460,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],251:[function(require,module,exports){ +},{"../$peekerate/async-peekerate.js":339,"../$to-array/async-to-array.js":398,"../../internal/async-bisector.js":476,"../../internal/async-iterable.js":480,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],261:[function(require,module,exports){ function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } @@ -45537,7 +45924,7 @@ var bisect = /*#__PURE__*/iterableCurry(__bisect, { forceSync: true }); exports.bisect = bisect; -},{"../$peekerate/peekerate.js":324,"../$to-array/to-array.js":383,"../../internal/bisector.js":465,"../../internal/iterable.js":473,"@babel/runtime/regenerator":65}],252:[function(require,module,exports){ +},{"../$peekerate/peekerate.js":340,"../$to-array/to-array.js":399,"../../internal/bisector.js":485,"../../internal/iterable.js":493,"@babel/runtime/regenerator":65}],262:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } @@ -45637,7 +46024,7 @@ var asyncCollate = /*#__PURE__*/asyncIterableCurry(__asyncCollate, { variadic: true }); exports.asyncCollate = asyncCollate; -},{"../$interleave/async-interleave.js":305,"../../internal/async-iterable.js":460,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],253:[function(require,module,exports){ +},{"../$interleave/async-interleave.js":321,"../../internal/async-iterable.js":480,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],263:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _marked = /*#__PURE__*/_regeneratorRuntime.mark(byComparison); @@ -45725,7 +46112,7 @@ var collate = /*#__PURE__*/iterableCurry(__collate, { variadic: true }); exports.collate = collate; -},{"../$interleave/interleave.js":306,"../../internal/iterable.js":473,"@babel/runtime/regenerator":65}],254:[function(require,module,exports){ +},{"../$interleave/interleave.js":322,"../../internal/iterable.js":493,"@babel/runtime/regenerator":65}],264:[function(require,module,exports){ var _slicedToArray = require("@babel/runtime/helpers/slicedToArray"); var _require = require('../../internal/async-iterable.js'), @@ -45762,7 +46149,7 @@ var asyncCompress = /*#__PURE__*/curry(function $compress(source, included) { return __asyncCompress(asyncEnsureIterable(source), asyncEnsureIterable(included)); }); exports.asyncCompress = asyncCompress; -},{"../$filter/async-filter.js":276,"../$map/async-map.js":321,"../$zip/async-zip.js":396,"../../internal/async-iterable.js":460,"../../internal/curry.js":468,"@babel/runtime/helpers/slicedToArray":59}],255:[function(require,module,exports){ +},{"../$filter/async-filter.js":288,"../$map/async-map.js":337,"../$zip/async-zip.js":412,"../../internal/async-iterable.js":480,"../../internal/curry.js":488,"@babel/runtime/helpers/slicedToArray":59}],265:[function(require,module,exports){ var _slicedToArray = require("@babel/runtime/helpers/slicedToArray"); var _require = require('../../internal/iterable.js'), @@ -45799,7 +46186,7 @@ var compress = /*#__PURE__*/curry(function $compress(source, included) { return __compress(ensureIterable(source), ensureIterable(included)); }); exports.compress = compress; -},{"../$filter/filter.js":277,"../$map/map.js":322,"../$zip/zip.js":397,"../../internal/curry.js":468,"../../internal/iterable.js":473,"@babel/runtime/helpers/slicedToArray":59}],256:[function(require,module,exports){ +},{"../$filter/filter.js":289,"../$map/map.js":338,"../$zip/zip.js":413,"../../internal/curry.js":488,"../../internal/iterable.js":493,"@babel/runtime/helpers/slicedToArray":59}],266:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _wrapAsyncGenerator = require("@babel/runtime/helpers/wrapAsyncGenerator"); @@ -45866,7 +46253,7 @@ function _asyncConcat() { var asyncConcat = /*#__PURE__*/asyncWrapWithIterableIterator(__asyncConcat); exports.asyncConcat = asyncConcat; -},{"../../internal/async-iterable.js":460,"@babel/runtime/helpers/asyncGeneratorDelegate":41,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],257:[function(require,module,exports){ +},{"../../internal/async-iterable.js":480,"@babel/runtime/helpers/asyncGeneratorDelegate":41,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],267:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _marked = /*#__PURE__*/_regeneratorRuntime.mark(__concat); @@ -45919,7 +46306,7 @@ function __concat() { exports.__concat = __concat; var concat = /*#__PURE__*/wrapWithIterableIterator(__concat); exports.concat = concat; -},{"../../internal/iterable.js":473,"@babel/runtime/regenerator":65}],258:[function(require,module,exports){ +},{"../../internal/iterable.js":493,"@babel/runtime/regenerator":65}],268:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator"); @@ -46024,7 +46411,7 @@ var asyncConsume = /*#__PURE__*/asyncIterableCurry(__asyncConsume, { reduces: true }); exports.asyncConsume = asyncConsume; -},{"../../internal/async-iterable.js":460,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/asyncToGenerator":43,"@babel/runtime/regenerator":65}],259:[function(require,module,exports){ +},{"../../internal/async-iterable.js":480,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/asyncToGenerator":43,"@babel/runtime/regenerator":65}],269:[function(require,module,exports){ function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } @@ -46054,7 +46441,7 @@ var consume = /*#__PURE__*/iterableCurry(__consume, { reduces: true }); exports.consume = consume; -},{"../../internal/iterable.js":473}],260:[function(require,module,exports){ +},{"../../internal/iterable.js":493}],270:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _wrapAsyncGenerator = require("@babel/runtime/helpers/wrapAsyncGenerator"); @@ -46112,7 +46499,7 @@ function _asyncCycleTimes() { var asyncCycleTimes = /*#__PURE__*/asyncIterableCurry(__asyncCycleTimes); exports.asyncCycleTimes = asyncCycleTimes; -},{"../$to-array/async-to-array.js":382,"../../internal/async-iterable.js":460,"./cycle-times.js":261,"@babel/runtime/helpers/asyncGeneratorDelegate":41,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],261:[function(require,module,exports){ +},{"../$to-array/async-to-array.js":398,"../../internal/async-iterable.js":480,"./cycle-times.js":271,"@babel/runtime/helpers/asyncGeneratorDelegate":41,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],271:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _marked = /*#__PURE__*/_regeneratorRuntime.mark(__cycleTimes); @@ -46161,7 +46548,7 @@ function __cycleTimes(source, n) { exports.__cycleTimes = __cycleTimes; var cycleTimes = /*#__PURE__*/iterableCurry(__cycleTimes); exports.cycleTimes = cycleTimes; -},{"../$to-array/to-array.js":383,"../../internal/iterable.js":473,"@babel/runtime/regenerator":65}],262:[function(require,module,exports){ +},{"../$to-array/to-array.js":399,"../../internal/iterable.js":493,"@babel/runtime/regenerator":65}],272:[function(require,module,exports){ var _require = require('../../internal/async-iterable.js'), asyncIterableCurry = _require.asyncIterableCurry; @@ -46175,7 +46562,7 @@ function __asyncCycle(source) { exports.__asyncCycle = __asyncCycle; var asyncCycle = /*#__PURE__*/asyncIterableCurry(__asyncCycle); exports.asyncCycle = asyncCycle; -},{"../$cycle-times/async-cycle-times.js":260,"../../internal/async-iterable.js":460}],263:[function(require,module,exports){ +},{"../$cycle-times/async-cycle-times.js":270,"../../internal/async-iterable.js":480}],273:[function(require,module,exports){ var _require = require('../../internal/iterable.js'), iterableCurry = _require.iterableCurry; @@ -46189,7 +46576,7 @@ function __cycle(source) { exports.__cycle = __cycle; var cycle = /*#__PURE__*/iterableCurry(__cycle); exports.cycle = cycle; -},{"../$cycle-times/cycle-times.js":261,"../../internal/iterable.js":473}],264:[function(require,module,exports){ +},{"../$cycle-times/cycle-times.js":271,"../../internal/iterable.js":493}],274:[function(require,module,exports){ var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator"); var _regeneratorRuntime = require("@babel/runtime/regenerator"); @@ -46439,7 +46826,7 @@ function asyncDeepEqual() { } exports.asyncDeepEqual = asyncDeepEqual; -},{"../$every/every.js":275,"../$map/map.js":322,"../$slice/slice.js":338,"../$zip-all/async-zip-all.js":394,"../../internal/async-iterable.js":460,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/asyncToGenerator":43,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],265:[function(require,module,exports){ +},{"../$every/every.js":287,"../$map/map.js":338,"../$slice/slice.js":354,"../$zip-all/async-zip-all.js":410,"../../internal/async-iterable.js":480,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/asyncToGenerator":43,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],275:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } @@ -46544,7 +46931,213 @@ function deepEqual() { } exports.deepEqual = deepEqual; -},{"../$every/every.js":275,"../$map/map.js":322,"../$slice/slice.js":338,"../$zip-all/zip-all.js":395,"../../internal/iterable.js":473,"@babel/runtime/regenerator":65}],266:[function(require,module,exports){ +},{"../$every/every.js":287,"../$map/map.js":338,"../$slice/slice.js":354,"../$zip-all/zip-all.js":411,"../../internal/iterable.js":493,"@babel/runtime/regenerator":65}],276:[function(require,module,exports){ +var _regeneratorRuntime = require("@babel/runtime/regenerator"); + +var _awaitAsyncGenerator = require("@babel/runtime/helpers/awaitAsyncGenerator"); + +var _wrapAsyncGenerator = require("@babel/runtime/helpers/wrapAsyncGenerator"); + +var _asyncIterator = require("@babel/runtime/helpers/asyncIterator"); + +var _require = require('../../internal/async-iterable.js'), + asyncIterableCurry = _require.asyncIterableCurry; + +function __asyncDistinct(_x, _x2) { + return _asyncDistinct.apply(this, arguments); +} + +exports.__asyncDistinct = __asyncDistinct; + +function _asyncDistinct() { + _asyncDistinct = _wrapAsyncGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(source, selector) { + var set, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, value, key; + + return _regeneratorRuntime.wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + set = new Set(); + _iteratorNormalCompletion = true; + _didIteratorError = false; + _context.prev = 3; + _iterator = _asyncIterator(source); + + case 5: + _context.next = 7; + return _awaitAsyncGenerator(_iterator.next()); + + case 7: + _step = _context.sent; + _iteratorNormalCompletion = _step.done; + _context.next = 11; + return _awaitAsyncGenerator(_step.value); + + case 11: + _value = _context.sent; + + if (_iteratorNormalCompletion) { + _context.next = 23; + break; + } + + value = _value; + key = selector ? selector(value) : value; + + if (!set.has(key)) { + _context.next = 17; + break; + } + + return _context.abrupt("continue", 20); + + case 17: + set.add(key); + _context.next = 20; + return value; + + case 20: + _iteratorNormalCompletion = true; + _context.next = 5; + break; + + case 23: + _context.next = 29; + break; + + case 25: + _context.prev = 25; + _context.t0 = _context["catch"](3); + _didIteratorError = true; + _iteratorError = _context.t0; + + case 29: + _context.prev = 29; + _context.prev = 30; + + if (!(!_iteratorNormalCompletion && _iterator["return"] != null)) { + _context.next = 34; + break; + } + + _context.next = 34; + return _awaitAsyncGenerator(_iterator["return"]()); + + case 34: + _context.prev = 34; + + if (!_didIteratorError) { + _context.next = 37; + break; + } + + throw _iteratorError; + + case 37: + return _context.finish(34); + + case 38: + return _context.finish(29); + + case 39: + case "end": + return _context.stop(); + } + } + }, _callee, null, [[3, 25, 29, 39], [30,, 34, 38]]); + })); + return _asyncDistinct.apply(this, arguments); +} + +var asyncDistinct = asyncIterableCurry(__asyncDistinct, { + minArgs: 0, + maxArgs: 1 +}); +exports.asyncDistinct = asyncDistinct; +},{"../../internal/async-iterable.js":480,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],277:[function(require,module,exports){ +var _regeneratorRuntime = require("@babel/runtime/regenerator"); + +var _marked = /*#__PURE__*/_regeneratorRuntime.mark(__distinct); + +function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } + +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } + +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } + +var _require = require('../../internal/iterable.js'), + iterableCurry = _require.iterableCurry; + +function __distinct(source, selector) { + var set, _iterator, _step, value, key; + + return _regeneratorRuntime.wrap(function __distinct$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + set = new Set(); + _iterator = _createForOfIteratorHelper(source); + _context.prev = 2; + + _iterator.s(); + + case 4: + if ((_step = _iterator.n()).done) { + _context.next = 14; + break; + } + + value = _step.value; + key = selector ? selector(value) : value; + + if (!set.has(key)) { + _context.next = 9; + break; + } + + return _context.abrupt("continue", 12); + + case 9: + set.add(key); + _context.next = 12; + return value; + + case 12: + _context.next = 4; + break; + + case 14: + _context.next = 19; + break; + + case 16: + _context.prev = 16; + _context.t0 = _context["catch"](2); + + _iterator.e(_context.t0); + + case 19: + _context.prev = 19; + + _iterator.f(); + + return _context.finish(19); + + case 22: + case "end": + return _context.stop(); + } + } + }, _marked, null, [[2, 16, 19, 22]]); +} + +exports.__distinct = __distinct; +var distinct = iterableCurry(__distinct, { + minArgs: 0, + maxArgs: 1 +}); +exports.distinct = distinct; +},{"../../internal/iterable.js":493,"@babel/runtime/regenerator":65}],278:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _awaitAsyncGenerator = require("@babel/runtime/helpers/awaitAsyncGenerator"); @@ -46679,7 +47272,7 @@ function _asyncDropWhile() { var asyncDropWhile = /*#__PURE__*/asyncIterableCurry(__asyncDropWhile); exports.asyncDropWhile = asyncDropWhile; -},{"../../internal/async-iterable.js":460,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],267:[function(require,module,exports){ +},{"../../internal/async-iterable.js":480,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],279:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _marked = /*#__PURE__*/_regeneratorRuntime.mark(__dropWhile); @@ -46770,7 +47363,7 @@ function __dropWhile(source, predicate) { exports.__dropWhile = __dropWhile; var dropWhile = /*#__PURE__*/iterableCurry(__dropWhile); exports.dropWhile = dropWhile; -},{"../../internal/iterable.js":473,"@babel/runtime/regenerator":65}],268:[function(require,module,exports){ +},{"../../internal/iterable.js":493,"@babel/runtime/regenerator":65}],280:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _awaitAsyncGenerator = require("@babel/runtime/helpers/awaitAsyncGenerator"); @@ -46885,7 +47478,7 @@ function _asyncDrop() { var asyncDrop = /*#__PURE__*/asyncIterableCurry(__asyncDrop); exports.asyncDrop = asyncDrop; -},{"../../internal/async-iterable.js":460,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],269:[function(require,module,exports){ +},{"../../internal/async-iterable.js":480,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],281:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _marked = /*#__PURE__*/_regeneratorRuntime.mark(__drop); @@ -46960,7 +47553,7 @@ function __drop(iterable, n) { exports.__drop = __drop; var drop = /*#__PURE__*/iterableCurry(__drop); exports.drop = drop; -},{"../../internal/iterable.js":473,"@babel/runtime/regenerator":65}],270:[function(require,module,exports){ +},{"../../internal/iterable.js":493,"@babel/runtime/regenerator":65}],282:[function(require,module,exports){ var _require = require('../../internal/async-iterable.js'), asyncIterableCurry = _require.asyncIterableCurry; @@ -46980,7 +47573,7 @@ var asyncEnumerate = /*#__PURE__*/asyncIterableCurry(__asyncEnumerate, { maxArgs: 1 }); exports.asyncEnumerate = asyncEnumerate; -},{"../$map/async-map.js":321,"../../internal/async-iterable.js":460}],271:[function(require,module,exports){ +},{"../$map/async-map.js":337,"../../internal/async-iterable.js":480}],283:[function(require,module,exports){ var _require = require('../../internal/iterable.js'), iterableCurry = _require.iterableCurry; @@ -47000,7 +47593,7 @@ var enumerate = /*#__PURE__*/iterableCurry(__enumerate, { maxArgs: 1 }); exports.enumerate = enumerate; -},{"../$map/map.js":322,"../../internal/iterable.js":473}],272:[function(require,module,exports){ +},{"../$map/map.js":338,"../../internal/iterable.js":493}],284:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator"); @@ -47191,7 +47784,7 @@ var asyncEqual = /*#__PURE__*/asyncIterableCurry(__asyncEqual, { reduces: true }); exports.asyncEqual = asyncEqual; -},{"../$slice/slice.js":338,"../$zip-all/async-zip-all.js":394,"../../internal/async-iterable.js":460,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/asyncToGenerator":43,"@babel/runtime/regenerator":65}],273:[function(require,module,exports){ +},{"../$slice/slice.js":354,"../$zip-all/async-zip-all.js":410,"../../internal/async-iterable.js":480,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/asyncToGenerator":43,"@babel/runtime/regenerator":65}],285:[function(require,module,exports){ function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } @@ -47255,7 +47848,7 @@ var equal = /*#__PURE__*/iterableCurry(__equal, { reduces: true }); exports.equal = equal; -},{"../$slice/slice.js":338,"../$zip-all/zip-all.js":395,"../../internal/iterable.js":473}],274:[function(require,module,exports){ +},{"../$slice/slice.js":354,"../$zip-all/zip-all.js":411,"../../internal/iterable.js":493}],286:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator"); @@ -47374,7 +47967,7 @@ var asyncEvery = /*#__PURE__*/asyncIterableCurry(__asyncEvery, { reduces: true }); exports.asyncEvery = asyncEvery; -},{"../../internal/async-iterable.js":460,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/asyncToGenerator":43,"@babel/runtime/regenerator":65}],275:[function(require,module,exports){ +},{"../../internal/async-iterable.js":480,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/asyncToGenerator":43,"@babel/runtime/regenerator":65}],287:[function(require,module,exports){ function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } @@ -47412,7 +48005,7 @@ var every = /*#__PURE__*/iterableCurry(__every, { reduces: true }); exports.every = every; -},{"../../internal/iterable.js":473}],276:[function(require,module,exports){ +},{"../../internal/iterable.js":493}],288:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _awaitAsyncGenerator = require("@babel/runtime/helpers/awaitAsyncGenerator"); @@ -47530,7 +48123,7 @@ function _asyncFilter() { var asyncFilter = /*#__PURE__*/asyncIterableCurry(__asyncFilter); exports.asyncFilter = asyncFilter; -},{"../../internal/async-iterable.js":460,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],277:[function(require,module,exports){ +},{"../../internal/async-iterable.js":480,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],289:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _marked = /*#__PURE__*/_regeneratorRuntime.mark(__filter); @@ -47605,7 +48198,224 @@ function __filter(source, predicate) { exports.__filter = __filter; var filter = /*#__PURE__*/iterableCurry(__filter); exports.filter = filter; -},{"../../internal/iterable.js":473,"@babel/runtime/regenerator":65}],278:[function(require,module,exports){ +},{"../../internal/iterable.js":493,"@babel/runtime/regenerator":65}],290:[function(require,module,exports){ +var _regeneratorRuntime = require("@babel/runtime/regenerator"); + +var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator"); + +var _require = require('../../internal/async-iterable.js'), + asyncIterableCurry = _require.asyncIterableCurry; + +var _require2 = require('../$peekerate/async-peekerate.js'), + __asyncPeekerate = _require2.__asyncPeekerate; + +function __asyncFindBestOr(_x, _x2, _x3) { + return _asyncFindBestOr.apply(this, arguments); +} + +function _asyncFindBestOr() { + _asyncFindBestOr = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(iterable, notFoundValue, comparer) { + var mapper, + peekr, + best, + bestValue, + candidate, + candidateValue, + _args = arguments; + return _regeneratorRuntime.wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + mapper = _args.length > 3 && _args[3] !== undefined ? _args[3] : function (value) { + return value; + }; + _context.next = 3; + return __asyncPeekerate(iterable); + + case 3: + peekr = _context.sent; + + if (!peekr.done) { + _context.next = 8; + break; + } + + return _context.abrupt("return", notFoundValue); + + case 8: + best = peekr.value; + _context.next = 11; + return mapper(best, peekr.index); + + case 11: + bestValue = _context.sent; + _context.next = 14; + return peekr.advance(); + + case 14: + if (peekr.done) { + _context.next = 24; + break; + } + + candidate = peekr.value; + _context.next = 18; + return mapper(candidate, peekr.index); + + case 18: + candidateValue = _context.sent; + + if (comparer(bestValue, candidateValue)) { + best = candidate; + bestValue = candidateValue; + } + + _context.next = 22; + return peekr.advance(); + + case 22: + _context.next = 14; + break; + + case 24: + return _context.abrupt("return", best); + + case 25: + case "end": + return _context.stop(); + } + } + }, _callee); + })); + return _asyncFindBestOr.apply(this, arguments); +} + +exports.__asyncFindBestOr = __asyncFindBestOr; +var asyncFindBestOr = asyncIterableCurry(__asyncFindBestOr, { + reduces: true, + minArgs: 2, + maxArgs: 3, + growRight: true +}); +exports.asyncFindBestOr = asyncFindBestOr; +},{"../$peekerate/async-peekerate.js":339,"../../internal/async-iterable.js":480,"@babel/runtime/helpers/asyncToGenerator":43,"@babel/runtime/regenerator":65}],291:[function(require,module,exports){ +var _require = require('../../internal/iterable.js'), + iterableCurry = _require.iterableCurry; + +var _require2 = require('../$peekerate/peekerate.js'), + __peekerate = _require2.__peekerate; + +function __findBestOr(iterable, notFoundValue, comparer) { + var mapper = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : function (value) { + return value; + }; + + var peekr = __peekerate(iterable); + + if (peekr.done) { + return notFoundValue; + } else { + var best = peekr.value; + var bestValue = mapper(best, peekr.index); + peekr.advance(); + + while (!peekr.done) { + var candidate = peekr.value; + var candidateValue = mapper(candidate, peekr.index); + + if (comparer(bestValue, candidateValue)) { + best = candidate; + bestValue = candidateValue; + } + + peekr.advance(); + } + + return best; + } +} + +exports.__findBestOr = __findBestOr; +var findBestOr = iterableCurry(__findBestOr, { + reduces: true, + minArgs: 2, + maxArgs: 3, + growRight: true +}); +exports.findBestOr = findBestOr; +},{"../$peekerate/peekerate.js":340,"../../internal/iterable.js":493}],292:[function(require,module,exports){ +var _regeneratorRuntime = require("@babel/runtime/regenerator"); + +var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator"); + +var _require = require('../../internal/async-iterable.js'), + asyncIterableCurry = _require.asyncIterableCurry; + +var _require2 = require('../$find-best-or/async-find-best-or.js'), + __asyncFindBestOr = _require2.__asyncFindBestOr; + +function __asyncFindBest(_x, _x2) { + return _asyncFindBest.apply(this, arguments); +} + +function _asyncFindBest() { + _asyncFindBest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(iterable, comparer) { + var mapper, + _args = arguments; + return _regeneratorRuntime.wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + mapper = _args.length > 2 && _args[2] !== undefined ? _args[2] : function (value) { + return value; + }; + _context.next = 3; + return __asyncFindBestOr(iterable, undefined, comparer, mapper); + + case 3: + return _context.abrupt("return", _context.sent); + + case 4: + case "end": + return _context.stop(); + } + } + }, _callee); + })); + return _asyncFindBest.apply(this, arguments); +} + +exports.__asyncFindBest = __asyncFindBest; +var asyncFindBest = asyncIterableCurry(__asyncFindBest, { + reduces: true, + minArgs: 1, + maxArgs: 2, + growRight: true +}); +exports.asyncFindBest = asyncFindBest; +},{"../$find-best-or/async-find-best-or.js":290,"../../internal/async-iterable.js":480,"@babel/runtime/helpers/asyncToGenerator":43,"@babel/runtime/regenerator":65}],293:[function(require,module,exports){ +var _require = require('../../internal/iterable.js'), + iterableCurry = _require.iterableCurry; + +var _require2 = require('../$find-best-or/find-best-or.js'), + __findBestOr = _require2.__findBestOr; + +function __findBest(iterable, comparer) { + var mapper = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function (value) { + return value; + }; + return __findBestOr(iterable, undefined, comparer, mapper); +} + +exports.__findBest = __findBest; +var findBest = iterableCurry(__findBest, { + reduces: true, + minArgs: 1, + maxArgs: 2, + growRight: true +}); +exports.findBest = findBest; +},{"../$find-best-or/find-best-or.js":291,"../../internal/iterable.js":493}],294:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator"); @@ -47725,7 +48535,7 @@ var asyncFindOr = /*#__PURE__*/asyncIterableCurry(__asyncFindOr, { reduces: true }); exports.asyncFindOr = asyncFindOr; -},{"../../internal/async-iterable.js":460,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/asyncToGenerator":43,"@babel/runtime/regenerator":65}],279:[function(require,module,exports){ +},{"../../internal/async-iterable.js":480,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/asyncToGenerator":43,"@babel/runtime/regenerator":65}],295:[function(require,module,exports){ function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } @@ -47764,7 +48574,7 @@ var findOr = /*#__PURE__*/iterableCurry(__findOr, { reduces: true }); exports.findOr = findOr; -},{"../../internal/iterable.js":473}],280:[function(require,module,exports){ +},{"../../internal/iterable.js":493}],296:[function(require,module,exports){ var _require = require('../../internal/async-iterable.js'), asyncIterableCurry = _require.asyncIterableCurry; @@ -47780,7 +48590,7 @@ var asyncFind = /*#__PURE__*/asyncIterableCurry(__asyncFind, { reduces: true }); exports.asyncFind = asyncFind; -},{"../$find-or/async-find-or.js":278,"../../internal/async-iterable.js":460}],281:[function(require,module,exports){ +},{"../$find-or/async-find-or.js":294,"../../internal/async-iterable.js":480}],297:[function(require,module,exports){ var _require = require('../../internal/iterable.js'), iterableCurry = _require.iterableCurry; @@ -47796,7 +48606,7 @@ var find = /*#__PURE__*/iterableCurry(__find, { reduces: true }); exports.find = find; -},{"../$find-or/find-or.js":279,"../../internal/iterable.js":473}],282:[function(require,module,exports){ +},{"../$find-or/find-or.js":295,"../../internal/iterable.js":493}],298:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator"); @@ -47855,7 +48665,7 @@ var asyncFirstOr = /*#__PURE__*/asyncIterableCurry(__asyncFirstOr, { reduces: true }); exports.asyncFirstOr = asyncFirstOr; -},{"../../internal/async-iterable.js":460,"@babel/runtime/helpers/asyncToGenerator":43,"@babel/runtime/regenerator":65}],283:[function(require,module,exports){ +},{"../../internal/async-iterable.js":480,"@babel/runtime/helpers/asyncToGenerator":43,"@babel/runtime/regenerator":65}],299:[function(require,module,exports){ var _require = require('../../internal/iterable.js'), iterableCurry = _require.iterableCurry, callReturn = _require.callReturn; @@ -47877,7 +48687,7 @@ var firstOr = /*#__PURE__*/iterableCurry(__firstOr, { reduces: true }); exports.firstOr = firstOr; -},{"../../internal/iterable.js":473}],284:[function(require,module,exports){ +},{"../../internal/iterable.js":493}],300:[function(require,module,exports){ var _require = require('../../internal/async-iterable.js'), asyncIterableCurry = _require.asyncIterableCurry; @@ -47893,7 +48703,7 @@ var asyncFirst = /*#__PURE__*/asyncIterableCurry(__asyncFirst, { reduces: true }); exports.asyncFirst = asyncFirst; -},{"../$first-or/async-first-or.js":282,"../../internal/async-iterable.js":460}],285:[function(require,module,exports){ +},{"../$first-or/async-first-or.js":298,"../../internal/async-iterable.js":480}],301:[function(require,module,exports){ var _require = require('../../internal/iterable.js'), iterableCurry = _require.iterableCurry; @@ -47909,7 +48719,7 @@ var first = /*#__PURE__*/iterableCurry(__first, { reduces: true }); exports.first = first; -},{"../$first-or/first-or.js":283,"../../internal/iterable.js":473}],286:[function(require,module,exports){ +},{"../$first-or/first-or.js":299,"../../internal/iterable.js":493}],302:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _wrapAsyncGenerator = require("@babel/runtime/helpers/wrapAsyncGenerator"); @@ -48021,7 +48831,7 @@ function _asyncFlatMap() { var asyncFlatMap = /*#__PURE__*/asyncIterableCurry(__asyncFlatMap); exports.asyncFlatMap = asyncFlatMap; -},{"../$map/async-map.js":321,"../../internal/async-iterable.js":460,"@babel/runtime/helpers/asyncGeneratorDelegate":41,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],287:[function(require,module,exports){ +},{"../$map/async-map.js":337,"../../internal/async-iterable.js":480,"@babel/runtime/helpers/asyncGeneratorDelegate":41,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],303:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _marked = /*#__PURE__*/_regeneratorRuntime.mark(__flatMap); @@ -48091,7 +48901,7 @@ function __flatMap(source, func) { exports.__flatMap = __flatMap; var flatMap = /*#__PURE__*/iterableCurry(__flatMap); exports.flatMap = flatMap; -},{"../$map/map.js":322,"../../internal/iterable.js":473,"@babel/runtime/regenerator":65}],288:[function(require,module,exports){ +},{"../$map/map.js":338,"../../internal/iterable.js":493,"@babel/runtime/regenerator":65}],304:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _wrapAsyncGenerator = require("@babel/runtime/helpers/wrapAsyncGenerator"); @@ -48244,7 +49054,7 @@ var asyncFlat = /*#__PURE__*/asyncIterableCurry(__asyncFlat, { validateArgs: validateArgs }); exports.asyncFlat = asyncFlat; -},{"../../internal/async-iterable.js":460,"./internal/validate-args.js":290,"@babel/runtime/helpers/asyncGeneratorDelegate":41,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],289:[function(require,module,exports){ +},{"../../internal/async-iterable.js":480,"./internal/validate-args.js":306,"@babel/runtime/helpers/asyncGeneratorDelegate":41,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],305:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _marked = /*#__PURE__*/_regeneratorRuntime.mark(flatInternal); @@ -48343,7 +49153,7 @@ var flat = /*#__PURE__*/iterableCurry(__flat, { validateArgs: validateArgs }); exports.flat = flat; -},{"../../internal/iterable.js":473,"./internal/validate-args.js":290,"@babel/runtime/regenerator":65}],290:[function(require,module,exports){ +},{"../../internal/iterable.js":493,"./internal/validate-args.js":306,"@babel/runtime/regenerator":65}],306:[function(require,module,exports){ var _require = require('../../is-object/is-object.js'), isObject = _require.isObject; @@ -48362,7 +49172,7 @@ function validateArgs(args) { } exports.validateArgs = validateArgs; -},{"../../is-object/is-object.js":422}],291:[function(require,module,exports){ +},{"../../is-object/is-object.js":440}],307:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator"); @@ -48470,7 +49280,7 @@ var asyncForEach = /*#__PURE__*/asyncIterableCurry(__asyncForEach, { reduces: true }); exports.asyncForEach = asyncForEach; -},{"../../internal/async-iterable.js":460,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/asyncToGenerator":43,"@babel/runtime/regenerator":65}],292:[function(require,module,exports){ +},{"../../internal/async-iterable.js":480,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/asyncToGenerator":43,"@babel/runtime/regenerator":65}],308:[function(require,module,exports){ function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } @@ -48503,7 +49313,7 @@ var forEach = /*#__PURE__*/iterableCurry(__forEach, { reduces: true }); exports.forEach = forEach; -},{"../../internal/iterable.js":473}],293:[function(require,module,exports){ +},{"../../internal/iterable.js":493}],309:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _marked = /*#__PURE__*/_regeneratorRuntime.mark(__asyncFork); @@ -48555,7 +49365,7 @@ var asyncFork = /*#__PURE__*/asyncIterableCurry(__asyncFork, { forceSync: true }); exports.asyncFork = asyncFork; -},{"../../internal/async-fork.js":457,"../../internal/async-iterable.js":460,"@babel/runtime/regenerator":65}],294:[function(require,module,exports){ +},{"../../internal/async-fork.js":477,"../../internal/async-iterable.js":480,"@babel/runtime/regenerator":65}],310:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _marked = /*#__PURE__*/_regeneratorRuntime.mark(__fork); @@ -48607,7 +49417,7 @@ var fork = /*#__PURE__*/iterableCurry(__fork, { forceSync: true }); exports.fork = fork; -},{"../../internal/fork.js":470,"../../internal/iterable.js":473,"@babel/runtime/regenerator":65}],295:[function(require,module,exports){ +},{"../../internal/fork.js":490,"../../internal/iterable.js":493,"@babel/runtime/regenerator":65}],311:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator"); @@ -48739,6 +49549,11 @@ var AsyncForkerator = /*#__PURE__*/function (_AsyncPeekerator) { value: function fork() { return this[_].exchange.fork(); } + }, { + key: Symbol.asyncIterator, + value: function value() { + return this[_].exchange.fork(); + } }]); return AsyncForkerator; @@ -48758,7 +49573,7 @@ function asyncWrapWithEnsureIterable(fn) { var asyncForkerate = asyncWrapWithEnsureIterable(__asyncForkerate); exports.asyncForkerate = asyncForkerate; -},{"../../internal/async-fork.js":457,"../../internal/async-iterable.js":460,"../../internal/async-peekerator.js":463,"@babel/runtime/helpers/asyncToGenerator":43,"@babel/runtime/helpers/classCallCheck":45,"@babel/runtime/helpers/createClass":47,"@babel/runtime/helpers/get":49,"@babel/runtime/helpers/getPrototypeOf":50,"@babel/runtime/helpers/inherits":51,"@babel/runtime/helpers/possibleConstructorReturn":57,"@babel/runtime/regenerator":65}],296:[function(require,module,exports){ +},{"../../internal/async-fork.js":477,"../../internal/async-iterable.js":480,"../../internal/async-peekerator.js":483,"@babel/runtime/helpers/asyncToGenerator":43,"@babel/runtime/helpers/classCallCheck":45,"@babel/runtime/helpers/createClass":47,"@babel/runtime/helpers/get":49,"@babel/runtime/helpers/getPrototypeOf":50,"@babel/runtime/helpers/inherits":51,"@babel/runtime/helpers/possibleConstructorReturn":57,"@babel/runtime/regenerator":65}],312:[function(require,module,exports){ var _classCallCheck = require("@babel/runtime/helpers/classCallCheck"); var _createClass = require("@babel/runtime/helpers/createClass"); @@ -48827,6 +49642,11 @@ var Forkerator = /*#__PURE__*/function (_Peekerator) { value: function fork() { return this[_].exchange.fork(); } + }, { + key: Symbol.iterator, + value: function value() { + return this[_].exchange.fork(); + } }]); return Forkerator; @@ -48846,7 +49666,7 @@ function wrapWithEnsureIterable(fn) { var forkerate = wrapWithEnsureIterable(__forkerate); exports.forkerate = forkerate; -},{"../../internal/fork.js":470,"../../internal/iterable.js":473,"../../internal/peekerator.js":477,"@babel/runtime/helpers/classCallCheck":45,"@babel/runtime/helpers/createClass":47,"@babel/runtime/helpers/get":49,"@babel/runtime/helpers/getPrototypeOf":50,"@babel/runtime/helpers/inherits":51,"@babel/runtime/helpers/possibleConstructorReturn":57}],297:[function(require,module,exports){ +},{"../../internal/fork.js":490,"../../internal/iterable.js":493,"../../internal/peekerator.js":497,"@babel/runtime/helpers/classCallCheck":45,"@babel/runtime/helpers/createClass":47,"@babel/runtime/helpers/get":49,"@babel/runtime/helpers/getPrototypeOf":50,"@babel/runtime/helpers/inherits":51,"@babel/runtime/helpers/possibleConstructorReturn":57}],313:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator"); @@ -49011,7 +49831,7 @@ var asyncIncludesAnySeq = /*#__PURE__*/asyncIterableCurry(__asyncIncludesAnySeq, reduces: true }); exports.asyncIncludesAnySeq = asyncIncludesAnySeq; -},{"../$starts-with-any-seq/starts-with-any-seq.js":360,"../$window-ahead/async-window-ahead.js":386,"../../internal/async-any-seq.js":455,"../../internal/async-iterable.js":460,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/asyncToGenerator":43,"@babel/runtime/regenerator":65}],298:[function(require,module,exports){ +},{"../$starts-with-any-seq/starts-with-any-seq.js":376,"../$window-ahead/async-window-ahead.js":402,"../../internal/async-any-seq.js":475,"../../internal/async-iterable.js":480,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/asyncToGenerator":43,"@babel/runtime/regenerator":65}],314:[function(require,module,exports){ function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } @@ -49069,7 +49889,7 @@ var includesAnySeq = /*#__PURE__*/iterableCurry(__includesAnySeq, { reduces: true }); exports.includesAnySeq = includesAnySeq; -},{"../$starts-with-any-seq/starts-with-any-seq.js":360,"../$window-ahead/window-ahead.js":387,"../../internal/any-seq.js":454,"../../internal/iterable.js":473}],299:[function(require,module,exports){ +},{"../$starts-with-any-seq/starts-with-any-seq.js":376,"../$window-ahead/window-ahead.js":403,"../../internal/any-seq.js":474,"../../internal/iterable.js":493}],315:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator"); @@ -49128,7 +49948,7 @@ var asyncIncludesAny = /*#__PURE__*/asyncIterableCurry(__asyncIncludesAny, { validateArgs: function validateArgs(args) {} }); exports.asyncIncludesAny = asyncIncludesAny; -},{"../$find-or/async-find-or.js":278,"../$includes/includes.js":304,"../../internal/async-iterable.js":460,"@babel/runtime/helpers/asyncToGenerator":43,"@babel/runtime/regenerator":65}],300:[function(require,module,exports){ +},{"../$find-or/async-find-or.js":294,"../$includes/includes.js":320,"../../internal/async-iterable.js":480,"@babel/runtime/helpers/asyncToGenerator":43,"@babel/runtime/regenerator":65}],316:[function(require,module,exports){ var _require = require('../../internal/iterable.js'), iterableCurry = _require.iterableCurry; @@ -49161,7 +49981,7 @@ var includesAny = /*#__PURE__*/iterableCurry(__includesAny, { } }); exports.includesAny = includesAny; -},{"../$find-or/find-or.js":279,"../$includes/includes.js":304,"../../internal/iterable.js":473}],301:[function(require,module,exports){ +},{"../$find-or/find-or.js":295,"../$includes/includes.js":320,"../../internal/iterable.js":493}],317:[function(require,module,exports){ var _require = require('../../internal/async-iterable.js'), asyncIterableCurry = _require.asyncIterableCurry, asyncEnsureIterable = _require.asyncEnsureIterable; @@ -49184,7 +50004,7 @@ var asyncIncludesSeq = /*#__PURE__*/asyncIterableCurry(__asyncIncludesSeq, { } }); exports.asyncIncludesSeq = asyncIncludesSeq; -},{"../$includes-any-seq/async-includes-any-seq.js":297,"../../internal/async-iterable.js":460}],302:[function(require,module,exports){ +},{"../$includes-any-seq/async-includes-any-seq.js":313,"../../internal/async-iterable.js":480}],318:[function(require,module,exports){ var _require = require('../../internal/iterable.js'), iterableCurry = _require.iterableCurry, ensureIterable = _require.ensureIterable; @@ -49207,7 +50027,7 @@ var includesSeq = /*#__PURE__*/iterableCurry(__includesSeq, { } }); exports.includesSeq = includesSeq; -},{"../$includes-any-seq/includes-any-seq.js":298,"../../internal/iterable.js":473}],303:[function(require,module,exports){ +},{"../$includes-any-seq/includes-any-seq.js":314,"../../internal/iterable.js":493}],319:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator"); @@ -49261,7 +50081,7 @@ var asyncIncludes = /*#__PURE__*/asyncIterableCurry(__asyncIncludes, { validateArgs: function validateArgs(args) {} }); exports.asyncIncludes = asyncIncludes; -},{"../$find-or/async-find-or.js":278,"../../internal/async-iterable.js":460,"@babel/runtime/helpers/asyncToGenerator":43,"@babel/runtime/regenerator":65}],304:[function(require,module,exports){ +},{"../$find-or/async-find-or.js":294,"../../internal/async-iterable.js":480,"@babel/runtime/helpers/asyncToGenerator":43,"@babel/runtime/regenerator":65}],320:[function(require,module,exports){ var _require = require('../../internal/iterable.js'), iterableCurry = _require.iterableCurry; @@ -49289,7 +50109,7 @@ var includes = /*#__PURE__*/iterableCurry(__includes, { } }); exports.includes = includes; -},{"../$find-or/find-or.js":279,"../../internal/iterable.js":473}],305:[function(require,module,exports){ +},{"../$find-or/find-or.js":295,"../../internal/iterable.js":493}],321:[function(require,module,exports){ var _toConsumableArray = require("@babel/runtime/helpers/toConsumableArray"); var _regeneratorRuntime = require("@babel/runtime/regenerator"); @@ -49655,6 +50475,12 @@ var AsyncInterleaver = /*#__PURE__*/function (_AsyncIterableIterato) { return this.returnBuffers(); case 4: + return _context7.abrupt("return", { + value: undefined, + done: true + }); + + case 5: case "end": return _context7.stop(); } @@ -49686,7 +50512,7 @@ var asyncInterleave = /*#__PURE__*/asyncIterableCurry(__asyncInterleave, { maxArgs: 2 }); exports.asyncInterleave = asyncInterleave; -},{"../$map/async-map.js":321,"../$to-array/async-to-array.js":382,"../../internal/async-iterable-iterator.js":459,"../../internal/async-iterable.js":460,"../../internal/async-parallel-each.js":461,"../../internal/async-peekerator.js":463,"@babel/runtime/helpers/asyncToGenerator":43,"@babel/runtime/helpers/classCallCheck":45,"@babel/runtime/helpers/createClass":47,"@babel/runtime/helpers/get":49,"@babel/runtime/helpers/getPrototypeOf":50,"@babel/runtime/helpers/inherits":51,"@babel/runtime/helpers/possibleConstructorReturn":57,"@babel/runtime/helpers/toConsumableArray":61,"@babel/runtime/regenerator":65}],306:[function(require,module,exports){ +},{"../$map/async-map.js":337,"../$to-array/async-to-array.js":398,"../../internal/async-iterable-iterator.js":479,"../../internal/async-iterable.js":480,"../../internal/async-parallel-each.js":481,"../../internal/async-peekerator.js":483,"@babel/runtime/helpers/asyncToGenerator":43,"@babel/runtime/helpers/classCallCheck":45,"@babel/runtime/helpers/createClass":47,"@babel/runtime/helpers/get":49,"@babel/runtime/helpers/getPrototypeOf":50,"@babel/runtime/helpers/inherits":51,"@babel/runtime/helpers/possibleConstructorReturn":57,"@babel/runtime/helpers/toConsumableArray":61,"@babel/runtime/regenerator":65}],322:[function(require,module,exports){ var _toConsumableArray = require("@babel/runtime/helpers/toConsumableArray"); var _classCallCheck = require("@babel/runtime/helpers/classCallCheck"); @@ -49892,6 +50718,10 @@ var Interleaver = /*#__PURE__*/function (_IterableIterator) { value: function _return() { callReturn(this.iterator); this.returnBuffers(); + return { + value: undefined, + done: true + }; } }]); @@ -49911,7 +50741,7 @@ var interleave = /*#__PURE__*/iterableCurry(__interleave, { maxArgs: 2 }); exports.interleave = interleave; -},{"../$map/map.js":322,"../$to-array/to-array.js":383,"../../internal/iterable-iterator.js":472,"../../internal/iterable.js":473,"../../internal/parallel-each.js":475,"../../internal/peekerator.js":477,"@babel/runtime/helpers/classCallCheck":45,"@babel/runtime/helpers/createClass":47,"@babel/runtime/helpers/get":49,"@babel/runtime/helpers/getPrototypeOf":50,"@babel/runtime/helpers/inherits":51,"@babel/runtime/helpers/possibleConstructorReturn":57,"@babel/runtime/helpers/toConsumableArray":61}],307:[function(require,module,exports){ +},{"../$map/map.js":338,"../$to-array/to-array.js":399,"../../internal/iterable-iterator.js":492,"../../internal/iterable.js":493,"../../internal/parallel-each.js":495,"../../internal/peekerator.js":497,"@babel/runtime/helpers/classCallCheck":45,"@babel/runtime/helpers/createClass":47,"@babel/runtime/helpers/get":49,"@babel/runtime/helpers/getPrototypeOf":50,"@babel/runtime/helpers/inherits":51,"@babel/runtime/helpers/possibleConstructorReturn":57,"@babel/runtime/helpers/toConsumableArray":61}],323:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _wrapAsyncGenerator = require("@babel/runtime/helpers/wrapAsyncGenerator"); @@ -50040,7 +50870,7 @@ function _asyncInterposeSeq() { var asyncInterposeSeq = /*#__PURE__*/asyncIterableCurry(__asyncInterposeSeq); exports.asyncInterposeSeq = asyncInterposeSeq; -},{"../../internal/async-iterable.js":460,"@babel/runtime/helpers/asyncGeneratorDelegate":41,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],308:[function(require,module,exports){ +},{"../../internal/async-iterable.js":480,"@babel/runtime/helpers/asyncGeneratorDelegate":41,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],324:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _marked = /*#__PURE__*/_regeneratorRuntime.mark(__interposeSeq); @@ -50123,7 +50953,7 @@ function __interposeSeq(source, seq) { exports.__interposeSeq = __interposeSeq; var interposeSeq = /*#__PURE__*/iterableCurry(__interposeSeq); exports.interposeSeq = interposeSeq; -},{"../../internal/iterable.js":473,"@babel/runtime/regenerator":65}],309:[function(require,module,exports){ +},{"../../internal/iterable.js":493,"@babel/runtime/regenerator":65}],325:[function(require,module,exports){ var _require = require('../../internal/async-iterable.js'), asyncIterableCurry = _require.asyncIterableCurry; @@ -50139,7 +50969,7 @@ var asyncInterpose = /*#__PURE__*/asyncIterableCurry(__asyncInterpose, { validateArgs: function validateArgs(args) {} }); exports.asyncInterpose = asyncInterpose; -},{"../$interpose-seq/async-interpose-seq.js":307,"../../internal/async-iterable.js":460}],310:[function(require,module,exports){ +},{"../$interpose-seq/async-interpose-seq.js":323,"../../internal/async-iterable.js":480}],326:[function(require,module,exports){ var _require = require('../../internal/iterable.js'), iterableCurry = _require.iterableCurry; @@ -50159,7 +50989,7 @@ var interpose = /*#__PURE__*/iterableCurry(__interpose, { } }); exports.interpose = interpose; -},{"../$interpose-seq/interpose-seq.js":308,"../../internal/iterable.js":473}],311:[function(require,module,exports){ +},{"../$interpose-seq/interpose-seq.js":324,"../../internal/iterable.js":493}],327:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator"); @@ -50205,7 +51035,7 @@ var asyncIsEmpty = /*#__PURE__*/asyncIterableCurry(__asyncIsEmpty, { reduces: true }); exports.asyncIsEmpty = asyncIsEmpty; -},{"../$first-or/async-first-or.js":282,"../../internal/async-iterable.js":460,"@babel/runtime/helpers/asyncToGenerator":43,"@babel/runtime/regenerator":65}],312:[function(require,module,exports){ +},{"../$first-or/async-first-or.js":298,"../../internal/async-iterable.js":480,"@babel/runtime/helpers/asyncToGenerator":43,"@babel/runtime/regenerator":65}],328:[function(require,module,exports){ var _require = require('../../internal/iterable.js'), iterableCurry = _require.iterableCurry; @@ -50223,7 +51053,7 @@ var isEmpty = /*#__PURE__*/iterableCurry(__isEmpty, { reduces: true }); exports.isEmpty = isEmpty; -},{"../$first-or/first-or.js":283,"../../internal/iterable.js":473}],313:[function(require,module,exports){ +},{"../$first-or/first-or.js":299,"../../internal/iterable.js":493}],329:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator"); @@ -50304,7 +51134,7 @@ var asyncIsSorted = /*#__PURE__*/asyncIterableCurry(__asyncIsSorted, { maxArgs: 1 }); exports.asyncIsSorted = asyncIsSorted; -},{"../$peekerate/async-peekerate.js":323,"../../internal/async-iterable.js":460,"../../internal/compare.js":467,"@babel/runtime/helpers/asyncToGenerator":43,"@babel/runtime/regenerator":65}],314:[function(require,module,exports){ +},{"../$peekerate/async-peekerate.js":339,"../../internal/async-iterable.js":480,"../../internal/compare.js":487,"@babel/runtime/helpers/asyncToGenerator":43,"@babel/runtime/regenerator":65}],330:[function(require,module,exports){ var _require = require('../../internal/iterable.js'), iterableCurry = _require.iterableCurry; @@ -50339,7 +51169,7 @@ var isSorted = /*#__PURE__*/iterableCurry(__isSorted, { maxArgs: 1 }); exports.isSorted = isSorted; -},{"../$peekerate/peekerate.js":324,"../../internal/compare.js":467,"../../internal/iterable.js":473}],315:[function(require,module,exports){ +},{"../$peekerate/peekerate.js":340,"../../internal/compare.js":487,"../../internal/iterable.js":493}],331:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _wrapAsyncGenerator = require("@babel/runtime/helpers/wrapAsyncGenerator"); @@ -50469,7 +51299,7 @@ function _asyncJoinWithSeq() { var asyncJoinWithSeq = /*#__PURE__*/asyncIterableCurry(__asyncJoinWithSeq); exports.asyncJoinWithSeq = asyncJoinWithSeq; -},{"../$to-array/async-to-array.js":382,"../../internal/async-iterable.js":460,"@babel/runtime/helpers/asyncGeneratorDelegate":41,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],316:[function(require,module,exports){ +},{"../$to-array/async-to-array.js":398,"../../internal/async-iterable.js":480,"@babel/runtime/helpers/asyncGeneratorDelegate":41,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],332:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _marked = /*#__PURE__*/_regeneratorRuntime.mark(__joinWithSeq); @@ -50553,7 +51383,7 @@ function __joinWithSeq(source, separatorSeq) { exports.__joinWithSeq = __joinWithSeq; var joinWithSeq = /*#__PURE__*/iterableCurry(__joinWithSeq); exports.joinWithSeq = joinWithSeq; -},{"../$to-array/to-array.js":383,"../../internal/iterable.js":473,"@babel/runtime/regenerator":65}],317:[function(require,module,exports){ +},{"../$to-array/to-array.js":399,"../../internal/iterable.js":493,"@babel/runtime/regenerator":65}],333:[function(require,module,exports){ var _require = require('../../internal/async-iterable.js'), asyncIterableCurry = _require.asyncIterableCurry; @@ -50569,7 +51399,7 @@ var asyncJoinWith = /*#__PURE__*/asyncIterableCurry(__asyncJoinWith, { validateArgs: function validateArgs(args) {} }); exports.asyncJoinWith = asyncJoinWith; -},{"../$join-with-seq/async-join-with-seq.js":315,"../../internal/async-iterable.js":460}],318:[function(require,module,exports){ +},{"../$join-with-seq/async-join-with-seq.js":331,"../../internal/async-iterable.js":480}],334:[function(require,module,exports){ var _require = require('../../internal/iterable.js'), iterableCurry = _require.iterableCurry; @@ -50589,7 +51419,7 @@ var joinWith = /*#__PURE__*/iterableCurry(__joinWith, { } }); exports.joinWith = joinWith; -},{"../$join-with-seq/join-with-seq.js":316,"../../internal/iterable.js":473}],319:[function(require,module,exports){ +},{"../$join-with-seq/join-with-seq.js":332,"../../internal/iterable.js":493}],335:[function(require,module,exports){ var _require = require('../../internal/async-iterable.js'), asyncWrapWithIterableIterator = _require.asyncWrapWithIterableIterator, asyncEnsureIterable = _require.asyncEnsureIterable; @@ -50606,7 +51436,7 @@ function __asyncJoin(source) { exports.__asyncJoin = __asyncJoin; var asyncJoin = /*#__PURE__*/asyncWrapWithIterableIterator(__asyncJoin); exports.asyncJoin = asyncJoin; -},{"../$join-with-seq/async-join-with-seq.js":315,"../../internal/async-iterable.js":460}],320:[function(require,module,exports){ +},{"../$join-with-seq/async-join-with-seq.js":331,"../../internal/async-iterable.js":480}],336:[function(require,module,exports){ var _require = require('../../internal/iterable.js'), wrapWithIterableIterator = _require.wrapWithIterableIterator, ensureIterable = _require.ensureIterable; @@ -50623,7 +51453,7 @@ function __join(source) { exports.__join = __join; var join = /*#__PURE__*/wrapWithIterableIterator(__join); exports.join = join; -},{"../$join-with-seq/join-with-seq.js":316,"../../internal/iterable.js":473}],321:[function(require,module,exports){ +},{"../$join-with-seq/join-with-seq.js":332,"../../internal/iterable.js":493}],337:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _awaitAsyncGenerator = require("@babel/runtime/helpers/awaitAsyncGenerator"); @@ -50732,7 +51562,7 @@ function _asyncMap() { var asyncMap = /*#__PURE__*/asyncIterableCurry(__asyncMap); exports.asyncMap = asyncMap; -},{"../../internal/async-iterable.js":460,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],322:[function(require,module,exports){ +},{"../../internal/async-iterable.js":480,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],338:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _marked = /*#__PURE__*/_regeneratorRuntime.mark(__map); @@ -50801,7 +51631,7 @@ function __map(source, func) { exports.__map = __map; var map = /*#__PURE__*/iterableCurry(__map); exports.map = map; -},{"../../internal/iterable.js":473,"@babel/runtime/regenerator":65}],323:[function(require,module,exports){ +},{"../../internal/iterable.js":493,"@babel/runtime/regenerator":65}],339:[function(require,module,exports){ var _require = require('../../internal/async-iterable.js'), asyncEnsureIterable = _require.asyncEnsureIterable; @@ -50822,7 +51652,7 @@ function asyncWrapWithEnsureIterable(fn) { var asyncPeekerate = asyncWrapWithEnsureIterable(__asyncPeekerate); exports.asyncPeekerate = asyncPeekerate; -},{"../../internal/async-iterable.js":460,"../../internal/async-peekerator.js":463}],324:[function(require,module,exports){ +},{"../../internal/async-iterable.js":480,"../../internal/async-peekerator.js":483}],340:[function(require,module,exports){ var _require = require('../../internal/iterable.js'), ensureIterable = _require.ensureIterable; @@ -50843,7 +51673,7 @@ function wrapWithEnsureIterable(fn) { var peekerate = wrapWithEnsureIterable(__peekerate); exports.peekerate = peekerate; -},{"../../internal/iterable.js":473,"../../internal/peekerator.js":477}],325:[function(require,module,exports){ +},{"../../internal/iterable.js":493,"../../internal/peekerator.js":497}],341:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _wrapAsyncGenerator = require("@babel/runtime/helpers/wrapAsyncGenerator"); @@ -50887,7 +51717,7 @@ function _asyncPrepend() { var asyncPrepend = /*#__PURE__*/asyncIterableCurry(__asyncPrepend); exports.asyncPrepend = asyncPrepend; -},{"../../internal/async-iterable.js":460,"@babel/runtime/helpers/asyncGeneratorDelegate":41,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],326:[function(require,module,exports){ +},{"../../internal/async-iterable.js":480,"@babel/runtime/helpers/asyncGeneratorDelegate":41,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],342:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _marked = /*#__PURE__*/_regeneratorRuntime.mark(__prepend); @@ -50917,7 +51747,7 @@ function __prepend(source, value) { exports.__prepend = __prepend; var prepend = /*#__PURE__*/iterableCurry(__prepend); exports.prepend = prepend; -},{"../../internal/iterable.js":473,"@babel/runtime/regenerator":65}],327:[function(require,module,exports){ +},{"../../internal/iterable.js":493,"@babel/runtime/regenerator":65}],343:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator"); @@ -51016,7 +51846,7 @@ var asyncReduce = /*#__PURE__*/asyncIterableCurry(__asyncReduce, { maxArgs: 2 }); exports.asyncReduce = asyncReduce; -},{"../$peekerate/async-peekerate.js":323,"../../internal/async-iterable.js":460,"@babel/runtime/helpers/asyncToGenerator":43,"@babel/runtime/regenerator":65}],328:[function(require,module,exports){ +},{"../$peekerate/async-peekerate.js":339,"../../internal/async-iterable.js":480,"@babel/runtime/helpers/asyncToGenerator":43,"@babel/runtime/regenerator":65}],344:[function(require,module,exports){ var _require = require('../../internal/iterable.js'), iterableCurry = _require.iterableCurry; @@ -51059,7 +51889,7 @@ var reduce = /*#__PURE__*/iterableCurry(__reduce, { maxArgs: 2 }); exports.reduce = reduce; -},{"../$peekerate/peekerate.js":324,"../../internal/iterable.js":473}],329:[function(require,module,exports){ +},{"../$peekerate/peekerate.js":340,"../../internal/iterable.js":493}],345:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _wrapAsyncGenerator = require("@babel/runtime/helpers/wrapAsyncGenerator"); @@ -51111,7 +51941,7 @@ function _asyncReverse() { var asyncReverse = /*#__PURE__*/asyncIterableCurry(__asyncReverse); exports.asyncReverse = asyncReverse; -},{"../$to-array/async-to-array.js":382,"../../internal/async-iterable.js":460,"@babel/runtime/helpers/asyncGeneratorDelegate":41,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],330:[function(require,module,exports){ +},{"../$to-array/async-to-array.js":398,"../../internal/async-iterable.js":480,"@babel/runtime/helpers/asyncGeneratorDelegate":41,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],346:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _marked = /*#__PURE__*/_regeneratorRuntime.mark(__reverse); @@ -51140,7 +51970,7 @@ function __reverse(source) { exports.__reverse = __reverse; var reverse = /*#__PURE__*/iterableCurry(__reverse); exports.reverse = reverse; -},{"../$to-array/to-array.js":383,"../../internal/iterable.js":473,"@babel/runtime/regenerator":65}],331:[function(require,module,exports){ +},{"../$to-array/to-array.js":399,"../../internal/iterable.js":493,"@babel/runtime/regenerator":65}],347:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _awaitAsyncGenerator = require("@babel/runtime/helpers/awaitAsyncGenerator"); @@ -51236,7 +52066,7 @@ var asyncRoundRobin = /*#__PURE__*/asyncIterableCurry(__asyncRoundRobin, { validateArgs: /*#__PURE__*/makeValidateArgs('asyncRoundRobin') }); exports.asyncRoundRobin = asyncRoundRobin; -},{"../$interleave/async-interleave.js":305,"../../internal/async-iterable.js":460,"./internal/validate-args.js":332,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],332:[function(require,module,exports){ +},{"../$interleave/async-interleave.js":321,"../../internal/async-iterable.js":480,"./internal/validate-args.js":348,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],348:[function(require,module,exports){ var _require = require('../../../internal/number.js'), isInteger = _require.isInteger; @@ -51267,7 +52097,7 @@ var makeValidateArgs = function makeValidateArgs(methodName) { }; exports.makeValidateArgs = makeValidateArgs; -},{"../../../internal/number.js":474,"../../is-object/is-object.js":422,"../../not-undefined/not-undefined.js":436}],333:[function(require,module,exports){ +},{"../../../internal/number.js":494,"../../is-object/is-object.js":440,"../../not-undefined/not-undefined.js":456}],349:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _marked = /*#__PURE__*/_regeneratorRuntime.mark(byPosition); @@ -51353,7 +52183,7 @@ var roundRobin = /*#__PURE__*/iterableCurry(__roundRobin, { validateArgs: /*#__PURE__*/makeValidateArgs('roundRobin') }); exports.roundRobin = roundRobin; -},{"../$interleave/interleave.js":306,"../../internal/iterable.js":473,"./internal/validate-args.js":332,"@babel/runtime/regenerator":65}],334:[function(require,module,exports){ +},{"../$interleave/interleave.js":322,"../../internal/iterable.js":493,"./internal/validate-args.js":348,"@babel/runtime/regenerator":65}],350:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator"); @@ -51462,7 +52292,7 @@ function _asyncSize() { exports.__asyncSize = __asyncSize; var asyncSize = __asyncSize; exports.asyncSize = asyncSize; -},{"../../internal/async-iterable.js":460,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/asyncToGenerator":43,"@babel/runtime/regenerator":65}],335:[function(require,module,exports){ +},{"../../internal/async-iterable.js":480,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/asyncToGenerator":43,"@babel/runtime/regenerator":65}],351:[function(require,module,exports){ function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } @@ -51496,7 +52326,7 @@ function __size(iterable) { exports.__size = __size; var size = __size; exports.size = size; -},{"../../internal/iterable.js":473}],336:[function(require,module,exports){ +},{"../../internal/iterable.js":493}],352:[function(require,module,exports){ var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator"); var _regeneratorRuntime = require("@babel/runtime/regenerator"); @@ -51855,7 +52685,7 @@ var asyncSlice = /*#__PURE__*/asyncIterableCurry(__asyncSlice, { maxArgs: 3 }); exports.asyncSlice = asyncSlice; -},{"../../internal/async-iterable.js":460,"../../internal/circular-buffer.js":466,"./internal/validate-args.js":337,"@babel/runtime/helpers/asyncGeneratorDelegate":41,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/asyncToGenerator":43,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],337:[function(require,module,exports){ +},{"../../internal/async-iterable.js":480,"../../internal/circular-buffer.js":486,"./internal/validate-args.js":353,"@babel/runtime/helpers/asyncGeneratorDelegate":41,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/asyncToGenerator":43,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],353:[function(require,module,exports){ var _slicedToArray = require("@babel/runtime/helpers/slicedToArray"); var _require = require('../../../internal/number.js'), @@ -51906,7 +52736,7 @@ var makeValidateArgs = function makeValidateArgs(methodName) { }; exports.makeValidateArgs = makeValidateArgs; -},{"../../../internal/number.js":474,"../../is-object/is-object.js":422,"@babel/runtime/helpers/slicedToArray":59}],338:[function(require,module,exports){ +},{"../../../internal/number.js":494,"../../is-object/is-object.js":440,"@babel/runtime/helpers/slicedToArray":59}],354:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _marked = /*#__PURE__*/_regeneratorRuntime.mark(__sliceFromStart), @@ -52114,7 +52944,7 @@ var slice = /*#__PURE__*/iterableCurry(__slice, { maxArgs: 3 }); exports.slice = slice; -},{"../../internal/circular-buffer.js":466,"../../internal/iterable.js":473,"./internal/validate-args.js":337,"@babel/runtime/regenerator":65}],339:[function(require,module,exports){ +},{"../../internal/circular-buffer.js":486,"../../internal/iterable.js":493,"./internal/validate-args.js":353,"@babel/runtime/regenerator":65}],355:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator"); @@ -52233,7 +53063,7 @@ var asyncSome = /*#__PURE__*/asyncIterableCurry(__asyncSome, { reduces: true }); exports.asyncSome = asyncSome; -},{"../../internal/async-iterable.js":460,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/asyncToGenerator":43,"@babel/runtime/regenerator":65}],340:[function(require,module,exports){ +},{"../../internal/async-iterable.js":480,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/asyncToGenerator":43,"@babel/runtime/regenerator":65}],356:[function(require,module,exports){ function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } @@ -52271,7 +53101,7 @@ var some = /*#__PURE__*/iterableCurry(__some, { reduces: true }); exports.some = some; -},{"../../internal/iterable.js":473}],341:[function(require,module,exports){ +},{"../../internal/iterable.js":493}],357:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _awaitAsyncGenerator = require("@babel/runtime/helpers/awaitAsyncGenerator"); @@ -52371,7 +53201,7 @@ var asyncSplitGroups = /*#__PURE__*/asyncIterableCurry(__asyncSplitGroups, { maxArgs: 1 }); exports.asyncSplitGroups = asyncSplitGroups; -},{"../$peekerate/async-peekerate.js":323,"../$spliterate-grouped/async-spliterate-grouped.js":355,"../../internal/async-iterable.js":460,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],342:[function(require,module,exports){ +},{"../$peekerate/async-peekerate.js":339,"../$spliterate-grouped/async-spliterate-grouped.js":371,"../../internal/async-iterable.js":480,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],358:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _marked = /*#__PURE__*/_regeneratorRuntime.mark(groupingSpliterator); @@ -52451,7 +53281,7 @@ var splitGroups = /*#__PURE__*/iterableCurry(__splitGroups, { maxArgs: 1 }); exports.splitGroups = splitGroups; -},{"../$peekerate/peekerate.js":324,"../$spliterate-grouped/spliterate-grouped.js":356,"../../internal/iterable.js":473,"@babel/runtime/regenerator":65}],343:[function(require,module,exports){ +},{"../$peekerate/peekerate.js":340,"../$spliterate-grouped/spliterate-grouped.js":372,"../../internal/iterable.js":493,"@babel/runtime/regenerator":65}],359:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } @@ -52675,7 +53505,7 @@ var asyncSplitOnAnySeq = /*#__PURE__*/asyncIterableCurry(__asyncSplitOnAnySeq, { maxArgs: 2 }); exports.asyncSplitOnAnySeq = asyncSplitOnAnySeq; -},{"../$spliterate/async-spliterate.js":357,"../$starts-with-seq/starts-with-seq.js":364,"../$window-ahead/async-window-ahead.js":386,"../../internal/async-any-seq.js":455,"../../internal/async-iterable.js":460,"@babel/runtime/helpers/asyncGeneratorDelegate":41,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],344:[function(require,module,exports){ +},{"../$spliterate/async-spliterate.js":373,"../$starts-with-seq/starts-with-seq.js":380,"../$window-ahead/async-window-ahead.js":402,"../../internal/async-any-seq.js":475,"../../internal/async-iterable.js":480,"@babel/runtime/helpers/asyncGeneratorDelegate":41,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],360:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _marked = /*#__PURE__*/_regeneratorRuntime.mark(anySeqspliterator), @@ -52841,7 +53671,7 @@ var splitOnAnySeq = /*#__PURE__*/iterableCurry(__splitOnAnySeq, { maxArgs: 2 }); exports.splitOnAnySeq = splitOnAnySeq; -},{"../$spliterate/spliterate.js":358,"../$starts-with-seq/starts-with-seq.js":364,"../$window-ahead/window-ahead.js":387,"../../internal/any-seq.js":454,"../../internal/iterable.js":473,"@babel/runtime/regenerator":65}],345:[function(require,module,exports){ +},{"../$spliterate/spliterate.js":374,"../$starts-with-seq/starts-with-seq.js":380,"../$window-ahead/window-ahead.js":403,"../../internal/any-seq.js":474,"../../internal/iterable.js":493,"@babel/runtime/regenerator":65}],361:[function(require,module,exports){ var _require = require('../../internal/async-iterable.js'), asyncIterableCurry = _require.asyncIterableCurry; @@ -52867,7 +53697,7 @@ var asyncSplitOnAny = /*#__PURE__*/asyncIterableCurry(__asyncSplitOnAny, { validateArgs: function validateArgs(args) {} }); exports.asyncSplitOnAny = asyncSplitOnAny; -},{"../$includes/includes.js":304,"../$split-when/async-split-when.js":351,"../../internal/async-iterable.js":460}],346:[function(require,module,exports){ +},{"../$includes/includes.js":320,"../$split-when/async-split-when.js":367,"../../internal/async-iterable.js":480}],362:[function(require,module,exports){ var _require = require('../../internal/iterable.js'), iterableCurry = _require.iterableCurry; @@ -52897,7 +53727,7 @@ var splitOnAny = /*#__PURE__*/iterableCurry(__splitOnAny, { } }); exports.splitOnAny = splitOnAny; -},{"../$includes/includes.js":304,"../$split-when/split-when.js":352,"../../internal/iterable.js":473}],347:[function(require,module,exports){ +},{"../$includes/includes.js":320,"../$split-when/split-when.js":368,"../../internal/iterable.js":493}],363:[function(require,module,exports){ var _require = require('../../internal/async-iterable.js'), asyncIterableCurry = _require.asyncIterableCurry, asyncEnsureIterable = _require.asyncEnsureIterable; @@ -52919,7 +53749,7 @@ var asyncSplitOnSeq = /*#__PURE__*/asyncIterableCurry(__asyncSplitOnSeq, { } }); exports.asyncSplitOnSeq = asyncSplitOnSeq; -},{"../$split-on-any-seq/async-split-on-any-seq.js":343,"../../internal/async-iterable.js":460}],348:[function(require,module,exports){ +},{"../$split-on-any-seq/async-split-on-any-seq.js":359,"../../internal/async-iterable.js":480}],364:[function(require,module,exports){ var _require = require('../../internal/iterable.js'), iterableCurry = _require.iterableCurry, ensureIterable = _require.ensureIterable; @@ -52941,7 +53771,7 @@ var splitOnSeq = /*#__PURE__*/iterableCurry(__splitOnSeq, { } }); exports.splitOnSeq = splitOnSeq; -},{"../$split-on-any-seq/split-on-any-seq.js":344,"../../internal/iterable.js":473}],349:[function(require,module,exports){ +},{"../$split-on-any-seq/split-on-any-seq.js":360,"../../internal/iterable.js":493}],365:[function(require,module,exports){ var _require = require('../../internal/async-iterable.js'), asyncIterableCurry = _require.asyncIterableCurry; @@ -52962,7 +53792,7 @@ var asyncSplitOn = /*#__PURE__*/asyncIterableCurry(__asyncSplitOn, { validateArgs: function validateArgs(args) {} }); exports.asyncSplitOn = asyncSplitOn; -},{"../$split-when/async-split-when.js":351,"../../internal/async-iterable.js":460}],350:[function(require,module,exports){ +},{"../$split-when/async-split-when.js":367,"../../internal/async-iterable.js":480}],366:[function(require,module,exports){ var _require = require('../../internal/iterable.js'), iterableCurry = _require.iterableCurry; @@ -52987,7 +53817,7 @@ var splitOn = /*#__PURE__*/iterableCurry(__splitOn, { } }); exports.splitOn = splitOn; -},{"../$split-when/split-when.js":352,"../../internal/iterable.js":473}],351:[function(require,module,exports){ +},{"../$split-when/split-when.js":368,"../../internal/iterable.js":493}],367:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _awaitAsyncGenerator = require("@babel/runtime/helpers/awaitAsyncGenerator"); @@ -53122,7 +53952,7 @@ function __asyncSplitWhen(source, predicate) { exports.__asyncSplitWhen = __asyncSplitWhen; var asyncSplitWhen = /*#__PURE__*/asyncIterableCurry(__asyncSplitWhen); exports.asyncSplitWhen = asyncSplitWhen; -},{"../$spliterate/async-spliterate.js":357,"../../internal/async-iterable.js":460,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],352:[function(require,module,exports){ +},{"../$spliterate/async-spliterate.js":373,"../../internal/async-iterable.js":480,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],368:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _marked = /*#__PURE__*/_regeneratorRuntime.mark(predicateSpliterator); @@ -53201,7 +54031,7 @@ function __splitWhen(source, predicate) { exports.__splitWhen = __splitWhen; var splitWhen = /*#__PURE__*/iterableCurry(__splitWhen); exports.splitWhen = splitWhen; -},{"../$spliterate/spliterate.js":358,"../../internal/iterable.js":473,"@babel/runtime/regenerator":65}],353:[function(require,module,exports){ +},{"../$spliterate/spliterate.js":374,"../../internal/iterable.js":493,"@babel/runtime/regenerator":65}],369:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _marked = /*#__PURE__*/_regeneratorRuntime.mark(iterableOf); @@ -53237,7 +54067,7 @@ function __asyncSplit(source) { exports.__asyncSplit = __asyncSplit; var asyncSplit = /*#__PURE__*/asyncIterableCurry(__asyncSplit); exports.asyncSplit = asyncSplit; -},{"../$map/async-map.js":321,"../../internal/async-iterable.js":460,"@babel/runtime/regenerator":65}],354:[function(require,module,exports){ +},{"../$map/async-map.js":337,"../../internal/async-iterable.js":480,"@babel/runtime/regenerator":65}],370:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _marked = /*#__PURE__*/_regeneratorRuntime.mark(iterableOf); @@ -53273,7 +54103,7 @@ function __split(source) { exports.__split = __split; var split = /*#__PURE__*/iterableCurry(__split); exports.split = split; -},{"../$map/map.js":322,"../../internal/iterable.js":473,"@babel/runtime/regenerator":65}],355:[function(require,module,exports){ +},{"../$map/map.js":338,"../../internal/iterable.js":493,"@babel/runtime/regenerator":65}],371:[function(require,module,exports){ var _require = require('../../internal/async-iterable.js'), asyncIterableCurry = _require.asyncIterableCurry; @@ -53300,7 +54130,7 @@ var asyncSpliterateGrouped = /*#__PURE__*/asyncIterableCurry(function $spliterat growRight: true }); exports.asyncSpliterateGrouped = asyncSpliterateGrouped; -},{"../$map/async-map.js":321,"../$wrap/async-wrap.js":392,"../../internal/async-groups-iterator.js":458,"../../internal/async-iterable.js":460}],356:[function(require,module,exports){ +},{"../$map/async-map.js":337,"../$wrap/async-wrap.js":408,"../../internal/async-groups-iterator.js":478,"../../internal/async-iterable.js":480}],372:[function(require,module,exports){ var _require = require('../../internal/iterable.js'), iterableCurry = _require.iterableCurry; @@ -53327,7 +54157,7 @@ var spliterateGrouped = /*#__PURE__*/iterableCurry(function $spliterateGrouped() growRight: true }); exports.spliterateGrouped = spliterateGrouped; -},{"../$map/map.js":322,"../$wrap/wrap.js":393,"../../internal/groups-iterator.js":471,"../../internal/iterable.js":473}],357:[function(require,module,exports){ +},{"../$map/map.js":338,"../$wrap/wrap.js":409,"../../internal/groups-iterator.js":491,"../../internal/iterable.js":493}],373:[function(require,module,exports){ var _require = require('../../internal/async-iterable.js'), asyncIterableCurry = _require.asyncIterableCurry; @@ -53354,7 +54184,7 @@ var asyncSpliterate = /*#__PURE__*/asyncIterableCurry(function $spliterate() { growRight: true }); exports.asyncSpliterate = asyncSpliterate; -},{"../$map/async-map.js":321,"../$wrap/async-wrap.js":392,"../../internal/async-iterable.js":460,"../../internal/async-parts-iterator.js":462}],358:[function(require,module,exports){ +},{"../$map/async-map.js":337,"../$wrap/async-wrap.js":408,"../../internal/async-iterable.js":480,"../../internal/async-parts-iterator.js":482}],374:[function(require,module,exports){ var _require = require('../../internal/iterable.js'), iterableCurry = _require.iterableCurry; @@ -53381,7 +54211,7 @@ var spliterate = /*#__PURE__*/iterableCurry(function $spliterate() { growRight: true }); exports.spliterate = spliterate; -},{"../$map/map.js":322,"../$wrap/wrap.js":393,"../../internal/iterable.js":473,"../../internal/parts-iterator.js":476}],359:[function(require,module,exports){ +},{"../$map/map.js":338,"../$wrap/wrap.js":409,"../../internal/iterable.js":493,"../../internal/parts-iterator.js":496}],375:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator"); @@ -53557,7 +54387,7 @@ var asyncStartsWithAnySeq = /*#__PURE__*/asyncIterableCurry(__asyncStartsWithAny } }); exports.asyncStartsWithAnySeq = asyncStartsWithAnySeq; -},{"../$peekerate/async-peekerate.js":323,"../$zip-all/async-zip-all.js":394,"../../internal/async-iterable.js":460,"@babel/runtime/helpers/asyncToGenerator":43,"@babel/runtime/regenerator":65}],360:[function(require,module,exports){ +},{"../$peekerate/async-peekerate.js":339,"../$zip-all/async-zip-all.js":410,"../../internal/async-iterable.js":480,"@babel/runtime/helpers/asyncToGenerator":43,"@babel/runtime/regenerator":65}],376:[function(require,module,exports){ var _require = require('../../internal/iterable.js'), iterableCurry = _require.iterableCurry, ensureIterable = _require.ensureIterable; @@ -53628,7 +54458,7 @@ var startsWithAnySeq = /*#__PURE__*/iterableCurry(__startsWithAnySeq, { } }); exports.startsWithAnySeq = startsWithAnySeq; -},{"../$peekerate/peekerate.js":324,"../$zip-all/zip-all.js":395,"../../internal/iterable.js":473}],361:[function(require,module,exports){ +},{"../$peekerate/peekerate.js":340,"../$zip-all/zip-all.js":411,"../../internal/iterable.js":493}],377:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator"); @@ -53694,7 +54524,7 @@ var asyncStartsWithAny = /*#__PURE__*/asyncIterableCurry(__asyncStartsWithAny, { validateArgs: function validateArgs(args) {} }); exports.asyncStartsWithAny = asyncStartsWithAny; -},{"../$first-or/async-first-or.js":282,"../$includes/includes.js":304,"../../internal/async-iterable.js":460,"@babel/runtime/helpers/asyncToGenerator":43,"@babel/runtime/regenerator":65}],362:[function(require,module,exports){ +},{"../$first-or/async-first-or.js":298,"../$includes/includes.js":320,"../../internal/async-iterable.js":480,"@babel/runtime/helpers/asyncToGenerator":43,"@babel/runtime/regenerator":65}],378:[function(require,module,exports){ var _require = require('../../internal/iterable.js'), iterableCurry = _require.iterableCurry; @@ -53729,7 +54559,7 @@ var startsWithAny = /*#__PURE__*/iterableCurry(__startsWithAny, { } }); exports.startsWithAny = startsWithAny; -},{"../$first-or/first-or.js":283,"../$includes/includes.js":304,"../../internal/iterable.js":473}],363:[function(require,module,exports){ +},{"../$first-or/first-or.js":299,"../$includes/includes.js":320,"../../internal/iterable.js":493}],379:[function(require,module,exports){ var _require = require('../../internal/async-iterable.js'), asyncIterableCurry = _require.asyncIterableCurry, asyncEnsureIterable = _require.asyncEnsureIterable; @@ -53752,7 +54582,7 @@ var asyncStartsWithSeq = /*#__PURE__*/asyncIterableCurry(__asyncStartsWithSeq, { } }); exports.asyncStartsWithSeq = asyncStartsWithSeq; -},{"../$starts-with-any-seq/async-starts-with-any-seq.js":359,"../../internal/async-iterable.js":460}],364:[function(require,module,exports){ +},{"../$starts-with-any-seq/async-starts-with-any-seq.js":375,"../../internal/async-iterable.js":480}],380:[function(require,module,exports){ var _require = require('../../internal/iterable.js'), iterableCurry = _require.iterableCurry, ensureIterable = _require.ensureIterable; @@ -53775,7 +54605,7 @@ var startsWithSeq = /*#__PURE__*/iterableCurry(__startsWithSeq, { } }); exports.startsWithSeq = startsWithSeq; -},{"../$starts-with-any-seq/starts-with-any-seq.js":360,"../../internal/iterable.js":473}],365:[function(require,module,exports){ +},{"../$starts-with-any-seq/starts-with-any-seq.js":376,"../../internal/iterable.js":493}],381:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator"); @@ -53836,7 +54666,7 @@ var asyncStartsWith = /*#__PURE__*/asyncIterableCurry(__asyncStartsWith, { validateArgs: function validateArgs(args) {} }); exports.asyncStartsWith = asyncStartsWith; -},{"../$first-or/async-first-or.js":282,"../../internal/async-iterable.js":460,"@babel/runtime/helpers/asyncToGenerator":43,"@babel/runtime/regenerator":65}],366:[function(require,module,exports){ +},{"../$first-or/async-first-or.js":298,"../../internal/async-iterable.js":480,"@babel/runtime/helpers/asyncToGenerator":43,"@babel/runtime/regenerator":65}],382:[function(require,module,exports){ var _require = require('../../internal/iterable.js'), iterableCurry = _require.iterableCurry; @@ -53866,7 +54696,7 @@ var startsWith = /*#__PURE__*/iterableCurry(__startsWith, { } }); exports.startsWith = startsWith; -},{"../$first-or/first-or.js":283,"../../internal/iterable.js":473}],367:[function(require,module,exports){ +},{"../$first-or/first-or.js":299,"../../internal/iterable.js":493}],383:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator"); @@ -53976,7 +54806,7 @@ var asyncStr = /*#__PURE__*/asyncIterableCurry(__asyncStr, { reduces: true }); exports.asyncStr = asyncStr; -},{"../../internal/async-iterable.js":460,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/asyncToGenerator":43,"@babel/runtime/regenerator":65}],368:[function(require,module,exports){ +},{"../../internal/async-iterable.js":480,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/asyncToGenerator":43,"@babel/runtime/regenerator":65}],384:[function(require,module,exports){ function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } @@ -54011,7 +54841,7 @@ var str = /*#__PURE__*/iterableCurry(__str, { reduces: true }); exports.str = str; -},{"../../internal/iterable.js":473}],369:[function(require,module,exports){ +},{"../../internal/iterable.js":493}],385:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator"); @@ -54121,7 +54951,7 @@ var asyncTakeLastOr = /*#__PURE__*/asyncIterableCurry(__asyncTakeLastOr, { reduces: true }); exports.asyncTakeLastOr = asyncTakeLastOr; -},{"../../internal/async-iterable.js":460,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/asyncToGenerator":43,"@babel/runtime/regenerator":65}],370:[function(require,module,exports){ +},{"../../internal/async-iterable.js":480,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/asyncToGenerator":43,"@babel/runtime/regenerator":65}],386:[function(require,module,exports){ function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } @@ -54156,7 +54986,7 @@ var takeLastOr = /*#__PURE__*/iterableCurry(__takeLastOr, { reduces: true }); exports.takeLastOr = takeLastOr; -},{"../../internal/iterable.js":473}],371:[function(require,module,exports){ +},{"../../internal/iterable.js":493}],387:[function(require,module,exports){ var _require = require('../../internal/async-iterable.js'), asyncIterableCurry = _require.asyncIterableCurry; @@ -54172,7 +55002,7 @@ var asyncTakeLast = /*#__PURE__*/asyncIterableCurry(__asyncTakeLast, { reduces: true }); exports.asyncTakeLast = asyncTakeLast; -},{"../$take-last-or/async-take-last-or.js":369,"../../internal/async-iterable.js":460}],372:[function(require,module,exports){ +},{"../$take-last-or/async-take-last-or.js":385,"../../internal/async-iterable.js":480}],388:[function(require,module,exports){ var _require = require('../../internal/iterable.js'), iterableCurry = _require.iterableCurry; @@ -54188,7 +55018,7 @@ var takeLast = /*#__PURE__*/iterableCurry(__takeLast, { reduces: true }); exports.takeLast = takeLast; -},{"../$take-last-or/take-last-or.js":370,"../../internal/iterable.js":473}],373:[function(require,module,exports){ +},{"../$take-last-or/take-last-or.js":386,"../../internal/iterable.js":493}],389:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _awaitAsyncGenerator = require("@babel/runtime/helpers/awaitAsyncGenerator"); @@ -54341,7 +55171,7 @@ var asyncTakeSorted = /*#__PURE__*/asyncIterableCurry(__asyncTakeSorted, { } }); exports.asyncTakeSorted = asyncTakeSorted; -},{"../../internal/async-iterable.js":460,"../../internal/compare.js":467,"./internal/heap.js":374,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],374:[function(require,module,exports){ +},{"../../internal/async-iterable.js":480,"../../internal/compare.js":487,"./internal/heap.js":390,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],390:[function(require,module,exports){ var _classCallCheck = require("@babel/runtime/helpers/classCallCheck"); var _createClass = require("@babel/runtime/helpers/createClass"); @@ -54466,7 +55296,7 @@ var Heap = /*#__PURE__*/function () { }(); exports.Heap = Heap; -},{"@babel/runtime/helpers/classCallCheck":45,"@babel/runtime/helpers/createClass":47}],375:[function(require,module,exports){ +},{"@babel/runtime/helpers/classCallCheck":45,"@babel/runtime/helpers/createClass":47}],391:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _marked = /*#__PURE__*/_regeneratorRuntime.mark(__takeSorted); @@ -54553,7 +55383,7 @@ var takeSorted = /*#__PURE__*/iterableCurry(__takeSorted, { } }); exports.takeSorted = takeSorted; -},{"../../internal/compare.js":467,"../../internal/iterable.js":473,"./internal/heap.js":374,"@babel/runtime/regenerator":65}],376:[function(require,module,exports){ +},{"../../internal/compare.js":487,"../../internal/iterable.js":493,"./internal/heap.js":390,"@babel/runtime/regenerator":65}],392:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _awaitAsyncGenerator = require("@babel/runtime/helpers/awaitAsyncGenerator"); @@ -54681,7 +55511,7 @@ function _asyncTakeWhile() { var asyncTakeWhile = /*#__PURE__*/asyncIterableCurry(__asyncTakeWhile); exports.asyncTakeWhile = asyncTakeWhile; -},{"../../internal/async-iterable.js":460,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],377:[function(require,module,exports){ +},{"../../internal/async-iterable.js":480,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],393:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _marked = /*#__PURE__*/_regeneratorRuntime.mark(__takeWhile); @@ -54765,7 +55595,7 @@ function __takeWhile(source, predicate) { exports.__takeWhile = __takeWhile; var takeWhile = /*#__PURE__*/iterableCurry(__takeWhile); exports.takeWhile = takeWhile; -},{"../../internal/iterable.js":473,"@babel/runtime/regenerator":65}],378:[function(require,module,exports){ +},{"../../internal/iterable.js":493,"@babel/runtime/regenerator":65}],394:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _awaitAsyncGenerator = require("@babel/runtime/helpers/awaitAsyncGenerator"); @@ -54890,7 +55720,7 @@ function _asyncTake() { var asyncTake = /*#__PURE__*/asyncIterableCurry(__asyncTake); exports.asyncTake = asyncTake; -},{"../../internal/async-iterable.js":460,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],379:[function(require,module,exports){ +},{"../../internal/async-iterable.js":480,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],395:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _marked = /*#__PURE__*/_regeneratorRuntime.mark(__take); @@ -54975,7 +55805,7 @@ function __take(iterable, n) { exports.__take = __take; var take = /*#__PURE__*/iterableCurry(__take); exports.take = take; -},{"../../internal/iterable.js":473,"@babel/runtime/regenerator":65}],380:[function(require,module,exports){ +},{"../../internal/iterable.js":493,"@babel/runtime/regenerator":65}],396:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _awaitAsyncGenerator = require("@babel/runtime/helpers/awaitAsyncGenerator"); @@ -55085,7 +55915,7 @@ function _asyncTap() { var asyncTap = /*#__PURE__*/asyncIterableCurry(__asyncTap); exports.asyncTap = asyncTap; -},{"../../internal/async-iterable.js":460,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],381:[function(require,module,exports){ +},{"../../internal/async-iterable.js":480,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],397:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _marked = /*#__PURE__*/_regeneratorRuntime.mark(__tap); @@ -55155,7 +55985,7 @@ function __tap(source, callback) { exports.__tap = __tap; var tap = /*#__PURE__*/iterableCurry(__tap); exports.tap = tap; -},{"../../internal/iterable.js":473,"@babel/runtime/regenerator":65}],382:[function(require,module,exports){ +},{"../../internal/iterable.js":493,"@babel/runtime/regenerator":65}],398:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator"); @@ -55267,7 +56097,7 @@ function asyncToArray(source) { } exports.asyncToArray = asyncToArray; -},{"../../internal/async-iterable.js":460,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/asyncToGenerator":43,"@babel/runtime/regenerator":65}],383:[function(require,module,exports){ +},{"../../internal/async-iterable.js":480,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/asyncToGenerator":43,"@babel/runtime/regenerator":65}],399:[function(require,module,exports){ function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } @@ -55304,7 +56134,7 @@ function toArray(source) { } exports.toArray = toArray; -},{"../../internal/iterable.js":473}],384:[function(require,module,exports){ +},{"../../internal/iterable.js":493}],400:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _slicedToArray = require("@babel/runtime/helpers/slicedToArray"); @@ -55431,7 +56261,7 @@ function asyncToObject(iterable, proto) { } exports.asyncToObject = asyncToObject; -},{"../../internal/async-iterable.js":460,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/asyncToGenerator":43,"@babel/runtime/helpers/slicedToArray":59,"@babel/runtime/regenerator":65}],385:[function(require,module,exports){ +},{"../../internal/async-iterable.js":480,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/asyncToGenerator":43,"@babel/runtime/helpers/slicedToArray":59,"@babel/runtime/regenerator":65}],401:[function(require,module,exports){ var _slicedToArray = require("@babel/runtime/helpers/slicedToArray"); function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } @@ -55474,7 +56304,7 @@ function toObject(iterable, proto) { } exports.toObject = toObject; -},{"../../internal/iterable.js":473,"@babel/runtime/helpers/slicedToArray":59}],386:[function(require,module,exports){ +},{"../../internal/iterable.js":493,"@babel/runtime/helpers/slicedToArray":59}],402:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _awaitAsyncGenerator = require("@babel/runtime/helpers/awaitAsyncGenerator"); @@ -55663,7 +56493,7 @@ var asyncWindowAhead = /*#__PURE__*/asyncIterableCurry(__asyncWindowAhead, { } }); exports.asyncWindowAhead = asyncWindowAhead; -},{"../../internal/async-iterable.js":460,"../../internal/circular-buffer.js":466,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],387:[function(require,module,exports){ +},{"../../internal/async-iterable.js":480,"../../internal/circular-buffer.js":486,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],403:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _marked = /*#__PURE__*/_regeneratorRuntime.mark(__windowAhead); @@ -55808,7 +56638,7 @@ var windowAhead = /*#__PURE__*/iterableCurry(__windowAhead, { } }); exports.windowAhead = windowAhead; -},{"../../internal/circular-buffer.js":466,"../../internal/iterable.js":473,"@babel/runtime/regenerator":65}],388:[function(require,module,exports){ +},{"../../internal/circular-buffer.js":486,"../../internal/iterable.js":493,"@babel/runtime/regenerator":65}],404:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _awaitAsyncGenerator = require("@babel/runtime/helpers/awaitAsyncGenerator"); @@ -55944,7 +56774,7 @@ var asyncWindowBehind = /*#__PURE__*/asyncIterableCurry(__asyncWindowBehind, { } }); exports.asyncWindowBehind = asyncWindowBehind; -},{"../../internal/async-iterable.js":460,"../../internal/circular-buffer.js":466,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],389:[function(require,module,exports){ +},{"../../internal/async-iterable.js":480,"../../internal/circular-buffer.js":486,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],405:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _marked = /*#__PURE__*/_regeneratorRuntime.mark(__windowBehind); @@ -56036,7 +56866,7 @@ var windowBehind = /*#__PURE__*/iterableCurry(__windowBehind, { } }); exports.windowBehind = windowBehind; -},{"../../internal/circular-buffer.js":466,"../../internal/iterable.js":473,"@babel/runtime/regenerator":65}],390:[function(require,module,exports){ +},{"../../internal/circular-buffer.js":486,"../../internal/iterable.js":493,"@babel/runtime/regenerator":65}],406:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _awaitAsyncGenerator = require("@babel/runtime/helpers/awaitAsyncGenerator"); @@ -56163,7 +56993,7 @@ var asyncWindow = /*#__PURE__*/asyncIterableCurry(__asyncWindow, { } }); exports.asyncWindow = asyncWindow; -},{"../../internal/async-iterable.js":460,"../../internal/circular-buffer.js":466,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],391:[function(require,module,exports){ +},{"../../internal/async-iterable.js":480,"../../internal/circular-buffer.js":486,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],407:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _marked = /*#__PURE__*/_regeneratorRuntime.mark(__window); @@ -56250,7 +57080,7 @@ var window = /*#__PURE__*/iterableCurry(__window, { } }); exports.window = window; -},{"../../internal/circular-buffer.js":466,"../../internal/iterable.js":473,"@babel/runtime/regenerator":65}],392:[function(require,module,exports){ +},{"../../internal/circular-buffer.js":486,"../../internal/iterable.js":493,"@babel/runtime/regenerator":65}],408:[function(require,module,exports){ var _require = require('../../internal/async-iterable.js'), asyncWrapWithIterableIterator = _require.asyncWrapWithIterableIterator; @@ -56260,7 +57090,7 @@ var _require2 = require('../../internal/async-wrap.js'), exports.__asyncWrap = __asyncWrap; var asyncWrap = /*#__PURE__*/asyncWrapWithIterableIterator(__asyncWrap); exports.asyncWrap = asyncWrap; -},{"../../internal/async-iterable.js":460,"../../internal/async-wrap.js":464}],393:[function(require,module,exports){ +},{"../../internal/async-iterable.js":480,"../../internal/async-wrap.js":484}],409:[function(require,module,exports){ var _require = require('../../internal/iterable.js'), wrapWithIterableIterator = _require.wrapWithIterableIterator; @@ -56270,7 +57100,7 @@ var _require2 = require('../../internal/wrap.js'), exports.__wrap = __wrap; var wrap = /*#__PURE__*/wrapWithIterableIterator(__wrap); exports.wrap = wrap; -},{"../../internal/iterable.js":473,"../../internal/wrap.js":479}],394:[function(require,module,exports){ +},{"../../internal/iterable.js":493,"../../internal/wrap.js":499}],410:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _awaitAsyncGenerator = require("@babel/runtime/helpers/awaitAsyncGenerator"); @@ -56376,7 +57206,7 @@ var asyncZipAll = /*#__PURE__*/asyncIterableCurry(__asyncZipAll, { maxArgs: 1 }); exports.asyncZipAll = asyncZipAll; -},{"../$every/every.js":275,"../$map/async-map.js":321,"../$peekerate/async-peekerate.js":323,"../$to-array/async-to-array.js":382,"../../internal/async-iterable.js":460,"../../internal/async-parallel-each.js":461,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],395:[function(require,module,exports){ +},{"../$every/every.js":287,"../$map/async-map.js":337,"../$peekerate/async-peekerate.js":339,"../$to-array/async-to-array.js":398,"../../internal/async-iterable.js":480,"../../internal/async-parallel-each.js":481,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],411:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _marked = /*#__PURE__*/_regeneratorRuntime.mark(__zipAll); @@ -56462,7 +57292,7 @@ var zipAll = /*#__PURE__*/iterableCurry(__zipAll, { maxArgs: 1 }); exports.zipAll = zipAll; -},{"../$every/every.js":275,"../$map/map.js":322,"../$peekerate/peekerate.js":324,"../$to-array/to-array.js":383,"../../internal/iterable.js":473,"../../internal/parallel-each.js":475,"@babel/runtime/regenerator":65}],396:[function(require,module,exports){ +},{"../$every/every.js":287,"../$map/map.js":338,"../$peekerate/peekerate.js":340,"../$to-array/to-array.js":399,"../../internal/iterable.js":493,"../../internal/parallel-each.js":495,"@babel/runtime/regenerator":65}],412:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _awaitAsyncGenerator = require("@babel/runtime/helpers/awaitAsyncGenerator"); @@ -56562,7 +57392,7 @@ var asyncZip = /*#__PURE__*/asyncIterableCurry(__asyncZip, { variadic: true }); exports.asyncZip = asyncZip; -},{"../$map/async-map.js":321,"../$map/map.js":322,"../$peekerate/async-peekerate.js":323,"../$some/some.js":340,"../$to-array/async-to-array.js":382,"../../internal/async-iterable.js":460,"../../internal/async-parallel-each.js":461,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],397:[function(require,module,exports){ +},{"../$map/async-map.js":337,"../$map/map.js":338,"../$peekerate/async-peekerate.js":339,"../$some/some.js":356,"../$to-array/async-to-array.js":398,"../../internal/async-iterable.js":480,"../../internal/async-parallel-each.js":481,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],413:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _marked = /*#__PURE__*/_regeneratorRuntime.mark(__zip); @@ -56656,7 +57486,7 @@ var zip = /*#__PURE__*/iterableCurry(__zip, { variadic: true }); exports.zip = zip; -},{"../$map/map.js":322,"../$peekerate/peekerate.js":324,"../$some/some.js":340,"../$to-array/to-array.js":383,"../../internal/iterable.js":473,"../../internal/parallel-each.js":475,"@babel/runtime/regenerator":65}],398:[function(require,module,exports){ +},{"../$map/map.js":338,"../$peekerate/peekerate.js":340,"../$some/some.js":356,"../$to-array/to-array.js":399,"../../internal/iterable.js":493,"../../internal/parallel-each.js":495,"@babel/runtime/regenerator":65}],414:[function(require,module,exports){ var _toConsumableArray = require("@babel/runtime/helpers/toConsumableArray"); var _require = require('../../internal/curry.js'), @@ -56670,37 +57500,37 @@ function __apply(fn) { exports.__apply = __apply; var apply = /*#__PURE__*/curry(__apply, 2); exports.apply = apply; -},{"../../internal/curry.js":468,"@babel/runtime/helpers/toConsumableArray":61}],399:[function(require,module,exports){ +},{"../../internal/curry.js":488,"@babel/runtime/helpers/toConsumableArray":61}],415:[function(require,module,exports){ function arrayFirstOr(whenEmpty, array) { return array && array.length ? array[0] : whenEmpty; } exports.arrayFirstOr = arrayFirstOr; -},{}],400:[function(require,module,exports){ +},{}],416:[function(require,module,exports){ function arrayFirst(array) { return array != null ? array[0] : undefined; } exports.arrayFirst = arrayFirst; -},{}],401:[function(require,module,exports){ +},{}],417:[function(require,module,exports){ exports.__arrayFromAsync = require('../$to-array/async-to-array.js').__asyncToArray; exports.arrayFromAsync = require('../$to-array/async-to-array.js').asyncToArray; -},{"../$to-array/async-to-array.js":382}],402:[function(require,module,exports){ +},{"../$to-array/async-to-array.js":398}],418:[function(require,module,exports){ exports.__arrayFrom = require('../$to-array/to-array.js').__toArray; exports.arrayFrom = require('../$to-array/to-array.js').toArray; -},{"../$to-array/to-array.js":383}],403:[function(require,module,exports){ +},{"../$to-array/to-array.js":399}],419:[function(require,module,exports){ function arrayLastOr(whenEmpty, array) { return array && array.length ? array[array.length - 1] : whenEmpty; } exports.arrayLastOr = arrayLastOr; -},{}],404:[function(require,module,exports){ +},{}],420:[function(require,module,exports){ function arrayLast(array) { return array ? array[array.length - 1] : undefined; } exports.arrayLast = arrayLast; -},{}],405:[function(require,module,exports){ +},{}],421:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _marked = /*#__PURE__*/_regeneratorRuntime.mark(__arrayReverse); @@ -56755,7 +57585,7 @@ var arrayReverse = /*#__PURE__*/wrapWithIterableIterator(__arrayReverse, { } }); exports.arrayReverse = arrayReverse; -},{"../../internal/iterable.js":473,"@babel/runtime/regenerator":65}],406:[function(require,module,exports){ +},{"../../internal/iterable.js":493,"@babel/runtime/regenerator":65}],422:[function(require,module,exports){ var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator"); var _classCallCheck = require("@babel/runtime/helpers/classCallCheck"); @@ -56933,7 +57763,7 @@ var asyncBuffer = /*#__PURE__*/curry(function asyncBuffer(n, source) { return __asyncBuffer(source, n); }); exports.asyncBuffer = asyncBuffer; -},{"../../internal/async-iterable-iterator.js":459,"../../internal/async-iterable.js":460,"../../internal/circular-buffer.js":466,"../../internal/curry.js":468,"../../internal/iterable.js":473,"../../internal/number.js":474,"../is-async-iterable/is-async-iterable.js":415,"@babel/runtime/helpers/asyncToGenerator":43,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/classCallCheck":45,"@babel/runtime/helpers/createClass":47,"@babel/runtime/helpers/getPrototypeOf":50,"@babel/runtime/helpers/inherits":51,"@babel/runtime/helpers/possibleConstructorReturn":57,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],407:[function(require,module,exports){ +},{"../../internal/async-iterable-iterator.js":479,"../../internal/async-iterable.js":480,"../../internal/circular-buffer.js":486,"../../internal/curry.js":488,"../../internal/iterable.js":493,"../../internal/number.js":494,"../is-async-iterable/is-async-iterable.js":433,"@babel/runtime/helpers/asyncToGenerator":43,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/classCallCheck":45,"@babel/runtime/helpers/createClass":47,"@babel/runtime/helpers/getPrototypeOf":50,"@babel/runtime/helpers/inherits":51,"@babel/runtime/helpers/possibleConstructorReturn":57,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],423:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _awaitAsyncGenerator = require("@babel/runtime/helpers/awaitAsyncGenerator"); @@ -57033,7 +57863,7 @@ var asyncInterleaveReady = /*#__PURE__*/asyncIterableCurry(__asyncInterleaveRead variadic: true }); exports.asyncInterleaveReady = asyncInterleaveReady; -},{"../../internal/async-iterable.js":460,"./internal/race-to.js":408,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],408:[function(require,module,exports){ +},{"../../internal/async-iterable.js":480,"./internal/race-to.js":424,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],424:[function(require,module,exports){ function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } @@ -57081,7 +57911,7 @@ function raceTo(predicate, notFoundValue, promises) { } exports.raceTo = raceTo; -},{}],409:[function(require,module,exports){ +},{}],425:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _awaitAsyncGenerator = require("@babel/runtime/helpers/awaitAsyncGenerator"); @@ -57208,7 +58038,7 @@ var asyncThrottle = /*#__PURE__*/asyncIterableCurry(__asyncThrottle, { } }); exports.asyncThrottle = asyncThrottle; -},{"../../internal/async-iterable.js":460,"../../internal/delay.js":469,"../../internal/number.js":474,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],410:[function(require,module,exports){ +},{"../../internal/async-iterable.js":480,"../../internal/delay.js":489,"../../internal/number.js":494,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],426:[function(require,module,exports){ function __call(fn) { for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { args[_key - 1] = arguments[_key]; @@ -57220,7 +58050,7 @@ function __call(fn) { exports.__call = __call; var call = __call; exports.call = call; -},{}],411:[function(require,module,exports){ +},{}],427:[function(require,module,exports){ var identity = function identity(x) { return x; }; @@ -57239,7 +58069,7 @@ function compose() { } exports.compose = compose; -},{}],412:[function(require,module,exports){ +},{}],428:[function(require,module,exports){ function execPipe(initial) { for (var _len = arguments.length, fns = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { fns[_key - 1] = arguments[_key]; @@ -57251,7 +58081,19 @@ function execPipe(initial) { } exports.execPipe = execPipe; -},{}],413:[function(require,module,exports){ +},{}],429:[function(require,module,exports){ +function firstHighest(best, value) { + return value > best; +} + +exports.firstHighest = firstHighest; +},{}],430:[function(require,module,exports){ +function firstLowest(best, value) { + return value < best; +} + +exports.firstLowest = firstLowest; +},{}],431:[function(require,module,exports){ function getSize(sequence) { if (sequence == null) { return 0; @@ -57269,10 +58111,10 @@ function getSize(sequence) { } exports.getSize = getSize; -},{}],414:[function(require,module,exports){ +},{}],432:[function(require,module,exports){ var isArray = Array.isArray; exports.isArray = isArray; -},{}],415:[function(require,module,exports){ +},{}],433:[function(require,module,exports){ var _require = require('../not-undefined/not-undefined.js'), notUndefined = _require.notUndefined; @@ -57281,7 +58123,7 @@ function isAsyncIterable(value) { } exports.isAsyncIterable = isAsyncIterable; -},{"../not-undefined/not-undefined.js":436}],416:[function(require,module,exports){ +},{"../not-undefined/not-undefined.js":456}],434:[function(require,module,exports){ var _require = require('../not-undefined/not-undefined.js'), notUndefined = _require.notUndefined; @@ -57290,7 +58132,7 @@ function isAsyncLoopable(value) { } exports.isAsyncLoopable = isAsyncLoopable; -},{"../not-undefined/not-undefined.js":436}],417:[function(require,module,exports){ +},{"../not-undefined/not-undefined.js":456}],435:[function(require,module,exports){ var _require = require('../not-undefined/not-undefined.js'), notUndefined = _require.notUndefined; @@ -57299,7 +58141,7 @@ function isAsyncWrappable(value) { } exports.isAsyncWrappable = isAsyncWrappable; -},{"../not-undefined/not-undefined.js":436}],418:[function(require,module,exports){ +},{"../not-undefined/not-undefined.js":456}],436:[function(require,module,exports){ var _require = require('../not-undefined/not-undefined.js'), notUndefined = _require.notUndefined; @@ -57308,21 +58150,21 @@ function isIterable(value) { } exports.isIterable = isIterable; -},{"../not-undefined/not-undefined.js":436}],419:[function(require,module,exports){ +},{"../not-undefined/not-undefined.js":456}],437:[function(require,module,exports){ exports.isLoopable = require('../is-iterable/is-iterable.js').isIterable; -},{"../is-iterable/is-iterable.js":418}],420:[function(require,module,exports){ +},{"../is-iterable/is-iterable.js":436}],438:[function(require,module,exports){ function isNil(value) { return value == null; } exports.isNil = isNil; -},{}],421:[function(require,module,exports){ +},{}],439:[function(require,module,exports){ function isNull(value) { return value === null; } exports.isNull = isNull; -},{}],422:[function(require,module,exports){ +},{}],440:[function(require,module,exports){ var _typeof = require("@babel/runtime/helpers/typeof"); function isObject(value) { @@ -57330,19 +58172,19 @@ function isObject(value) { } exports.isObject = isObject; -},{"@babel/runtime/helpers/typeof":62}],423:[function(require,module,exports){ +},{"@babel/runtime/helpers/typeof":62}],441:[function(require,module,exports){ function isString(value) { return typeof value === 'string'; } exports.isString = isString; -},{}],424:[function(require,module,exports){ +},{}],442:[function(require,module,exports){ function isUndefined(value) { return typeof value === 'undefined'; } exports.isUndefined = isUndefined; -},{}],425:[function(require,module,exports){ +},{}],443:[function(require,module,exports){ var _require = require('../not-undefined/not-undefined.js'), notUndefined = _require.notUndefined; @@ -57351,7 +58193,19 @@ function isWrappable(value) { } exports.isWrappable = isWrappable; -},{"../not-undefined/not-undefined.js":436}],426:[function(require,module,exports){ +},{"../not-undefined/not-undefined.js":456}],444:[function(require,module,exports){ +function lastHighest(best, value) { + return value >= best; +} + +exports.lastHighest = lastHighest; +},{}],445:[function(require,module,exports){ +function lastLowest(best, value) { + return value <= best; +} + +exports.lastLowest = lastLowest; +},{}],446:[function(require,module,exports){ var isArray = Array.isArray; function notArray(value) { @@ -57359,7 +58213,7 @@ function notArray(value) { } exports.notArray = notArray; -},{}],427:[function(require,module,exports){ +},{}],447:[function(require,module,exports){ var _require = require('../is-undefined/is-undefined.js'), isUndefined = _require.isUndefined; @@ -57368,7 +58222,7 @@ function notAsyncIterable(value) { } exports.notAsyncIterable = notAsyncIterable; -},{"../is-undefined/is-undefined.js":424}],428:[function(require,module,exports){ +},{"../is-undefined/is-undefined.js":442}],448:[function(require,module,exports){ var _require = require('../is-undefined/is-undefined.js'), isUndefined = _require.isUndefined; @@ -57377,7 +58231,7 @@ function notAsyncLoopable(value) { } exports.notAsyncLoopable = notAsyncLoopable; -},{"../is-undefined/is-undefined.js":424}],429:[function(require,module,exports){ +},{"../is-undefined/is-undefined.js":442}],449:[function(require,module,exports){ var _require = require('../is-undefined/is-undefined.js'), isUndefined = _require.isUndefined; @@ -57386,7 +58240,7 @@ function notAsyncWrappable(value) { } exports.notAsyncWrappable = notAsyncWrappable; -},{"../is-undefined/is-undefined.js":424}],430:[function(require,module,exports){ +},{"../is-undefined/is-undefined.js":442}],450:[function(require,module,exports){ var _require = require('../is-undefined/is-undefined.js'), isUndefined = _require.isUndefined; @@ -57395,21 +58249,21 @@ function notIterable(value) { } exports.notIterable = notIterable; -},{"../is-undefined/is-undefined.js":424}],431:[function(require,module,exports){ +},{"../is-undefined/is-undefined.js":442}],451:[function(require,module,exports){ exports.notLoopable = require('../not-iterable/not-iterable.js').notIterable; -},{"../not-iterable/not-iterable.js":430}],432:[function(require,module,exports){ +},{"../not-iterable/not-iterable.js":450}],452:[function(require,module,exports){ function notNil(value) { return value != null; } exports.notNil = notNil; -},{}],433:[function(require,module,exports){ +},{}],453:[function(require,module,exports){ function notNull(value) { return value !== null; } exports.notNull = notNull; -},{}],434:[function(require,module,exports){ +},{}],454:[function(require,module,exports){ var _typeof = require("@babel/runtime/helpers/typeof"); function notObject(value) { @@ -57417,19 +58271,19 @@ function notObject(value) { } exports.notObject = notObject; -},{"@babel/runtime/helpers/typeof":62}],435:[function(require,module,exports){ +},{"@babel/runtime/helpers/typeof":62}],455:[function(require,module,exports){ function notString(value) { return typeof value !== 'string'; } exports.notString = notString; -},{}],436:[function(require,module,exports){ +},{}],456:[function(require,module,exports){ function notUndefined(value) { return typeof value !== 'undefined'; } exports.notUndefined = notUndefined; -},{}],437:[function(require,module,exports){ +},{}],457:[function(require,module,exports){ var _require = require('../is-undefined/is-undefined.js'), isUndefined = _require.isUndefined; @@ -57438,7 +58292,7 @@ function notWrappable(value) { } exports.notWrappable = notWrappable; -},{"../is-undefined/is-undefined.js":424}],438:[function(require,module,exports){ +},{"../is-undefined/is-undefined.js":442}],458:[function(require,module,exports){ var _typeof = require("@babel/runtime/helpers/typeof"); var _regeneratorRuntime = require("@babel/runtime/regenerator"); @@ -57503,13 +58357,13 @@ var objectEntries = /*#__PURE__*/wrapWithIterableIterator(__objectEntries, { } }); exports.objectEntries = objectEntries; -},{"../../internal/iterable.js":473,"@babel/runtime/helpers/typeof":62,"@babel/runtime/regenerator":65}],439:[function(require,module,exports){ +},{"../../internal/iterable.js":493,"@babel/runtime/helpers/typeof":62,"@babel/runtime/regenerator":65}],459:[function(require,module,exports){ exports.__objectFromAsync = require('../$to-object/async-to-object.js').__asyncToObject; exports.objectFromAsync = require('../$to-object/async-to-object.js').asyncToObject; -},{"../$to-object/async-to-object.js":384}],440:[function(require,module,exports){ +},{"../$to-object/async-to-object.js":400}],460:[function(require,module,exports){ exports.__objectFrom = require('../$to-object/to-object.js').__toObject; exports.objectFrom = require('../$to-object/to-object.js').toObject; -},{"../$to-object/to-object.js":385}],441:[function(require,module,exports){ +},{"../$to-object/to-object.js":401}],461:[function(require,module,exports){ var _typeof = require("@babel/runtime/helpers/typeof"); var _regeneratorRuntime = require("@babel/runtime/regenerator"); @@ -57574,7 +58428,7 @@ var objectKeys = /*#__PURE__*/wrapWithIterableIterator(__objectKeys, { } }); exports.objectKeys = objectKeys; -},{"../../internal/iterable.js":473,"@babel/runtime/helpers/typeof":62,"@babel/runtime/regenerator":65}],442:[function(require,module,exports){ +},{"../../internal/iterable.js":493,"@babel/runtime/helpers/typeof":62,"@babel/runtime/regenerator":65}],462:[function(require,module,exports){ var _typeof = require("@babel/runtime/helpers/typeof"); var _regeneratorRuntime = require("@babel/runtime/regenerator"); @@ -57639,7 +58493,7 @@ var objectValues = /*#__PURE__*/wrapWithIterableIterator(__objectValues, { } }); exports.objectValues = objectValues; -},{"../../internal/iterable.js":473,"@babel/runtime/helpers/typeof":62,"@babel/runtime/regenerator":65}],443:[function(require,module,exports){ +},{"../../internal/iterable.js":493,"@babel/runtime/helpers/typeof":62,"@babel/runtime/regenerator":65}],463:[function(require,module,exports){ var identity = function identity(x) { return x; }; @@ -57658,7 +58512,7 @@ function pipe() { } exports.pipe = pipe; -},{}],444:[function(require,module,exports){ +},{}],464:[function(require,module,exports){ var _slicedToArray = require("@babel/runtime/helpers/slicedToArray"); var _regeneratorRuntime = require("@babel/runtime/regenerator"); @@ -57757,7 +58611,7 @@ var range = /*#__PURE__*/wrapWithIterableIterator(__range, { } }); exports.range = range; -},{"../../internal/iterable.js":473,"../../internal/number.js":474,"../is-object/is-object.js":422,"../not-undefined/not-undefined.js":436,"@babel/runtime/helpers/slicedToArray":59,"@babel/runtime/regenerator":65}],445:[function(require,module,exports){ +},{"../../internal/iterable.js":493,"../../internal/number.js":494,"../is-object/is-object.js":440,"../not-undefined/not-undefined.js":456,"@babel/runtime/helpers/slicedToArray":59,"@babel/runtime/regenerator":65}],465:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _marked = /*#__PURE__*/_regeneratorRuntime.mark(__repeatTimes); @@ -57796,7 +58650,7 @@ function __repeatTimes(n, value) { exports.__repeatTimes = __repeatTimes; var repeatTimes = /*#__PURE__*/curry( /*#__PURE__*/wrapWithIterableIterator(__repeatTimes), __repeatTimes.length); exports.repeatTimes = repeatTimes; -},{"../../internal/curry.js":468,"../../internal/iterable.js":473,"@babel/runtime/regenerator":65}],446:[function(require,module,exports){ +},{"../../internal/curry.js":488,"../../internal/iterable.js":493,"@babel/runtime/regenerator":65}],466:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _marked = /*#__PURE__*/_regeneratorRuntime.mark(__repeat); @@ -57832,13 +58686,13 @@ function __repeat(value) { exports.__repeat = __repeat; var repeat = /*#__PURE__*/wrapWithIterableIterator(__repeat); exports.repeat = repeat; -},{"../../internal/iterable.js":473,"@babel/runtime/regenerator":65}],447:[function(require,module,exports){ +},{"../../internal/iterable.js":493,"@babel/runtime/regenerator":65}],467:[function(require,module,exports){ exports.__stringFromAsync = require('../$str/async-str.js').__asyncStr; exports.stringFromAsync = require('../$str/async-str.js').asyncStr; -},{"../$str/async-str.js":367}],448:[function(require,module,exports){ +},{"../$str/async-str.js":383}],468:[function(require,module,exports){ exports.__stringFrom = require('../$str/str.js').__str; exports.stringFrom = require('../$str/str.js').str; -},{"../$str/str.js":368}],449:[function(require,module,exports){ +},{"../$str/str.js":384}],469:[function(require,module,exports){ var _typeof = require("@babel/runtime/helpers/typeof"); var _defineProperty = require("@babel/runtime/helpers/defineProperty"); @@ -57866,7 +58720,7 @@ function when(condition, value) { } exports.when = when; -},{"@babel/runtime/helpers/defineProperty":48,"@babel/runtime/helpers/typeof":62}],450:[function(require,module,exports){ +},{"@babel/runtime/helpers/defineProperty":48,"@babel/runtime/helpers/typeof":62}],470:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _marked = /*#__PURE__*/_regeneratorRuntime.mark(__wrapEntries); @@ -57897,7 +58751,7 @@ function __wrapEntries(entriesable) { exports.__wrapEntries = __wrapEntries; var wrapEntries = /*#__PURE__*/wrapWithIterableIterator(__wrapEntries); exports.wrapEntries = wrapEntries; -},{"../../internal/iterable.js":473,"@babel/runtime/regenerator":65}],451:[function(require,module,exports){ +},{"../../internal/iterable.js":493,"@babel/runtime/regenerator":65}],471:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _marked = /*#__PURE__*/_regeneratorRuntime.mark(__wrapKeys); @@ -57928,7 +58782,7 @@ function __wrapKeys(keysable) { exports.__wrapKeys = __wrapKeys; var wrapKeys = /*#__PURE__*/wrapWithIterableIterator(__wrapKeys); exports.wrapKeys = wrapKeys; -},{"../../internal/iterable.js":473,"@babel/runtime/regenerator":65}],452:[function(require,module,exports){ +},{"../../internal/iterable.js":493,"@babel/runtime/regenerator":65}],472:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _marked = /*#__PURE__*/_regeneratorRuntime.mark(__wrapValues); @@ -57959,7 +58813,7 @@ function __wrapValues(valuesable) { exports.__wrapValues = __wrapValues; var wrapValues = /*#__PURE__*/wrapWithIterableIterator(__wrapValues); exports.wrapValues = wrapValues; -},{"../../internal/iterable.js":473,"@babel/runtime/regenerator":65}],453:[function(require,module,exports){ +},{"../../internal/iterable.js":493,"@babel/runtime/regenerator":65}],473:[function(require,module,exports){ exports.__append = require('./__methods/append.js'); exports.__apply = require('./__methods/apply.js'); exports.__arrayReverse = require('./__methods/array-reverse.js'); @@ -57974,6 +58828,7 @@ exports.__asyncConsume = require('./__methods/async-consume.js'); exports.__asyncCycle = require('./__methods/async-cycle.js'); exports.__asyncCycleTimes = require('./__methods/async-cycle-times.js'); exports.__asyncDeepEqual = require('./__methods/async-deep-equal.js'); +exports.__asyncDistinct = require('./__methods/async-distinct.js'); exports.__asyncDrop = require('./__methods/async-drop.js'); exports.__asyncDropWhile = require('./__methods/async-drop-while.js'); exports.__asyncEnumerate = require('./__methods/async-enumerate.js'); @@ -57981,6 +58836,8 @@ exports.__asyncEqual = require('./__methods/async-equal.js'); exports.__asyncEvery = require('./__methods/async-every.js'); exports.__asyncFilter = require('./__methods/async-filter.js'); exports.__asyncFind = require('./__methods/async-find.js'); +exports.__asyncFindBest = require('./__methods/async-find-best.js'); +exports.__asyncFindBestOr = require('./__methods/async-find-best-or.js'); exports.__asyncFindOr = require('./__methods/async-find-or.js'); exports.__asyncFirst = require('./__methods/async-first.js'); exports.__asyncFirstOr = require('./__methods/async-first-or.js'); @@ -58049,6 +58906,7 @@ exports.__consume = require('./__methods/consume.js'); exports.__cycle = require('./__methods/cycle.js'); exports.__cycleTimes = require('./__methods/cycle-times.js'); exports.__deepEqual = require('./__methods/deep-equal.js'); +exports.__distinct = require('./__methods/distinct.js'); exports.__drop = require('./__methods/drop.js'); exports.__dropWhile = require('./__methods/drop-while.js'); exports.__enumerate = require('./__methods/enumerate.js'); @@ -58056,6 +58914,8 @@ exports.__equal = require('./__methods/equal.js'); exports.__every = require('./__methods/every.js'); exports.__filter = require('./__methods/filter.js'); exports.__find = require('./__methods/find.js'); +exports.__findBest = require('./__methods/find-best.js'); +exports.__findBestOr = require('./__methods/find-best-or.js'); exports.__findOr = require('./__methods/find-or.js'); exports.__first = require('./__methods/first.js'); exports.__firstOr = require('./__methods/first-or.js'); @@ -58141,6 +59001,7 @@ exports.consume = require('./methods/consume.js'); exports.cycle = require('./methods/cycle.js'); exports.cycleTimes = require('./methods/cycle-times.js'); exports.deepEqual = require('./methods/deep-equal.js'); +exports.distinct = require('./methods/distinct.js'); exports.drop = require('./methods/drop.js'); exports.dropWhile = require('./methods/drop-while.js'); exports.enumerate = require('./methods/enumerate.js'); @@ -58149,8 +59010,12 @@ exports.every = require('./methods/every.js'); exports.execPipe = require('./methods/exec-pipe.js'); exports.filter = require('./methods/filter.js'); exports.find = require('./methods/find.js'); +exports.findBest = require('./methods/find-best.js'); +exports.findBestOr = require('./methods/find-best-or.js'); exports.findOr = require('./methods/find-or.js'); exports.first = require('./methods/first.js'); +exports.firstHighest = require('./methods/first-highest.js'); +exports.firstLowest = require('./methods/first-lowest.js'); exports.firstOr = require('./methods/first-or.js'); exports.flat = require('./methods/flat.js'); exports.flatMap = require('./methods/flat-map.js'); @@ -58182,6 +59047,8 @@ exports.isWrappable = require('./methods/is-wrappable.js'); exports.join = require('./methods/join.js'); exports.joinWith = require('./methods/join-with.js'); exports.joinWithSeq = require('./methods/join-with-seq.js'); +exports.lastHighest = require('./methods/last-highest.js'); +exports.lastLowest = require('./methods/last-lowest.js'); exports.map = require('./methods/map.js'); exports.notArray = require('./methods/not-array.js'); exports.notAsyncIterable = require('./methods/not-async-iterable.js'); @@ -58257,6 +59124,7 @@ exports.asyncConsume = require('./methods/async-consume.js'); exports.asyncCycle = require('./methods/async-cycle.js'); exports.asyncCycleTimes = require('./methods/async-cycle-times.js'); exports.asyncDeepEqual = require('./methods/async-deep-equal.js'); +exports.asyncDistinct = require('./methods/async-distinct.js'); exports.asyncDrop = require('./methods/async-drop.js'); exports.asyncDropWhile = require('./methods/async-drop-while.js'); exports.asyncEnumerate = require('./methods/async-enumerate.js'); @@ -58264,6 +59132,8 @@ exports.asyncEqual = require('./methods/async-equal.js'); exports.asyncEvery = require('./methods/async-every.js'); exports.asyncFilter = require('./methods/async-filter.js'); exports.asyncFind = require('./methods/async-find.js'); +exports.asyncFindBest = require('./methods/async-find-best.js'); +exports.asyncFindBestOr = require('./methods/async-find-best-or.js'); exports.asyncFindOr = require('./methods/async-find-or.js'); exports.asyncFirst = require('./methods/async-first.js'); exports.asyncFirstOr = require('./methods/async-first-or.js'); @@ -58323,7 +59193,7 @@ exports.asyncWindowBehind = require('./methods/async-window-behind.js'); exports.asyncWrap = require('./methods/async-wrap.js'); exports.asyncZip = require('./methods/async-zip.js'); exports.asyncZipAll = require('./methods/async-zip-all.js'); -},{"./__methods/append.js":85,"./__methods/apply.js":86,"./__methods/array-reverse.js":87,"./__methods/async-append.js":88,"./__methods/async-batch.js":89,"./__methods/async-bisect.js":90,"./__methods/async-buffer.js":91,"./__methods/async-collate.js":92,"./__methods/async-compress.js":93,"./__methods/async-concat.js":94,"./__methods/async-consume.js":95,"./__methods/async-cycle-times.js":96,"./__methods/async-cycle.js":97,"./__methods/async-deep-equal.js":98,"./__methods/async-drop-while.js":99,"./__methods/async-drop.js":100,"./__methods/async-enumerate.js":101,"./__methods/async-equal.js":102,"./__methods/async-every.js":103,"./__methods/async-filter.js":104,"./__methods/async-find-or.js":105,"./__methods/async-find.js":106,"./__methods/async-first-or.js":107,"./__methods/async-first.js":108,"./__methods/async-flat-map.js":109,"./__methods/async-flat.js":110,"./__methods/async-for-each.js":111,"./__methods/async-fork.js":112,"./__methods/async-forkerate.js":113,"./__methods/async-includes-any-seq.js":114,"./__methods/async-includes-any.js":115,"./__methods/async-includes-seq.js":116,"./__methods/async-includes.js":117,"./__methods/async-interleave-ready.js":118,"./__methods/async-interleave.js":119,"./__methods/async-interpose-seq.js":120,"./__methods/async-interpose.js":121,"./__methods/async-is-empty.js":122,"./__methods/async-is-sorted.js":123,"./__methods/async-join-with-seq.js":124,"./__methods/async-join-with.js":125,"./__methods/async-join.js":126,"./__methods/async-map.js":127,"./__methods/async-peekerate.js":128,"./__methods/async-prepend.js":129,"./__methods/async-reduce.js":130,"./__methods/async-reverse.js":131,"./__methods/async-round-robin.js":132,"./__methods/async-size.js":133,"./__methods/async-slice.js":134,"./__methods/async-some.js":135,"./__methods/async-split-groups.js":136,"./__methods/async-split-on-any-seq.js":137,"./__methods/async-split-on-any.js":138,"./__methods/async-split-on-seq.js":139,"./__methods/async-split-on.js":140,"./__methods/async-split-when.js":141,"./__methods/async-split.js":142,"./__methods/async-spliterate-grouped.js":143,"./__methods/async-spliterate.js":144,"./__methods/async-starts-with-any-seq.js":145,"./__methods/async-starts-with-any.js":146,"./__methods/async-starts-with-seq.js":147,"./__methods/async-starts-with.js":148,"./__methods/async-str.js":149,"./__methods/async-take-last-or.js":150,"./__methods/async-take-last.js":151,"./__methods/async-take-sorted.js":152,"./__methods/async-take-while.js":153,"./__methods/async-take.js":154,"./__methods/async-tap.js":155,"./__methods/async-throttle.js":156,"./__methods/async-to-array.js":157,"./__methods/async-to-object.js":158,"./__methods/async-window-ahead.js":159,"./__methods/async-window-behind.js":160,"./__methods/async-window.js":161,"./__methods/async-zip-all.js":162,"./__methods/async-zip.js":163,"./__methods/batch.js":164,"./__methods/bisect.js":165,"./__methods/call.js":166,"./__methods/collate.js":167,"./__methods/compress.js":168,"./__methods/concat.js":169,"./__methods/consume.js":170,"./__methods/cycle-times.js":171,"./__methods/cycle.js":172,"./__methods/deep-equal.js":173,"./__methods/drop-while.js":174,"./__methods/drop.js":175,"./__methods/enumerate.js":176,"./__methods/equal.js":177,"./__methods/every.js":178,"./__methods/filter.js":179,"./__methods/find-or.js":180,"./__methods/find.js":181,"./__methods/first-or.js":182,"./__methods/first.js":183,"./__methods/flat-map.js":184,"./__methods/flat.js":185,"./__methods/for-each.js":186,"./__methods/fork.js":187,"./__methods/forkerate.js":188,"./__methods/includes-any-seq.js":189,"./__methods/includes-any.js":190,"./__methods/includes-seq.js":191,"./__methods/includes.js":192,"./__methods/interleave.js":193,"./__methods/interpose-seq.js":194,"./__methods/interpose.js":195,"./__methods/is-empty.js":196,"./__methods/is-sorted.js":197,"./__methods/join-with-seq.js":198,"./__methods/join-with.js":199,"./__methods/join.js":200,"./__methods/map.js":201,"./__methods/object-entries.js":202,"./__methods/object-keys.js":203,"./__methods/object-values.js":204,"./__methods/peekerate.js":205,"./__methods/prepend.js":206,"./__methods/range.js":207,"./__methods/reduce.js":208,"./__methods/repeat-times.js":209,"./__methods/repeat.js":210,"./__methods/reverse.js":211,"./__methods/round-robin.js":212,"./__methods/size.js":213,"./__methods/slice.js":214,"./__methods/some.js":215,"./__methods/split-groups.js":216,"./__methods/split-on-any-seq.js":217,"./__methods/split-on-any.js":218,"./__methods/split-on-seq.js":219,"./__methods/split-on.js":220,"./__methods/split-when.js":221,"./__methods/split.js":222,"./__methods/spliterate-grouped.js":223,"./__methods/spliterate.js":224,"./__methods/starts-with-any-seq.js":225,"./__methods/starts-with-any.js":226,"./__methods/starts-with-seq.js":227,"./__methods/starts-with.js":228,"./__methods/str.js":229,"./__methods/take-last-or.js":230,"./__methods/take-last.js":231,"./__methods/take-sorted.js":232,"./__methods/take-while.js":233,"./__methods/take.js":234,"./__methods/tap.js":235,"./__methods/to-array.js":236,"./__methods/to-object.js":237,"./__methods/window-ahead.js":238,"./__methods/window-behind.js":239,"./__methods/window.js":240,"./__methods/wrap-entries.js":241,"./__methods/wrap-keys.js":242,"./__methods/wrap-values.js":243,"./__methods/zip-all.js":244,"./__methods/zip.js":245,"./methods/append.js":480,"./methods/apply.js":481,"./methods/array-first-or.js":482,"./methods/array-first.js":483,"./methods/array-from-async.js":484,"./methods/array-from.js":485,"./methods/array-last-or.js":486,"./methods/array-last.js":487,"./methods/array-reverse.js":488,"./methods/async-append.js":489,"./methods/async-batch.js":490,"./methods/async-bisect.js":491,"./methods/async-buffer.js":492,"./methods/async-collate.js":493,"./methods/async-compress.js":494,"./methods/async-concat.js":495,"./methods/async-consume.js":496,"./methods/async-cycle-times.js":497,"./methods/async-cycle.js":498,"./methods/async-deep-equal.js":499,"./methods/async-drop-while.js":500,"./methods/async-drop.js":501,"./methods/async-enumerate.js":502,"./methods/async-equal.js":503,"./methods/async-every.js":504,"./methods/async-filter.js":505,"./methods/async-find-or.js":506,"./methods/async-find.js":507,"./methods/async-first-or.js":508,"./methods/async-first.js":509,"./methods/async-flat-map.js":510,"./methods/async-flat.js":511,"./methods/async-for-each.js":512,"./methods/async-fork.js":513,"./methods/async-forkerate.js":514,"./methods/async-includes-any-seq.js":515,"./methods/async-includes-any.js":516,"./methods/async-includes-seq.js":517,"./methods/async-includes.js":518,"./methods/async-interleave-ready.js":519,"./methods/async-interleave.js":520,"./methods/async-interpose-seq.js":521,"./methods/async-interpose.js":522,"./methods/async-is-empty.js":523,"./methods/async-is-sorted.js":524,"./methods/async-join-with-seq.js":525,"./methods/async-join-with.js":526,"./methods/async-join.js":527,"./methods/async-map.js":528,"./methods/async-peekerate.js":529,"./methods/async-prepend.js":530,"./methods/async-reduce.js":531,"./methods/async-reverse.js":532,"./methods/async-round-robin.js":533,"./methods/async-size.js":534,"./methods/async-slice.js":535,"./methods/async-some.js":536,"./methods/async-split-groups.js":537,"./methods/async-split-on-any-seq.js":538,"./methods/async-split-on-any.js":539,"./methods/async-split-on-seq.js":540,"./methods/async-split-on.js":541,"./methods/async-split-when.js":542,"./methods/async-split.js":543,"./methods/async-spliterate-grouped.js":544,"./methods/async-spliterate.js":545,"./methods/async-starts-with-any-seq.js":546,"./methods/async-starts-with-any.js":547,"./methods/async-starts-with-seq.js":548,"./methods/async-starts-with.js":549,"./methods/async-str.js":550,"./methods/async-take-last-or.js":551,"./methods/async-take-last.js":552,"./methods/async-take-sorted.js":553,"./methods/async-take-while.js":554,"./methods/async-take.js":555,"./methods/async-tap.js":556,"./methods/async-throttle.js":557,"./methods/async-to-array.js":558,"./methods/async-to-object.js":559,"./methods/async-window-ahead.js":560,"./methods/async-window-behind.js":561,"./methods/async-window.js":562,"./methods/async-wrap.js":563,"./methods/async-zip-all.js":564,"./methods/async-zip.js":565,"./methods/batch.js":566,"./methods/bisect.js":567,"./methods/call.js":568,"./methods/collate.js":569,"./methods/compose.js":570,"./methods/compress.js":571,"./methods/concat.js":572,"./methods/consume.js":573,"./methods/cycle-times.js":574,"./methods/cycle.js":575,"./methods/deep-equal.js":576,"./methods/drop-while.js":577,"./methods/drop.js":578,"./methods/enumerate.js":579,"./methods/equal.js":580,"./methods/every.js":581,"./methods/exec-pipe.js":582,"./methods/filter.js":583,"./methods/find-or.js":584,"./methods/find.js":585,"./methods/first-or.js":586,"./methods/first.js":587,"./methods/flat-map.js":588,"./methods/flat.js":589,"./methods/for-each.js":590,"./methods/fork.js":591,"./methods/forkerate.js":592,"./methods/get-size.js":593,"./methods/includes-any-seq.js":594,"./methods/includes-any.js":595,"./methods/includes-seq.js":596,"./methods/includes.js":597,"./methods/interleave.js":598,"./methods/interpose-seq.js":599,"./methods/interpose.js":600,"./methods/is-array.js":601,"./methods/is-async-iterable.js":602,"./methods/is-async-loopable.js":603,"./methods/is-async-wrappable.js":604,"./methods/is-empty.js":605,"./methods/is-iterable.js":606,"./methods/is-loopable.js":607,"./methods/is-nil.js":608,"./methods/is-null.js":609,"./methods/is-object.js":610,"./methods/is-sorted.js":611,"./methods/is-string.js":612,"./methods/is-undefined.js":613,"./methods/is-wrappable.js":614,"./methods/join-with-seq.js":615,"./methods/join-with.js":616,"./methods/join.js":617,"./methods/map.js":618,"./methods/not-array.js":619,"./methods/not-async-iterable.js":620,"./methods/not-async-loopable.js":621,"./methods/not-async-wrappable.js":622,"./methods/not-iterable.js":623,"./methods/not-loopable.js":624,"./methods/not-nil.js":625,"./methods/not-null.js":626,"./methods/not-object.js":627,"./methods/not-string.js":628,"./methods/not-undefined.js":629,"./methods/not-wrappable.js":630,"./methods/object-entries.js":631,"./methods/object-from-async.js":632,"./methods/object-from.js":633,"./methods/object-keys.js":634,"./methods/object-values.js":635,"./methods/peekerate.js":636,"./methods/pipe.js":637,"./methods/prepend.js":638,"./methods/range.js":639,"./methods/reduce.js":640,"./methods/repeat-times.js":641,"./methods/repeat.js":642,"./methods/reverse.js":643,"./methods/round-robin.js":644,"./methods/size.js":645,"./methods/slice.js":646,"./methods/some.js":647,"./methods/split-groups.js":648,"./methods/split-on-any-seq.js":649,"./methods/split-on-any.js":650,"./methods/split-on-seq.js":651,"./methods/split-on.js":652,"./methods/split-when.js":653,"./methods/split.js":654,"./methods/spliterate-grouped.js":655,"./methods/spliterate.js":656,"./methods/starts-with-any-seq.js":657,"./methods/starts-with-any.js":658,"./methods/starts-with-seq.js":659,"./methods/starts-with.js":660,"./methods/str.js":661,"./methods/string-from-async.js":662,"./methods/string-from.js":663,"./methods/take-last-or.js":664,"./methods/take-last.js":665,"./methods/take-sorted.js":666,"./methods/take-while.js":667,"./methods/take.js":668,"./methods/tap.js":669,"./methods/to-array.js":670,"./methods/to-object.js":671,"./methods/when.js":672,"./methods/window-ahead.js":673,"./methods/window-behind.js":674,"./methods/window.js":675,"./methods/wrap-entries.js":676,"./methods/wrap-keys.js":677,"./methods/wrap-values.js":678,"./methods/wrap.js":679,"./methods/zip-all.js":680,"./methods/zip.js":681}],454:[function(require,module,exports){ +},{"./__methods/append.js":89,"./__methods/apply.js":90,"./__methods/array-reverse.js":91,"./__methods/async-append.js":92,"./__methods/async-batch.js":93,"./__methods/async-bisect.js":94,"./__methods/async-buffer.js":95,"./__methods/async-collate.js":96,"./__methods/async-compress.js":97,"./__methods/async-concat.js":98,"./__methods/async-consume.js":99,"./__methods/async-cycle-times.js":100,"./__methods/async-cycle.js":101,"./__methods/async-deep-equal.js":102,"./__methods/async-distinct.js":103,"./__methods/async-drop-while.js":104,"./__methods/async-drop.js":105,"./__methods/async-enumerate.js":106,"./__methods/async-equal.js":107,"./__methods/async-every.js":108,"./__methods/async-filter.js":109,"./__methods/async-find-best-or.js":110,"./__methods/async-find-best.js":111,"./__methods/async-find-or.js":112,"./__methods/async-find.js":113,"./__methods/async-first-or.js":114,"./__methods/async-first.js":115,"./__methods/async-flat-map.js":116,"./__methods/async-flat.js":117,"./__methods/async-for-each.js":118,"./__methods/async-fork.js":119,"./__methods/async-forkerate.js":120,"./__methods/async-includes-any-seq.js":121,"./__methods/async-includes-any.js":122,"./__methods/async-includes-seq.js":123,"./__methods/async-includes.js":124,"./__methods/async-interleave-ready.js":125,"./__methods/async-interleave.js":126,"./__methods/async-interpose-seq.js":127,"./__methods/async-interpose.js":128,"./__methods/async-is-empty.js":129,"./__methods/async-is-sorted.js":130,"./__methods/async-join-with-seq.js":131,"./__methods/async-join-with.js":132,"./__methods/async-join.js":133,"./__methods/async-map.js":134,"./__methods/async-peekerate.js":135,"./__methods/async-prepend.js":136,"./__methods/async-reduce.js":137,"./__methods/async-reverse.js":138,"./__methods/async-round-robin.js":139,"./__methods/async-size.js":140,"./__methods/async-slice.js":141,"./__methods/async-some.js":142,"./__methods/async-split-groups.js":143,"./__methods/async-split-on-any-seq.js":144,"./__methods/async-split-on-any.js":145,"./__methods/async-split-on-seq.js":146,"./__methods/async-split-on.js":147,"./__methods/async-split-when.js":148,"./__methods/async-split.js":149,"./__methods/async-spliterate-grouped.js":150,"./__methods/async-spliterate.js":151,"./__methods/async-starts-with-any-seq.js":152,"./__methods/async-starts-with-any.js":153,"./__methods/async-starts-with-seq.js":154,"./__methods/async-starts-with.js":155,"./__methods/async-str.js":156,"./__methods/async-take-last-or.js":157,"./__methods/async-take-last.js":158,"./__methods/async-take-sorted.js":159,"./__methods/async-take-while.js":160,"./__methods/async-take.js":161,"./__methods/async-tap.js":162,"./__methods/async-throttle.js":163,"./__methods/async-to-array.js":164,"./__methods/async-to-object.js":165,"./__methods/async-window-ahead.js":166,"./__methods/async-window-behind.js":167,"./__methods/async-window.js":168,"./__methods/async-zip-all.js":169,"./__methods/async-zip.js":170,"./__methods/batch.js":171,"./__methods/bisect.js":172,"./__methods/call.js":173,"./__methods/collate.js":174,"./__methods/compress.js":175,"./__methods/concat.js":176,"./__methods/consume.js":177,"./__methods/cycle-times.js":178,"./__methods/cycle.js":179,"./__methods/deep-equal.js":180,"./__methods/distinct.js":181,"./__methods/drop-while.js":182,"./__methods/drop.js":183,"./__methods/enumerate.js":184,"./__methods/equal.js":185,"./__methods/every.js":186,"./__methods/filter.js":187,"./__methods/find-best-or.js":188,"./__methods/find-best.js":189,"./__methods/find-or.js":190,"./__methods/find.js":191,"./__methods/first-or.js":192,"./__methods/first.js":193,"./__methods/flat-map.js":194,"./__methods/flat.js":195,"./__methods/for-each.js":196,"./__methods/fork.js":197,"./__methods/forkerate.js":198,"./__methods/includes-any-seq.js":199,"./__methods/includes-any.js":200,"./__methods/includes-seq.js":201,"./__methods/includes.js":202,"./__methods/interleave.js":203,"./__methods/interpose-seq.js":204,"./__methods/interpose.js":205,"./__methods/is-empty.js":206,"./__methods/is-sorted.js":207,"./__methods/join-with-seq.js":208,"./__methods/join-with.js":209,"./__methods/join.js":210,"./__methods/map.js":211,"./__methods/object-entries.js":212,"./__methods/object-keys.js":213,"./__methods/object-values.js":214,"./__methods/peekerate.js":215,"./__methods/prepend.js":216,"./__methods/range.js":217,"./__methods/reduce.js":218,"./__methods/repeat-times.js":219,"./__methods/repeat.js":220,"./__methods/reverse.js":221,"./__methods/round-robin.js":222,"./__methods/size.js":223,"./__methods/slice.js":224,"./__methods/some.js":225,"./__methods/split-groups.js":226,"./__methods/split-on-any-seq.js":227,"./__methods/split-on-any.js":228,"./__methods/split-on-seq.js":229,"./__methods/split-on.js":230,"./__methods/split-when.js":231,"./__methods/split.js":232,"./__methods/spliterate-grouped.js":233,"./__methods/spliterate.js":234,"./__methods/starts-with-any-seq.js":235,"./__methods/starts-with-any.js":236,"./__methods/starts-with-seq.js":237,"./__methods/starts-with.js":238,"./__methods/str.js":239,"./__methods/take-last-or.js":240,"./__methods/take-last.js":241,"./__methods/take-sorted.js":242,"./__methods/take-while.js":243,"./__methods/take.js":244,"./__methods/tap.js":245,"./__methods/to-array.js":246,"./__methods/to-object.js":247,"./__methods/window-ahead.js":248,"./__methods/window-behind.js":249,"./__methods/window.js":250,"./__methods/wrap-entries.js":251,"./__methods/wrap-keys.js":252,"./__methods/wrap-values.js":253,"./__methods/zip-all.js":254,"./__methods/zip.js":255,"./methods/append.js":500,"./methods/apply.js":501,"./methods/array-first-or.js":502,"./methods/array-first.js":503,"./methods/array-from-async.js":504,"./methods/array-from.js":505,"./methods/array-last-or.js":506,"./methods/array-last.js":507,"./methods/array-reverse.js":508,"./methods/async-append.js":509,"./methods/async-batch.js":510,"./methods/async-bisect.js":511,"./methods/async-buffer.js":512,"./methods/async-collate.js":513,"./methods/async-compress.js":514,"./methods/async-concat.js":515,"./methods/async-consume.js":516,"./methods/async-cycle-times.js":517,"./methods/async-cycle.js":518,"./methods/async-deep-equal.js":519,"./methods/async-distinct.js":520,"./methods/async-drop-while.js":521,"./methods/async-drop.js":522,"./methods/async-enumerate.js":523,"./methods/async-equal.js":524,"./methods/async-every.js":525,"./methods/async-filter.js":526,"./methods/async-find-best-or.js":527,"./methods/async-find-best.js":528,"./methods/async-find-or.js":529,"./methods/async-find.js":530,"./methods/async-first-or.js":531,"./methods/async-first.js":532,"./methods/async-flat-map.js":533,"./methods/async-flat.js":534,"./methods/async-for-each.js":535,"./methods/async-fork.js":536,"./methods/async-forkerate.js":537,"./methods/async-includes-any-seq.js":538,"./methods/async-includes-any.js":539,"./methods/async-includes-seq.js":540,"./methods/async-includes.js":541,"./methods/async-interleave-ready.js":542,"./methods/async-interleave.js":543,"./methods/async-interpose-seq.js":544,"./methods/async-interpose.js":545,"./methods/async-is-empty.js":546,"./methods/async-is-sorted.js":547,"./methods/async-join-with-seq.js":548,"./methods/async-join-with.js":549,"./methods/async-join.js":550,"./methods/async-map.js":551,"./methods/async-peekerate.js":552,"./methods/async-prepend.js":553,"./methods/async-reduce.js":554,"./methods/async-reverse.js":555,"./methods/async-round-robin.js":556,"./methods/async-size.js":557,"./methods/async-slice.js":558,"./methods/async-some.js":559,"./methods/async-split-groups.js":560,"./methods/async-split-on-any-seq.js":561,"./methods/async-split-on-any.js":562,"./methods/async-split-on-seq.js":563,"./methods/async-split-on.js":564,"./methods/async-split-when.js":565,"./methods/async-split.js":566,"./methods/async-spliterate-grouped.js":567,"./methods/async-spliterate.js":568,"./methods/async-starts-with-any-seq.js":569,"./methods/async-starts-with-any.js":570,"./methods/async-starts-with-seq.js":571,"./methods/async-starts-with.js":572,"./methods/async-str.js":573,"./methods/async-take-last-or.js":574,"./methods/async-take-last.js":575,"./methods/async-take-sorted.js":576,"./methods/async-take-while.js":577,"./methods/async-take.js":578,"./methods/async-tap.js":579,"./methods/async-throttle.js":580,"./methods/async-to-array.js":581,"./methods/async-to-object.js":582,"./methods/async-window-ahead.js":583,"./methods/async-window-behind.js":584,"./methods/async-window.js":585,"./methods/async-wrap.js":586,"./methods/async-zip-all.js":587,"./methods/async-zip.js":588,"./methods/batch.js":589,"./methods/bisect.js":590,"./methods/call.js":591,"./methods/collate.js":592,"./methods/compose.js":593,"./methods/compress.js":594,"./methods/concat.js":595,"./methods/consume.js":596,"./methods/cycle-times.js":597,"./methods/cycle.js":598,"./methods/deep-equal.js":599,"./methods/distinct.js":600,"./methods/drop-while.js":601,"./methods/drop.js":602,"./methods/enumerate.js":603,"./methods/equal.js":604,"./methods/every.js":605,"./methods/exec-pipe.js":606,"./methods/filter.js":607,"./methods/find-best-or.js":608,"./methods/find-best.js":609,"./methods/find-or.js":610,"./methods/find.js":611,"./methods/first-highest.js":612,"./methods/first-lowest.js":613,"./methods/first-or.js":614,"./methods/first.js":615,"./methods/flat-map.js":616,"./methods/flat.js":617,"./methods/for-each.js":618,"./methods/fork.js":619,"./methods/forkerate.js":620,"./methods/get-size.js":621,"./methods/includes-any-seq.js":622,"./methods/includes-any.js":623,"./methods/includes-seq.js":624,"./methods/includes.js":625,"./methods/interleave.js":626,"./methods/interpose-seq.js":627,"./methods/interpose.js":628,"./methods/is-array.js":629,"./methods/is-async-iterable.js":630,"./methods/is-async-loopable.js":631,"./methods/is-async-wrappable.js":632,"./methods/is-empty.js":633,"./methods/is-iterable.js":634,"./methods/is-loopable.js":635,"./methods/is-nil.js":636,"./methods/is-null.js":637,"./methods/is-object.js":638,"./methods/is-sorted.js":639,"./methods/is-string.js":640,"./methods/is-undefined.js":641,"./methods/is-wrappable.js":642,"./methods/join-with-seq.js":643,"./methods/join-with.js":644,"./methods/join.js":645,"./methods/last-highest.js":646,"./methods/last-lowest.js":647,"./methods/map.js":648,"./methods/not-array.js":649,"./methods/not-async-iterable.js":650,"./methods/not-async-loopable.js":651,"./methods/not-async-wrappable.js":652,"./methods/not-iterable.js":653,"./methods/not-loopable.js":654,"./methods/not-nil.js":655,"./methods/not-null.js":656,"./methods/not-object.js":657,"./methods/not-string.js":658,"./methods/not-undefined.js":659,"./methods/not-wrappable.js":660,"./methods/object-entries.js":661,"./methods/object-from-async.js":662,"./methods/object-from.js":663,"./methods/object-keys.js":664,"./methods/object-values.js":665,"./methods/peekerate.js":666,"./methods/pipe.js":667,"./methods/prepend.js":668,"./methods/range.js":669,"./methods/reduce.js":670,"./methods/repeat-times.js":671,"./methods/repeat.js":672,"./methods/reverse.js":673,"./methods/round-robin.js":674,"./methods/size.js":675,"./methods/slice.js":676,"./methods/some.js":677,"./methods/split-groups.js":678,"./methods/split-on-any-seq.js":679,"./methods/split-on-any.js":680,"./methods/split-on-seq.js":681,"./methods/split-on.js":682,"./methods/split-when.js":683,"./methods/split.js":684,"./methods/spliterate-grouped.js":685,"./methods/spliterate.js":686,"./methods/starts-with-any-seq.js":687,"./methods/starts-with-any.js":688,"./methods/starts-with-seq.js":689,"./methods/starts-with.js":690,"./methods/str.js":691,"./methods/string-from-async.js":692,"./methods/string-from.js":693,"./methods/take-last-or.js":694,"./methods/take-last.js":695,"./methods/take-sorted.js":696,"./methods/take-while.js":697,"./methods/take.js":698,"./methods/tap.js":699,"./methods/to-array.js":700,"./methods/to-object.js":701,"./methods/when.js":702,"./methods/window-ahead.js":703,"./methods/window-behind.js":704,"./methods/window.js":705,"./methods/wrap-entries.js":706,"./methods/wrap-keys.js":707,"./methods/wrap-values.js":708,"./methods/wrap.js":709,"./methods/zip-all.js":710,"./methods/zip.js":711}],474:[function(require,module,exports){ var _require = require('./iterable.js'), ensureIterable = _require.ensureIterable; @@ -58342,7 +59212,7 @@ function seqsToArray(values) { } exports.seqsToArray = seqsToArray; -},{"../impls/$map/map.js":322,"../impls/$to-array/to-array.js":383,"./iterable.js":473}],455:[function(require,module,exports){ +},{"../impls/$map/map.js":338,"../impls/$to-array/to-array.js":399,"./iterable.js":493}],475:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator"); @@ -58387,7 +59257,7 @@ function _asyncSeqsToArray() { } exports.asyncSeqsToArray = asyncSeqsToArray; -},{"../impls/$map/async-map.js":321,"../impls/$to-array/async-to-array.js":382,"./async-iterable.js":460,"@babel/runtime/helpers/asyncToGenerator":43,"@babel/runtime/regenerator":65}],456:[function(require,module,exports){ +},{"../impls/$map/async-map.js":337,"../impls/$to-array/async-to-array.js":398,"./async-iterable.js":480,"@babel/runtime/helpers/asyncToGenerator":43,"@babel/runtime/regenerator":65}],476:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator"); @@ -58563,7 +59433,7 @@ var AsyncBisector = /*#__PURE__*/function (_IterableIterator) { }(IterableIterator); exports.AsyncBisector = AsyncBisector; -},{"./async-parts-iterator.js":462,"./iterable-iterator.js":472,"@babel/runtime/helpers/asyncGeneratorDelegate":41,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/asyncToGenerator":43,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/classCallCheck":45,"@babel/runtime/helpers/createClass":47,"@babel/runtime/helpers/getPrototypeOf":50,"@babel/runtime/helpers/inherits":51,"@babel/runtime/helpers/possibleConstructorReturn":57,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],457:[function(require,module,exports){ +},{"./async-parts-iterator.js":482,"./iterable-iterator.js":492,"@babel/runtime/helpers/asyncGeneratorDelegate":41,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/asyncToGenerator":43,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/classCallCheck":45,"@babel/runtime/helpers/createClass":47,"@babel/runtime/helpers/getPrototypeOf":50,"@babel/runtime/helpers/inherits":51,"@babel/runtime/helpers/possibleConstructorReturn":57,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],477:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator"); @@ -58686,6 +59556,12 @@ var AsyncFork = /*#__PURE__*/function (_AsyncIterableIterato) { return exchange["return"](); case 4: + return _context2.abrupt("return", { + value: undefined, + done: true + }); + + case 5: case "end": return _context2.stop(); } @@ -58775,6 +59651,12 @@ var AsyncExchange = /*#__PURE__*/function () { return asyncCallReturn(this.iterator); case 4: + return _context4.abrupt("return", { + value: undefined, + done: true + }); + + case 5: case "end": return _context4.stop(); } @@ -58794,7 +59676,7 @@ var AsyncExchange = /*#__PURE__*/function () { }(); exports.AsyncExchange = AsyncExchange; -},{"./async-iterable-iterator.js":459,"./async-iterable.js":460,"@babel/runtime/helpers/asyncToGenerator":43,"@babel/runtime/helpers/classCallCheck":45,"@babel/runtime/helpers/createClass":47,"@babel/runtime/helpers/getPrototypeOf":50,"@babel/runtime/helpers/inherits":51,"@babel/runtime/helpers/possibleConstructorReturn":57,"@babel/runtime/regenerator":65}],458:[function(require,module,exports){ +},{"./async-iterable-iterator.js":479,"./async-iterable.js":480,"@babel/runtime/helpers/asyncToGenerator":43,"@babel/runtime/helpers/classCallCheck":45,"@babel/runtime/helpers/createClass":47,"@babel/runtime/helpers/getPrototypeOf":50,"@babel/runtime/helpers/inherits":51,"@babel/runtime/helpers/possibleConstructorReturn":57,"@babel/runtime/regenerator":65}],478:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator"); @@ -58932,7 +59814,7 @@ var AsyncGroupsIterator = /*#__PURE__*/function (_AsyncPartsIterator) { }(AsyncPartsIterator); exports.AsyncGroupsIterator = AsyncGroupsIterator; -},{"./async-parts-iterator.js":462,"./symbols.js":478,"@babel/runtime/helpers/asyncToGenerator":43,"@babel/runtime/helpers/classCallCheck":45,"@babel/runtime/helpers/createClass":47,"@babel/runtime/helpers/getPrototypeOf":50,"@babel/runtime/helpers/inherits":51,"@babel/runtime/helpers/possibleConstructorReturn":57,"@babel/runtime/regenerator":65}],459:[function(require,module,exports){ +},{"./async-parts-iterator.js":482,"./symbols.js":498,"@babel/runtime/helpers/asyncToGenerator":43,"@babel/runtime/helpers/classCallCheck":45,"@babel/runtime/helpers/createClass":47,"@babel/runtime/helpers/getPrototypeOf":50,"@babel/runtime/helpers/inherits":51,"@babel/runtime/helpers/possibleConstructorReturn":57,"@babel/runtime/regenerator":65}],479:[function(require,module,exports){ var _classCallCheck = require("@babel/runtime/helpers/classCallCheck"); var _createClass = require("@babel/runtime/helpers/createClass"); @@ -58953,7 +59835,7 @@ var AsyncIterableIterator = /*#__PURE__*/function () { }(); exports.AsyncIterableIterator = AsyncIterableIterator; -},{"@babel/runtime/helpers/classCallCheck":45,"@babel/runtime/helpers/createClass":47}],460:[function(require,module,exports){ +},{"@babel/runtime/helpers/classCallCheck":45,"@babel/runtime/helpers/createClass":47}],480:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator"); @@ -59202,7 +60084,7 @@ var asyncIterableCurry = function asyncIterableCurry(fn, config) { }; exports.asyncIterableCurry = asyncIterableCurry; -},{"../impls/is-async-iterable/is-async-iterable.js":415,"../impls/is-async-loopable/is-async-loopable.js":416,"../impls/is-async-wrappable/is-async-wrappable.js":417,"./async-wrap.js":464,"./curry.js":468,"./iterable.js":473,"./symbols.js":478,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/asyncToGenerator":43,"@babel/runtime/helpers/defineProperty":48,"@babel/runtime/regenerator":65}],461:[function(require,module,exports){ +},{"../impls/is-async-iterable/is-async-iterable.js":433,"../impls/is-async-loopable/is-async-loopable.js":434,"../impls/is-async-wrappable/is-async-wrappable.js":435,"./async-wrap.js":484,"./curry.js":488,"./iterable.js":493,"./symbols.js":498,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/asyncToGenerator":43,"@babel/runtime/helpers/defineProperty":48,"@babel/runtime/regenerator":65}],481:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _marked = /*#__PURE__*/_regeneratorRuntime.mark(map); @@ -59269,7 +60151,7 @@ function asyncParallelEach(iterable, cb) { } exports.asyncParallelEach = asyncParallelEach; -},{"@babel/runtime/regenerator":65}],462:[function(require,module,exports){ +},{"@babel/runtime/regenerator":65}],482:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator"); @@ -59668,7 +60550,7 @@ var AsyncPartsIterator = /*#__PURE__*/function (_AsyncIterableIterato2) { }(AsyncIterableIterator); exports.AsyncPartsIterator = AsyncPartsIterator; -},{"./async-iterable-iterator.js":459,"./async-peekerator.js":463,"./symbols.js":478,"@babel/runtime/helpers/asyncToGenerator":43,"@babel/runtime/helpers/classCallCheck":45,"@babel/runtime/helpers/createClass":47,"@babel/runtime/helpers/getPrototypeOf":50,"@babel/runtime/helpers/inherits":51,"@babel/runtime/helpers/possibleConstructorReturn":57,"@babel/runtime/regenerator":65}],463:[function(require,module,exports){ +},{"./async-iterable-iterator.js":479,"./async-peekerator.js":483,"./symbols.js":498,"@babel/runtime/helpers/asyncToGenerator":43,"@babel/runtime/helpers/classCallCheck":45,"@babel/runtime/helpers/createClass":47,"@babel/runtime/helpers/getPrototypeOf":50,"@babel/runtime/helpers/inherits":51,"@babel/runtime/helpers/possibleConstructorReturn":57,"@babel/runtime/regenerator":65}],483:[function(require,module,exports){ var _construct = require("@babel/runtime/helpers/construct"); var _regeneratorRuntime = require("@babel/runtime/regenerator"); @@ -59735,6 +60617,12 @@ var AsyncPeekeratorIterator = /*#__PURE__*/function () { return this.peekr["return"](); case 2: + return _context2.abrupt("return", { + value: undefined, + done: true + }); + + case 3: case "end": return _context2.stop(); } @@ -59924,7 +60812,7 @@ var AsyncPeekerator = /*#__PURE__*/function () { }(); exports.AsyncPeekerator = AsyncPeekerator; -},{"./async-iterable.js":460,"@babel/runtime/helpers/asyncToGenerator":43,"@babel/runtime/helpers/classCallCheck":45,"@babel/runtime/helpers/construct":46,"@babel/runtime/helpers/createClass":47,"@babel/runtime/regenerator":65}],464:[function(require,module,exports){ +},{"./async-iterable.js":480,"@babel/runtime/helpers/asyncToGenerator":43,"@babel/runtime/helpers/classCallCheck":45,"@babel/runtime/helpers/construct":46,"@babel/runtime/helpers/createClass":47,"@babel/runtime/regenerator":65}],484:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _wrapAsyncGenerator = require("@babel/runtime/helpers/wrapAsyncGenerator"); @@ -59987,7 +60875,7 @@ function _asyncNullableWrap() { })); return _asyncNullableWrap.apply(this, arguments); } -},{"@babel/runtime/helpers/asyncGeneratorDelegate":41,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],465:[function(require,module,exports){ +},{"@babel/runtime/helpers/asyncGeneratorDelegate":41,"@babel/runtime/helpers/asyncIterator":42,"@babel/runtime/helpers/awaitAsyncGenerator":44,"@babel/runtime/helpers/wrapAsyncGenerator":64,"@babel/runtime/regenerator":65}],485:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _classCallCheck = require("@babel/runtime/helpers/classCallCheck"); @@ -60118,7 +61006,7 @@ var Bisector = /*#__PURE__*/function (_IterableIterator) { }(IterableIterator); exports.Bisector = Bisector; -},{"./iterable-iterator.js":472,"./parts-iterator.js":476,"@babel/runtime/helpers/classCallCheck":45,"@babel/runtime/helpers/createClass":47,"@babel/runtime/helpers/getPrototypeOf":50,"@babel/runtime/helpers/inherits":51,"@babel/runtime/helpers/possibleConstructorReturn":57,"@babel/runtime/regenerator":65}],466:[function(require,module,exports){ +},{"./iterable-iterator.js":492,"./parts-iterator.js":496,"@babel/runtime/helpers/classCallCheck":45,"@babel/runtime/helpers/createClass":47,"@babel/runtime/helpers/getPrototypeOf":50,"@babel/runtime/helpers/inherits":51,"@babel/runtime/helpers/possibleConstructorReturn":57,"@babel/runtime/regenerator":65}],486:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _classCallCheck = require("@babel/runtime/helpers/classCallCheck"); @@ -60271,7 +61159,7 @@ var CircularBuffer = /*#__PURE__*/function () { }(); exports.CircularBuffer = CircularBuffer; -},{"@babel/runtime/helpers/classCallCheck":45,"@babel/runtime/helpers/createClass":47,"@babel/runtime/regenerator":65}],467:[function(require,module,exports){ +},{"@babel/runtime/helpers/classCallCheck":45,"@babel/runtime/helpers/createClass":47,"@babel/runtime/regenerator":65}],487:[function(require,module,exports){ function defaultCompareOrder(a, b) { if (a > b) { return 1; @@ -60283,7 +61171,7 @@ function defaultCompareOrder(a, b) { } exports.defaultCompareOrder = defaultCompareOrder; -},{}],468:[function(require,module,exports){ +},{}],488:[function(require,module,exports){ var _toConsumableArray = require("@babel/runtime/helpers/toConsumableArray"); function curry(fn) { @@ -60381,7 +61269,7 @@ function variadicCurryWithValidation(config) { } exports.variadicCurryWithValidation = variadicCurryWithValidation; -},{"@babel/runtime/helpers/toConsumableArray":61}],469:[function(require,module,exports){ +},{"@babel/runtime/helpers/toConsumableArray":61}],489:[function(require,module,exports){ function delay(ms, output) { return new Promise(function (resolve, reject) { return setTimeout(function () { @@ -60395,7 +61283,7 @@ function delay(ms, output) { } exports.delay = delay; -},{}],470:[function(require,module,exports){ +},{}],490:[function(require,module,exports){ var _createClass = require("@babel/runtime/helpers/createClass"); var _inherits = require("@babel/runtime/helpers/inherits"); @@ -60468,6 +61356,10 @@ var Fork = /*#__PURE__*/function (_IterableIterator) { var done = this.done, exchange = this.exchange; if (!done) exchange["return"](); + return { + value: undefined, + done: true + }; } }]); @@ -60510,6 +61402,11 @@ var Exchange = /*#__PURE__*/function () { if (this.forks === 0) { callReturn(this.iterator); } + + return { + value: undefined, + done: true + }; } }]); @@ -60517,7 +61414,7 @@ var Exchange = /*#__PURE__*/function () { }(); exports.Exchange = Exchange; -},{"./iterable-iterator.js":472,"./iterable.js":473,"@babel/runtime/helpers/classCallCheck":45,"@babel/runtime/helpers/createClass":47,"@babel/runtime/helpers/getPrototypeOf":50,"@babel/runtime/helpers/inherits":51,"@babel/runtime/helpers/possibleConstructorReturn":57}],471:[function(require,module,exports){ +},{"./iterable-iterator.js":492,"./iterable.js":493,"@babel/runtime/helpers/classCallCheck":45,"@babel/runtime/helpers/createClass":47,"@babel/runtime/helpers/getPrototypeOf":50,"@babel/runtime/helpers/inherits":51,"@babel/runtime/helpers/possibleConstructorReturn":57}],491:[function(require,module,exports){ var _classCallCheck = require("@babel/runtime/helpers/classCallCheck"); var _createClass = require("@babel/runtime/helpers/createClass"); @@ -60594,7 +61491,7 @@ var GroupsIterator = /*#__PURE__*/function (_PartsIterator) { }(PartsIterator); exports.GroupsIterator = GroupsIterator; -},{"./parts-iterator.js":476,"./symbols.js":478,"@babel/runtime/helpers/classCallCheck":45,"@babel/runtime/helpers/createClass":47,"@babel/runtime/helpers/getPrototypeOf":50,"@babel/runtime/helpers/inherits":51,"@babel/runtime/helpers/possibleConstructorReturn":57}],472:[function(require,module,exports){ +},{"./parts-iterator.js":496,"./symbols.js":498,"@babel/runtime/helpers/classCallCheck":45,"@babel/runtime/helpers/createClass":47,"@babel/runtime/helpers/getPrototypeOf":50,"@babel/runtime/helpers/inherits":51,"@babel/runtime/helpers/possibleConstructorReturn":57}],492:[function(require,module,exports){ var _classCallCheck = require("@babel/runtime/helpers/classCallCheck"); var _createClass = require("@babel/runtime/helpers/createClass"); @@ -60615,7 +61512,7 @@ var IterableIterator = /*#__PURE__*/function () { }(); exports.IterableIterator = IterableIterator; -},{"@babel/runtime/helpers/classCallCheck":45,"@babel/runtime/helpers/createClass":47}],473:[function(require,module,exports){ +},{"@babel/runtime/helpers/classCallCheck":45,"@babel/runtime/helpers/createClass":47}],493:[function(require,module,exports){ var _defineProperty = require("@babel/runtime/helpers/defineProperty"); var _toConsumableArray = require("@babel/runtime/helpers/toConsumableArray"); @@ -60772,7 +61669,7 @@ var iterableCurry = function iterableCurry(fn, config) { }; exports.iterableCurry = iterableCurry; -},{"../impls/is-iterable/is-iterable.js":418,"../impls/is-loopable/is-loopable.js":419,"../impls/is-wrappable/is-wrappable.js":425,"./curry.js":468,"./symbols.js":478,"./wrap.js":479,"@babel/runtime/helpers/defineProperty":48,"@babel/runtime/helpers/toConsumableArray":61}],474:[function(require,module,exports){ +},{"../impls/is-iterable/is-iterable.js":436,"../impls/is-loopable/is-loopable.js":437,"../impls/is-wrappable/is-wrappable.js":443,"./curry.js":488,"./symbols.js":498,"./wrap.js":499,"@babel/runtime/helpers/defineProperty":48,"@babel/runtime/helpers/toConsumableArray":61}],494:[function(require,module,exports){ function isInteger(value) { var nonZero = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; return typeof value === 'number' && !isNaN(value) && isFinite(value) && !(nonZero && value === 0); @@ -60793,7 +61690,7 @@ function isIntegerOrInfinite(value) { } exports.isIntegerOrInfinite = isIntegerOrInfinite; -},{}],475:[function(require,module,exports){ +},{}],495:[function(require,module,exports){ function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } @@ -60817,7 +61714,7 @@ function parallelEach(iterable, cb) { } exports.parallelEach = parallelEach; -},{}],476:[function(require,module,exports){ +},{}],496:[function(require,module,exports){ var _classCallCheck = require("@babel/runtime/helpers/classCallCheck"); var _createClass = require("@babel/runtime/helpers/createClass"); @@ -60997,7 +61894,7 @@ var PartsIterator = /*#__PURE__*/function (_IterableIterator2) { }(IterableIterator); exports.PartsIterator = PartsIterator; -},{"./iterable-iterator.js":472,"./peekerator.js":477,"./symbols.js":478,"@babel/runtime/helpers/classCallCheck":45,"@babel/runtime/helpers/createClass":47,"@babel/runtime/helpers/getPrototypeOf":50,"@babel/runtime/helpers/inherits":51,"@babel/runtime/helpers/possibleConstructorReturn":57}],477:[function(require,module,exports){ +},{"./iterable-iterator.js":492,"./peekerator.js":497,"./symbols.js":498,"@babel/runtime/helpers/classCallCheck":45,"@babel/runtime/helpers/createClass":47,"@babel/runtime/helpers/getPrototypeOf":50,"@babel/runtime/helpers/inherits":51,"@babel/runtime/helpers/possibleConstructorReturn":57}],497:[function(require,module,exports){ var _construct = require("@babel/runtime/helpers/construct"); var _classCallCheck = require("@babel/runtime/helpers/classCallCheck"); @@ -61029,6 +61926,10 @@ var PeekeratorIterator = /*#__PURE__*/function () { key: "return", value: function _return() { this.peekr["return"](); + return { + value: undefined, + done: true + }; } }, { key: Symbol.iterator, @@ -61123,7 +62024,7 @@ var Peekerator = /*#__PURE__*/function () { }(); exports.Peekerator = Peekerator; -},{"./iterable.js":473,"@babel/runtime/helpers/classCallCheck":45,"@babel/runtime/helpers/construct":46,"@babel/runtime/helpers/createClass":47}],478:[function(require,module,exports){ +},{"./iterable.js":493,"@babel/runtime/helpers/classCallCheck":45,"@babel/runtime/helpers/construct":46,"@babel/runtime/helpers/createClass":47}],498:[function(require,module,exports){ var _ = Symbol["for"]('_'); exports._ = _; @@ -61133,7 +62034,7 @@ var __iterate = Symbol('__iterate'); exports.__iterate = __iterate; var split = Symbol('split'); exports.split = split; -},{}],479:[function(require,module,exports){ +},{}],499:[function(require,module,exports){ var _regeneratorRuntime = require("@babel/runtime/regenerator"); var _marked = /*#__PURE__*/_regeneratorRuntime.mark(wrap), @@ -61177,411 +62078,431 @@ function nullableWrap(source) { } exports.nullableWrap = nullableWrap; -},{"@babel/runtime/regenerator":65}],480:[function(require,module,exports){ +},{"@babel/runtime/regenerator":65}],500:[function(require,module,exports){ module.exports = require('../impls/$append/append.js').append; -},{"../impls/$append/append.js":246}],481:[function(require,module,exports){ +},{"../impls/$append/append.js":256}],501:[function(require,module,exports){ module.exports = require('../impls/apply/apply.js').apply; -},{"../impls/apply/apply.js":398}],482:[function(require,module,exports){ +},{"../impls/apply/apply.js":414}],502:[function(require,module,exports){ module.exports = require('../impls/array-first-or/array-first-or.js').arrayFirstOr; -},{"../impls/array-first-or/array-first-or.js":399}],483:[function(require,module,exports){ +},{"../impls/array-first-or/array-first-or.js":415}],503:[function(require,module,exports){ module.exports = require('../impls/array-first/array-first.js').arrayFirst; -},{"../impls/array-first/array-first.js":400}],484:[function(require,module,exports){ +},{"../impls/array-first/array-first.js":416}],504:[function(require,module,exports){ module.exports = require('../impls/array-from-async/array-from-async.js').arrayFromAsync; -},{"../impls/array-from-async/array-from-async.js":401}],485:[function(require,module,exports){ +},{"../impls/array-from-async/array-from-async.js":417}],505:[function(require,module,exports){ module.exports = require('../impls/array-from/array-from.js').arrayFrom; -},{"../impls/array-from/array-from.js":402}],486:[function(require,module,exports){ +},{"../impls/array-from/array-from.js":418}],506:[function(require,module,exports){ module.exports = require('../impls/array-last-or/array-last-or.js').arrayLastOr; -},{"../impls/array-last-or/array-last-or.js":403}],487:[function(require,module,exports){ +},{"../impls/array-last-or/array-last-or.js":419}],507:[function(require,module,exports){ module.exports = require('../impls/array-last/array-last.js').arrayLast; -},{"../impls/array-last/array-last.js":404}],488:[function(require,module,exports){ +},{"../impls/array-last/array-last.js":420}],508:[function(require,module,exports){ module.exports = require('../impls/array-reverse/array-reverse.js').arrayReverse; -},{"../impls/array-reverse/array-reverse.js":405}],489:[function(require,module,exports){ +},{"../impls/array-reverse/array-reverse.js":421}],509:[function(require,module,exports){ module.exports = require('../impls/$append/async-append.js').asyncAppend; -},{"../impls/$append/async-append.js":247}],490:[function(require,module,exports){ +},{"../impls/$append/async-append.js":257}],510:[function(require,module,exports){ module.exports = require('../impls/$batch/async-batch.js').asyncBatch; -},{"../impls/$batch/async-batch.js":248}],491:[function(require,module,exports){ +},{"../impls/$batch/async-batch.js":258}],511:[function(require,module,exports){ module.exports = require('../impls/$bisect/async-bisect.js').asyncBisect; -},{"../impls/$bisect/async-bisect.js":250}],492:[function(require,module,exports){ +},{"../impls/$bisect/async-bisect.js":260}],512:[function(require,module,exports){ module.exports = require('../impls/async-buffer/async-buffer.js').asyncBuffer; -},{"../impls/async-buffer/async-buffer.js":406}],493:[function(require,module,exports){ +},{"../impls/async-buffer/async-buffer.js":422}],513:[function(require,module,exports){ module.exports = require('../impls/$collate/async-collate.js').asyncCollate; -},{"../impls/$collate/async-collate.js":252}],494:[function(require,module,exports){ +},{"../impls/$collate/async-collate.js":262}],514:[function(require,module,exports){ module.exports = require('../impls/$compress/async-compress.js').asyncCompress; -},{"../impls/$compress/async-compress.js":254}],495:[function(require,module,exports){ +},{"../impls/$compress/async-compress.js":264}],515:[function(require,module,exports){ module.exports = require('../impls/$concat/async-concat.js').asyncConcat; -},{"../impls/$concat/async-concat.js":256}],496:[function(require,module,exports){ +},{"../impls/$concat/async-concat.js":266}],516:[function(require,module,exports){ module.exports = require('../impls/$consume/async-consume.js').asyncConsume; -},{"../impls/$consume/async-consume.js":258}],497:[function(require,module,exports){ +},{"../impls/$consume/async-consume.js":268}],517:[function(require,module,exports){ module.exports = require('../impls/$cycle-times/async-cycle-times.js').asyncCycleTimes; -},{"../impls/$cycle-times/async-cycle-times.js":260}],498:[function(require,module,exports){ +},{"../impls/$cycle-times/async-cycle-times.js":270}],518:[function(require,module,exports){ module.exports = require('../impls/$cycle/async-cycle.js').asyncCycle; -},{"../impls/$cycle/async-cycle.js":262}],499:[function(require,module,exports){ +},{"../impls/$cycle/async-cycle.js":272}],519:[function(require,module,exports){ module.exports = require('../impls/$deep-equal/async-deep-equal.js').asyncDeepEqual; -},{"../impls/$deep-equal/async-deep-equal.js":264}],500:[function(require,module,exports){ +},{"../impls/$deep-equal/async-deep-equal.js":274}],520:[function(require,module,exports){ +module.exports = require('../impls/$distinct/async-distinct.js').asyncDistinct; +},{"../impls/$distinct/async-distinct.js":276}],521:[function(require,module,exports){ module.exports = require('../impls/$drop-while/async-drop-while.js').asyncDropWhile; -},{"../impls/$drop-while/async-drop-while.js":266}],501:[function(require,module,exports){ +},{"../impls/$drop-while/async-drop-while.js":278}],522:[function(require,module,exports){ module.exports = require('../impls/$drop/async-drop.js').asyncDrop; -},{"../impls/$drop/async-drop.js":268}],502:[function(require,module,exports){ +},{"../impls/$drop/async-drop.js":280}],523:[function(require,module,exports){ module.exports = require('../impls/$enumerate/async-enumerate.js').asyncEnumerate; -},{"../impls/$enumerate/async-enumerate.js":270}],503:[function(require,module,exports){ +},{"../impls/$enumerate/async-enumerate.js":282}],524:[function(require,module,exports){ module.exports = require('../impls/$equal/async-equal.js').asyncEqual; -},{"../impls/$equal/async-equal.js":272}],504:[function(require,module,exports){ +},{"../impls/$equal/async-equal.js":284}],525:[function(require,module,exports){ module.exports = require('../impls/$every/async-every.js').asyncEvery; -},{"../impls/$every/async-every.js":274}],505:[function(require,module,exports){ +},{"../impls/$every/async-every.js":286}],526:[function(require,module,exports){ module.exports = require('../impls/$filter/async-filter.js').asyncFilter; -},{"../impls/$filter/async-filter.js":276}],506:[function(require,module,exports){ +},{"../impls/$filter/async-filter.js":288}],527:[function(require,module,exports){ +module.exports = require('../impls/$find-best-or/async-find-best-or.js').asyncFindBestOr; +},{"../impls/$find-best-or/async-find-best-or.js":290}],528:[function(require,module,exports){ +module.exports = require('../impls/$find-best/async-find-best.js').asyncFindBest; +},{"../impls/$find-best/async-find-best.js":292}],529:[function(require,module,exports){ module.exports = require('../impls/$find-or/async-find-or.js').asyncFindOr; -},{"../impls/$find-or/async-find-or.js":278}],507:[function(require,module,exports){ +},{"../impls/$find-or/async-find-or.js":294}],530:[function(require,module,exports){ module.exports = require('../impls/$find/async-find.js').asyncFind; -},{"../impls/$find/async-find.js":280}],508:[function(require,module,exports){ +},{"../impls/$find/async-find.js":296}],531:[function(require,module,exports){ module.exports = require('../impls/$first-or/async-first-or.js').asyncFirstOr; -},{"../impls/$first-or/async-first-or.js":282}],509:[function(require,module,exports){ +},{"../impls/$first-or/async-first-or.js":298}],532:[function(require,module,exports){ module.exports = require('../impls/$first/async-first.js').asyncFirst; -},{"../impls/$first/async-first.js":284}],510:[function(require,module,exports){ +},{"../impls/$first/async-first.js":300}],533:[function(require,module,exports){ module.exports = require('../impls/$flat-map/async-flat-map.js').asyncFlatMap; -},{"../impls/$flat-map/async-flat-map.js":286}],511:[function(require,module,exports){ +},{"../impls/$flat-map/async-flat-map.js":302}],534:[function(require,module,exports){ module.exports = require('../impls/$flat/async-flat.js').asyncFlat; -},{"../impls/$flat/async-flat.js":288}],512:[function(require,module,exports){ +},{"../impls/$flat/async-flat.js":304}],535:[function(require,module,exports){ module.exports = require('../impls/$for-each/async-for-each.js').asyncForEach; -},{"../impls/$for-each/async-for-each.js":291}],513:[function(require,module,exports){ +},{"../impls/$for-each/async-for-each.js":307}],536:[function(require,module,exports){ module.exports = require('../impls/$fork/async-fork.js').asyncFork; -},{"../impls/$fork/async-fork.js":293}],514:[function(require,module,exports){ +},{"../impls/$fork/async-fork.js":309}],537:[function(require,module,exports){ module.exports = require('../impls/$forkerate/async-forkerate.js').asyncForkerate; -},{"../impls/$forkerate/async-forkerate.js":295}],515:[function(require,module,exports){ +},{"../impls/$forkerate/async-forkerate.js":311}],538:[function(require,module,exports){ module.exports = require('../impls/$includes-any-seq/async-includes-any-seq.js').asyncIncludesAnySeq; -},{"../impls/$includes-any-seq/async-includes-any-seq.js":297}],516:[function(require,module,exports){ +},{"../impls/$includes-any-seq/async-includes-any-seq.js":313}],539:[function(require,module,exports){ module.exports = require('../impls/$includes-any/async-includes-any.js').asyncIncludesAny; -},{"../impls/$includes-any/async-includes-any.js":299}],517:[function(require,module,exports){ +},{"../impls/$includes-any/async-includes-any.js":315}],540:[function(require,module,exports){ module.exports = require('../impls/$includes-seq/async-includes-seq.js').asyncIncludesSeq; -},{"../impls/$includes-seq/async-includes-seq.js":301}],518:[function(require,module,exports){ +},{"../impls/$includes-seq/async-includes-seq.js":317}],541:[function(require,module,exports){ module.exports = require('../impls/$includes/async-includes.js').asyncIncludes; -},{"../impls/$includes/async-includes.js":303}],519:[function(require,module,exports){ +},{"../impls/$includes/async-includes.js":319}],542:[function(require,module,exports){ module.exports = require('../impls/async-interleave-ready/async-interleave-ready.js').asyncInterleaveReady; -},{"../impls/async-interleave-ready/async-interleave-ready.js":407}],520:[function(require,module,exports){ +},{"../impls/async-interleave-ready/async-interleave-ready.js":423}],543:[function(require,module,exports){ module.exports = require('../impls/$interleave/async-interleave.js').asyncInterleave; -},{"../impls/$interleave/async-interleave.js":305}],521:[function(require,module,exports){ +},{"../impls/$interleave/async-interleave.js":321}],544:[function(require,module,exports){ module.exports = require('../impls/$interpose-seq/async-interpose-seq.js').asyncInterposeSeq; -},{"../impls/$interpose-seq/async-interpose-seq.js":307}],522:[function(require,module,exports){ +},{"../impls/$interpose-seq/async-interpose-seq.js":323}],545:[function(require,module,exports){ module.exports = require('../impls/$interpose/async-interpose.js').asyncInterpose; -},{"../impls/$interpose/async-interpose.js":309}],523:[function(require,module,exports){ +},{"../impls/$interpose/async-interpose.js":325}],546:[function(require,module,exports){ module.exports = require('../impls/$is-empty/async-is-empty.js').asyncIsEmpty; -},{"../impls/$is-empty/async-is-empty.js":311}],524:[function(require,module,exports){ +},{"../impls/$is-empty/async-is-empty.js":327}],547:[function(require,module,exports){ module.exports = require('../impls/$is-sorted/async-is-sorted.js').asyncIsSorted; -},{"../impls/$is-sorted/async-is-sorted.js":313}],525:[function(require,module,exports){ +},{"../impls/$is-sorted/async-is-sorted.js":329}],548:[function(require,module,exports){ module.exports = require('../impls/$join-with-seq/async-join-with-seq.js').asyncJoinWithSeq; -},{"../impls/$join-with-seq/async-join-with-seq.js":315}],526:[function(require,module,exports){ +},{"../impls/$join-with-seq/async-join-with-seq.js":331}],549:[function(require,module,exports){ module.exports = require('../impls/$join-with/async-join-with.js').asyncJoinWith; -},{"../impls/$join-with/async-join-with.js":317}],527:[function(require,module,exports){ +},{"../impls/$join-with/async-join-with.js":333}],550:[function(require,module,exports){ module.exports = require('../impls/$join/async-join.js').asyncJoin; -},{"../impls/$join/async-join.js":319}],528:[function(require,module,exports){ +},{"../impls/$join/async-join.js":335}],551:[function(require,module,exports){ module.exports = require('../impls/$map/async-map.js').asyncMap; -},{"../impls/$map/async-map.js":321}],529:[function(require,module,exports){ +},{"../impls/$map/async-map.js":337}],552:[function(require,module,exports){ module.exports = require('../impls/$peekerate/async-peekerate.js').asyncPeekerate; -},{"../impls/$peekerate/async-peekerate.js":323}],530:[function(require,module,exports){ +},{"../impls/$peekerate/async-peekerate.js":339}],553:[function(require,module,exports){ module.exports = require('../impls/$prepend/async-prepend.js').asyncPrepend; -},{"../impls/$prepend/async-prepend.js":325}],531:[function(require,module,exports){ +},{"../impls/$prepend/async-prepend.js":341}],554:[function(require,module,exports){ module.exports = require('../impls/$reduce/async-reduce.js').asyncReduce; -},{"../impls/$reduce/async-reduce.js":327}],532:[function(require,module,exports){ +},{"../impls/$reduce/async-reduce.js":343}],555:[function(require,module,exports){ module.exports = require('../impls/$reverse/async-reverse.js').asyncReverse; -},{"../impls/$reverse/async-reverse.js":329}],533:[function(require,module,exports){ +},{"../impls/$reverse/async-reverse.js":345}],556:[function(require,module,exports){ module.exports = require('../impls/$round-robin/async-round-robin.js').asyncRoundRobin; -},{"../impls/$round-robin/async-round-robin.js":331}],534:[function(require,module,exports){ +},{"../impls/$round-robin/async-round-robin.js":347}],557:[function(require,module,exports){ module.exports = require('../impls/$size/async-size.js').asyncSize; -},{"../impls/$size/async-size.js":334}],535:[function(require,module,exports){ +},{"../impls/$size/async-size.js":350}],558:[function(require,module,exports){ module.exports = require('../impls/$slice/async-slice.js').asyncSlice; -},{"../impls/$slice/async-slice.js":336}],536:[function(require,module,exports){ +},{"../impls/$slice/async-slice.js":352}],559:[function(require,module,exports){ module.exports = require('../impls/$some/async-some.js').asyncSome; -},{"../impls/$some/async-some.js":339}],537:[function(require,module,exports){ +},{"../impls/$some/async-some.js":355}],560:[function(require,module,exports){ module.exports = require('../impls/$split-groups/async-split-groups.js').asyncSplitGroups; -},{"../impls/$split-groups/async-split-groups.js":341}],538:[function(require,module,exports){ +},{"../impls/$split-groups/async-split-groups.js":357}],561:[function(require,module,exports){ module.exports = require('../impls/$split-on-any-seq/async-split-on-any-seq.js').asyncSplitOnAnySeq; -},{"../impls/$split-on-any-seq/async-split-on-any-seq.js":343}],539:[function(require,module,exports){ +},{"../impls/$split-on-any-seq/async-split-on-any-seq.js":359}],562:[function(require,module,exports){ module.exports = require('../impls/$split-on-any/async-split-on-any.js').asyncSplitOnAny; -},{"../impls/$split-on-any/async-split-on-any.js":345}],540:[function(require,module,exports){ +},{"../impls/$split-on-any/async-split-on-any.js":361}],563:[function(require,module,exports){ module.exports = require('../impls/$split-on-seq/async-split-on-seq.js').asyncSplitOnSeq; -},{"../impls/$split-on-seq/async-split-on-seq.js":347}],541:[function(require,module,exports){ +},{"../impls/$split-on-seq/async-split-on-seq.js":363}],564:[function(require,module,exports){ module.exports = require('../impls/$split-on/async-split-on.js').asyncSplitOn; -},{"../impls/$split-on/async-split-on.js":349}],542:[function(require,module,exports){ +},{"../impls/$split-on/async-split-on.js":365}],565:[function(require,module,exports){ module.exports = require('../impls/$split-when/async-split-when.js').asyncSplitWhen; -},{"../impls/$split-when/async-split-when.js":351}],543:[function(require,module,exports){ +},{"../impls/$split-when/async-split-when.js":367}],566:[function(require,module,exports){ module.exports = require('../impls/$split/async-split.js').asyncSplit; -},{"../impls/$split/async-split.js":353}],544:[function(require,module,exports){ +},{"../impls/$split/async-split.js":369}],567:[function(require,module,exports){ module.exports = require('../impls/$spliterate-grouped/async-spliterate-grouped.js').asyncSpliterateGrouped; -},{"../impls/$spliterate-grouped/async-spliterate-grouped.js":355}],545:[function(require,module,exports){ +},{"../impls/$spliterate-grouped/async-spliterate-grouped.js":371}],568:[function(require,module,exports){ module.exports = require('../impls/$spliterate/async-spliterate.js').asyncSpliterate; -},{"../impls/$spliterate/async-spliterate.js":357}],546:[function(require,module,exports){ +},{"../impls/$spliterate/async-spliterate.js":373}],569:[function(require,module,exports){ module.exports = require('../impls/$starts-with-any-seq/async-starts-with-any-seq.js').asyncStartsWithAnySeq; -},{"../impls/$starts-with-any-seq/async-starts-with-any-seq.js":359}],547:[function(require,module,exports){ +},{"../impls/$starts-with-any-seq/async-starts-with-any-seq.js":375}],570:[function(require,module,exports){ module.exports = require('../impls/$starts-with-any/async-starts-with-any.js').asyncStartsWithAny; -},{"../impls/$starts-with-any/async-starts-with-any.js":361}],548:[function(require,module,exports){ +},{"../impls/$starts-with-any/async-starts-with-any.js":377}],571:[function(require,module,exports){ module.exports = require('../impls/$starts-with-seq/async-starts-with-seq.js').asyncStartsWithSeq; -},{"../impls/$starts-with-seq/async-starts-with-seq.js":363}],549:[function(require,module,exports){ +},{"../impls/$starts-with-seq/async-starts-with-seq.js":379}],572:[function(require,module,exports){ module.exports = require('../impls/$starts-with/async-starts-with.js').asyncStartsWith; -},{"../impls/$starts-with/async-starts-with.js":365}],550:[function(require,module,exports){ +},{"../impls/$starts-with/async-starts-with.js":381}],573:[function(require,module,exports){ module.exports = require('../impls/$str/async-str.js').asyncStr; -},{"../impls/$str/async-str.js":367}],551:[function(require,module,exports){ +},{"../impls/$str/async-str.js":383}],574:[function(require,module,exports){ module.exports = require('../impls/$take-last-or/async-take-last-or.js').asyncTakeLastOr; -},{"../impls/$take-last-or/async-take-last-or.js":369}],552:[function(require,module,exports){ +},{"../impls/$take-last-or/async-take-last-or.js":385}],575:[function(require,module,exports){ module.exports = require('../impls/$take-last/async-take-last.js').asyncTakeLast; -},{"../impls/$take-last/async-take-last.js":371}],553:[function(require,module,exports){ +},{"../impls/$take-last/async-take-last.js":387}],576:[function(require,module,exports){ module.exports = require('../impls/$take-sorted/async-take-sorted.js').asyncTakeSorted; -},{"../impls/$take-sorted/async-take-sorted.js":373}],554:[function(require,module,exports){ +},{"../impls/$take-sorted/async-take-sorted.js":389}],577:[function(require,module,exports){ module.exports = require('../impls/$take-while/async-take-while.js').asyncTakeWhile; -},{"../impls/$take-while/async-take-while.js":376}],555:[function(require,module,exports){ +},{"../impls/$take-while/async-take-while.js":392}],578:[function(require,module,exports){ module.exports = require('../impls/$take/async-take.js').asyncTake; -},{"../impls/$take/async-take.js":378}],556:[function(require,module,exports){ +},{"../impls/$take/async-take.js":394}],579:[function(require,module,exports){ module.exports = require('../impls/$tap/async-tap.js').asyncTap; -},{"../impls/$tap/async-tap.js":380}],557:[function(require,module,exports){ +},{"../impls/$tap/async-tap.js":396}],580:[function(require,module,exports){ module.exports = require('../impls/async-throttle/async-throttle.js').asyncThrottle; -},{"../impls/async-throttle/async-throttle.js":409}],558:[function(require,module,exports){ +},{"../impls/async-throttle/async-throttle.js":425}],581:[function(require,module,exports){ module.exports = require('../impls/$to-array/async-to-array.js').asyncToArray; -},{"../impls/$to-array/async-to-array.js":382}],559:[function(require,module,exports){ +},{"../impls/$to-array/async-to-array.js":398}],582:[function(require,module,exports){ module.exports = require('../impls/$to-object/async-to-object.js').asyncToObject; -},{"../impls/$to-object/async-to-object.js":384}],560:[function(require,module,exports){ +},{"../impls/$to-object/async-to-object.js":400}],583:[function(require,module,exports){ module.exports = require('../impls/$window-ahead/async-window-ahead.js').asyncWindowAhead; -},{"../impls/$window-ahead/async-window-ahead.js":386}],561:[function(require,module,exports){ +},{"../impls/$window-ahead/async-window-ahead.js":402}],584:[function(require,module,exports){ module.exports = require('../impls/$window-behind/async-window-behind.js').asyncWindowBehind; -},{"../impls/$window-behind/async-window-behind.js":388}],562:[function(require,module,exports){ +},{"../impls/$window-behind/async-window-behind.js":404}],585:[function(require,module,exports){ module.exports = require('../impls/$window/async-window.js').asyncWindow; -},{"../impls/$window/async-window.js":390}],563:[function(require,module,exports){ +},{"../impls/$window/async-window.js":406}],586:[function(require,module,exports){ module.exports = require('../impls/$wrap/async-wrap.js').asyncWrap; -},{"../impls/$wrap/async-wrap.js":392}],564:[function(require,module,exports){ +},{"../impls/$wrap/async-wrap.js":408}],587:[function(require,module,exports){ module.exports = require('../impls/$zip-all/async-zip-all.js').asyncZipAll; -},{"../impls/$zip-all/async-zip-all.js":394}],565:[function(require,module,exports){ +},{"../impls/$zip-all/async-zip-all.js":410}],588:[function(require,module,exports){ module.exports = require('../impls/$zip/async-zip.js').asyncZip; -},{"../impls/$zip/async-zip.js":396}],566:[function(require,module,exports){ +},{"../impls/$zip/async-zip.js":412}],589:[function(require,module,exports){ module.exports = require('../impls/$batch/batch.js').batch; -},{"../impls/$batch/batch.js":249}],567:[function(require,module,exports){ +},{"../impls/$batch/batch.js":259}],590:[function(require,module,exports){ module.exports = require('../impls/$bisect/bisect.js').bisect; -},{"../impls/$bisect/bisect.js":251}],568:[function(require,module,exports){ +},{"../impls/$bisect/bisect.js":261}],591:[function(require,module,exports){ module.exports = require('../impls/call/call.js').call; -},{"../impls/call/call.js":410}],569:[function(require,module,exports){ +},{"../impls/call/call.js":426}],592:[function(require,module,exports){ module.exports = require('../impls/$collate/collate.js').collate; -},{"../impls/$collate/collate.js":253}],570:[function(require,module,exports){ +},{"../impls/$collate/collate.js":263}],593:[function(require,module,exports){ module.exports = require('../impls/compose/compose.js').compose; -},{"../impls/compose/compose.js":411}],571:[function(require,module,exports){ +},{"../impls/compose/compose.js":427}],594:[function(require,module,exports){ module.exports = require('../impls/$compress/compress.js').compress; -},{"../impls/$compress/compress.js":255}],572:[function(require,module,exports){ +},{"../impls/$compress/compress.js":265}],595:[function(require,module,exports){ module.exports = require('../impls/$concat/concat.js').concat; -},{"../impls/$concat/concat.js":257}],573:[function(require,module,exports){ +},{"../impls/$concat/concat.js":267}],596:[function(require,module,exports){ module.exports = require('../impls/$consume/consume.js').consume; -},{"../impls/$consume/consume.js":259}],574:[function(require,module,exports){ +},{"../impls/$consume/consume.js":269}],597:[function(require,module,exports){ module.exports = require('../impls/$cycle-times/cycle-times.js').cycleTimes; -},{"../impls/$cycle-times/cycle-times.js":261}],575:[function(require,module,exports){ +},{"../impls/$cycle-times/cycle-times.js":271}],598:[function(require,module,exports){ module.exports = require('../impls/$cycle/cycle.js').cycle; -},{"../impls/$cycle/cycle.js":263}],576:[function(require,module,exports){ +},{"../impls/$cycle/cycle.js":273}],599:[function(require,module,exports){ module.exports = require('../impls/$deep-equal/deep-equal.js').deepEqual; -},{"../impls/$deep-equal/deep-equal.js":265}],577:[function(require,module,exports){ +},{"../impls/$deep-equal/deep-equal.js":275}],600:[function(require,module,exports){ +module.exports = require('../impls/$distinct/distinct.js').distinct; +},{"../impls/$distinct/distinct.js":277}],601:[function(require,module,exports){ module.exports = require('../impls/$drop-while/drop-while.js').dropWhile; -},{"../impls/$drop-while/drop-while.js":267}],578:[function(require,module,exports){ +},{"../impls/$drop-while/drop-while.js":279}],602:[function(require,module,exports){ module.exports = require('../impls/$drop/drop.js').drop; -},{"../impls/$drop/drop.js":269}],579:[function(require,module,exports){ +},{"../impls/$drop/drop.js":281}],603:[function(require,module,exports){ module.exports = require('../impls/$enumerate/enumerate.js').enumerate; -},{"../impls/$enumerate/enumerate.js":271}],580:[function(require,module,exports){ +},{"../impls/$enumerate/enumerate.js":283}],604:[function(require,module,exports){ module.exports = require('../impls/$equal/equal.js').equal; -},{"../impls/$equal/equal.js":273}],581:[function(require,module,exports){ +},{"../impls/$equal/equal.js":285}],605:[function(require,module,exports){ module.exports = require('../impls/$every/every.js').every; -},{"../impls/$every/every.js":275}],582:[function(require,module,exports){ +},{"../impls/$every/every.js":287}],606:[function(require,module,exports){ module.exports = require('../impls/exec-pipe/exec-pipe.js').execPipe; -},{"../impls/exec-pipe/exec-pipe.js":412}],583:[function(require,module,exports){ +},{"../impls/exec-pipe/exec-pipe.js":428}],607:[function(require,module,exports){ module.exports = require('../impls/$filter/filter.js').filter; -},{"../impls/$filter/filter.js":277}],584:[function(require,module,exports){ +},{"../impls/$filter/filter.js":289}],608:[function(require,module,exports){ +module.exports = require('../impls/$find-best-or/find-best-or.js').findBestOr; +},{"../impls/$find-best-or/find-best-or.js":291}],609:[function(require,module,exports){ +module.exports = require('../impls/$find-best/find-best.js').findBest; +},{"../impls/$find-best/find-best.js":293}],610:[function(require,module,exports){ module.exports = require('../impls/$find-or/find-or.js').findOr; -},{"../impls/$find-or/find-or.js":279}],585:[function(require,module,exports){ +},{"../impls/$find-or/find-or.js":295}],611:[function(require,module,exports){ module.exports = require('../impls/$find/find.js').find; -},{"../impls/$find/find.js":281}],586:[function(require,module,exports){ +},{"../impls/$find/find.js":297}],612:[function(require,module,exports){ +module.exports = require('../impls/first-highest/first-highest.js').firstHighest; +},{"../impls/first-highest/first-highest.js":429}],613:[function(require,module,exports){ +module.exports = require('../impls/first-lowest/first-lowest.js').firstLowest; +},{"../impls/first-lowest/first-lowest.js":430}],614:[function(require,module,exports){ module.exports = require('../impls/$first-or/first-or.js').firstOr; -},{"../impls/$first-or/first-or.js":283}],587:[function(require,module,exports){ +},{"../impls/$first-or/first-or.js":299}],615:[function(require,module,exports){ module.exports = require('../impls/$first/first.js').first; -},{"../impls/$first/first.js":285}],588:[function(require,module,exports){ +},{"../impls/$first/first.js":301}],616:[function(require,module,exports){ module.exports = require('../impls/$flat-map/flat-map.js').flatMap; -},{"../impls/$flat-map/flat-map.js":287}],589:[function(require,module,exports){ +},{"../impls/$flat-map/flat-map.js":303}],617:[function(require,module,exports){ module.exports = require('../impls/$flat/flat.js').flat; -},{"../impls/$flat/flat.js":289}],590:[function(require,module,exports){ +},{"../impls/$flat/flat.js":305}],618:[function(require,module,exports){ module.exports = require('../impls/$for-each/for-each.js').forEach; -},{"../impls/$for-each/for-each.js":292}],591:[function(require,module,exports){ +},{"../impls/$for-each/for-each.js":308}],619:[function(require,module,exports){ module.exports = require('../impls/$fork/fork.js').fork; -},{"../impls/$fork/fork.js":294}],592:[function(require,module,exports){ +},{"../impls/$fork/fork.js":310}],620:[function(require,module,exports){ module.exports = require('../impls/$forkerate/forkerate.js').forkerate; -},{"../impls/$forkerate/forkerate.js":296}],593:[function(require,module,exports){ +},{"../impls/$forkerate/forkerate.js":312}],621:[function(require,module,exports){ module.exports = require('../impls/get-size/get-size.js').getSize; -},{"../impls/get-size/get-size.js":413}],594:[function(require,module,exports){ +},{"../impls/get-size/get-size.js":431}],622:[function(require,module,exports){ module.exports = require('../impls/$includes-any-seq/includes-any-seq.js').includesAnySeq; -},{"../impls/$includes-any-seq/includes-any-seq.js":298}],595:[function(require,module,exports){ +},{"../impls/$includes-any-seq/includes-any-seq.js":314}],623:[function(require,module,exports){ module.exports = require('../impls/$includes-any/includes-any.js').includesAny; -},{"../impls/$includes-any/includes-any.js":300}],596:[function(require,module,exports){ +},{"../impls/$includes-any/includes-any.js":316}],624:[function(require,module,exports){ module.exports = require('../impls/$includes-seq/includes-seq.js').includesSeq; -},{"../impls/$includes-seq/includes-seq.js":302}],597:[function(require,module,exports){ +},{"../impls/$includes-seq/includes-seq.js":318}],625:[function(require,module,exports){ module.exports = require('../impls/$includes/includes.js').includes; -},{"../impls/$includes/includes.js":304}],598:[function(require,module,exports){ +},{"../impls/$includes/includes.js":320}],626:[function(require,module,exports){ module.exports = require('../impls/$interleave/interleave.js').interleave; -},{"../impls/$interleave/interleave.js":306}],599:[function(require,module,exports){ +},{"../impls/$interleave/interleave.js":322}],627:[function(require,module,exports){ module.exports = require('../impls/$interpose-seq/interpose-seq.js').interposeSeq; -},{"../impls/$interpose-seq/interpose-seq.js":308}],600:[function(require,module,exports){ +},{"../impls/$interpose-seq/interpose-seq.js":324}],628:[function(require,module,exports){ module.exports = require('../impls/$interpose/interpose.js').interpose; -},{"../impls/$interpose/interpose.js":310}],601:[function(require,module,exports){ +},{"../impls/$interpose/interpose.js":326}],629:[function(require,module,exports){ module.exports = require('../impls/is-array/is-array.js').isArray; -},{"../impls/is-array/is-array.js":414}],602:[function(require,module,exports){ +},{"../impls/is-array/is-array.js":432}],630:[function(require,module,exports){ module.exports = require('../impls/is-async-iterable/is-async-iterable.js').isAsyncIterable; -},{"../impls/is-async-iterable/is-async-iterable.js":415}],603:[function(require,module,exports){ +},{"../impls/is-async-iterable/is-async-iterable.js":433}],631:[function(require,module,exports){ module.exports = require('../impls/is-async-loopable/is-async-loopable.js').isAsyncLoopable; -},{"../impls/is-async-loopable/is-async-loopable.js":416}],604:[function(require,module,exports){ +},{"../impls/is-async-loopable/is-async-loopable.js":434}],632:[function(require,module,exports){ module.exports = require('../impls/is-async-wrappable/is-async-wrappable.js').isAsyncWrappable; -},{"../impls/is-async-wrappable/is-async-wrappable.js":417}],605:[function(require,module,exports){ +},{"../impls/is-async-wrappable/is-async-wrappable.js":435}],633:[function(require,module,exports){ module.exports = require('../impls/$is-empty/is-empty.js').isEmpty; -},{"../impls/$is-empty/is-empty.js":312}],606:[function(require,module,exports){ +},{"../impls/$is-empty/is-empty.js":328}],634:[function(require,module,exports){ module.exports = require('../impls/is-iterable/is-iterable.js').isIterable; -},{"../impls/is-iterable/is-iterable.js":418}],607:[function(require,module,exports){ +},{"../impls/is-iterable/is-iterable.js":436}],635:[function(require,module,exports){ module.exports = require('../impls/is-loopable/is-loopable.js').isLoopable; -},{"../impls/is-loopable/is-loopable.js":419}],608:[function(require,module,exports){ +},{"../impls/is-loopable/is-loopable.js":437}],636:[function(require,module,exports){ module.exports = require('../impls/is-nil/is-nil.js').isNil; -},{"../impls/is-nil/is-nil.js":420}],609:[function(require,module,exports){ +},{"../impls/is-nil/is-nil.js":438}],637:[function(require,module,exports){ module.exports = require('../impls/is-null/is-null.js').isNull; -},{"../impls/is-null/is-null.js":421}],610:[function(require,module,exports){ +},{"../impls/is-null/is-null.js":439}],638:[function(require,module,exports){ module.exports = require('../impls/is-object/is-object.js').isObject; -},{"../impls/is-object/is-object.js":422}],611:[function(require,module,exports){ +},{"../impls/is-object/is-object.js":440}],639:[function(require,module,exports){ module.exports = require('../impls/$is-sorted/is-sorted.js').isSorted; -},{"../impls/$is-sorted/is-sorted.js":314}],612:[function(require,module,exports){ +},{"../impls/$is-sorted/is-sorted.js":330}],640:[function(require,module,exports){ module.exports = require('../impls/is-string/is-string.js').isString; -},{"../impls/is-string/is-string.js":423}],613:[function(require,module,exports){ +},{"../impls/is-string/is-string.js":441}],641:[function(require,module,exports){ module.exports = require('../impls/is-undefined/is-undefined.js').isUndefined; -},{"../impls/is-undefined/is-undefined.js":424}],614:[function(require,module,exports){ +},{"../impls/is-undefined/is-undefined.js":442}],642:[function(require,module,exports){ module.exports = require('../impls/is-wrappable/is-wrappable.js').isWrappable; -},{"../impls/is-wrappable/is-wrappable.js":425}],615:[function(require,module,exports){ +},{"../impls/is-wrappable/is-wrappable.js":443}],643:[function(require,module,exports){ module.exports = require('../impls/$join-with-seq/join-with-seq.js').joinWithSeq; -},{"../impls/$join-with-seq/join-with-seq.js":316}],616:[function(require,module,exports){ +},{"../impls/$join-with-seq/join-with-seq.js":332}],644:[function(require,module,exports){ module.exports = require('../impls/$join-with/join-with.js').joinWith; -},{"../impls/$join-with/join-with.js":318}],617:[function(require,module,exports){ +},{"../impls/$join-with/join-with.js":334}],645:[function(require,module,exports){ module.exports = require('../impls/$join/join.js').join; -},{"../impls/$join/join.js":320}],618:[function(require,module,exports){ +},{"../impls/$join/join.js":336}],646:[function(require,module,exports){ +module.exports = require('../impls/last-highest/last-highest.js').lastHighest; +},{"../impls/last-highest/last-highest.js":444}],647:[function(require,module,exports){ +module.exports = require('../impls/last-lowest/last-lowest.js').lastLowest; +},{"../impls/last-lowest/last-lowest.js":445}],648:[function(require,module,exports){ module.exports = require('../impls/$map/map.js').map; -},{"../impls/$map/map.js":322}],619:[function(require,module,exports){ +},{"../impls/$map/map.js":338}],649:[function(require,module,exports){ module.exports = require('../impls/not-array/not-array.js').notArray; -},{"../impls/not-array/not-array.js":426}],620:[function(require,module,exports){ +},{"../impls/not-array/not-array.js":446}],650:[function(require,module,exports){ module.exports = require('../impls/not-async-iterable/not-async-iterable.js').notAsyncIterable; -},{"../impls/not-async-iterable/not-async-iterable.js":427}],621:[function(require,module,exports){ +},{"../impls/not-async-iterable/not-async-iterable.js":447}],651:[function(require,module,exports){ module.exports = require('../impls/not-async-loopable/not-async-loopable.js').notAsyncLoopable; -},{"../impls/not-async-loopable/not-async-loopable.js":428}],622:[function(require,module,exports){ +},{"../impls/not-async-loopable/not-async-loopable.js":448}],652:[function(require,module,exports){ module.exports = require('../impls/not-async-wrappable/not-async-wrappable.js').notAsyncWrappable; -},{"../impls/not-async-wrappable/not-async-wrappable.js":429}],623:[function(require,module,exports){ +},{"../impls/not-async-wrappable/not-async-wrappable.js":449}],653:[function(require,module,exports){ module.exports = require('../impls/not-iterable/not-iterable.js').notIterable; -},{"../impls/not-iterable/not-iterable.js":430}],624:[function(require,module,exports){ +},{"../impls/not-iterable/not-iterable.js":450}],654:[function(require,module,exports){ module.exports = require('../impls/not-loopable/not-loopable.js').notLoopable; -},{"../impls/not-loopable/not-loopable.js":431}],625:[function(require,module,exports){ +},{"../impls/not-loopable/not-loopable.js":451}],655:[function(require,module,exports){ module.exports = require('../impls/not-nil/not-nil.js').notNil; -},{"../impls/not-nil/not-nil.js":432}],626:[function(require,module,exports){ +},{"../impls/not-nil/not-nil.js":452}],656:[function(require,module,exports){ module.exports = require('../impls/not-null/not-null.js').notNull; -},{"../impls/not-null/not-null.js":433}],627:[function(require,module,exports){ +},{"../impls/not-null/not-null.js":453}],657:[function(require,module,exports){ module.exports = require('../impls/not-object/not-object.js').notObject; -},{"../impls/not-object/not-object.js":434}],628:[function(require,module,exports){ +},{"../impls/not-object/not-object.js":454}],658:[function(require,module,exports){ module.exports = require('../impls/not-string/not-string.js').notString; -},{"../impls/not-string/not-string.js":435}],629:[function(require,module,exports){ +},{"../impls/not-string/not-string.js":455}],659:[function(require,module,exports){ module.exports = require('../impls/not-undefined/not-undefined.js').notUndefined; -},{"../impls/not-undefined/not-undefined.js":436}],630:[function(require,module,exports){ +},{"../impls/not-undefined/not-undefined.js":456}],660:[function(require,module,exports){ module.exports = require('../impls/not-wrappable/not-wrappable.js').notWrappable; -},{"../impls/not-wrappable/not-wrappable.js":437}],631:[function(require,module,exports){ +},{"../impls/not-wrappable/not-wrappable.js":457}],661:[function(require,module,exports){ module.exports = require('../impls/object-entries/object-entries.js').objectEntries; -},{"../impls/object-entries/object-entries.js":438}],632:[function(require,module,exports){ +},{"../impls/object-entries/object-entries.js":458}],662:[function(require,module,exports){ module.exports = require('../impls/object-from-async/object-from-async.js').objectFromAsync; -},{"../impls/object-from-async/object-from-async.js":439}],633:[function(require,module,exports){ +},{"../impls/object-from-async/object-from-async.js":459}],663:[function(require,module,exports){ module.exports = require('../impls/object-from/object-from.js').objectFrom; -},{"../impls/object-from/object-from.js":440}],634:[function(require,module,exports){ +},{"../impls/object-from/object-from.js":460}],664:[function(require,module,exports){ module.exports = require('../impls/object-keys/object-keys.js').objectKeys; -},{"../impls/object-keys/object-keys.js":441}],635:[function(require,module,exports){ +},{"../impls/object-keys/object-keys.js":461}],665:[function(require,module,exports){ module.exports = require('../impls/object-values/object-values.js').objectValues; -},{"../impls/object-values/object-values.js":442}],636:[function(require,module,exports){ +},{"../impls/object-values/object-values.js":462}],666:[function(require,module,exports){ module.exports = require('../impls/$peekerate/peekerate.js').peekerate; -},{"../impls/$peekerate/peekerate.js":324}],637:[function(require,module,exports){ +},{"../impls/$peekerate/peekerate.js":340}],667:[function(require,module,exports){ module.exports = require('../impls/pipe/pipe.js').pipe; -},{"../impls/pipe/pipe.js":443}],638:[function(require,module,exports){ +},{"../impls/pipe/pipe.js":463}],668:[function(require,module,exports){ module.exports = require('../impls/$prepend/prepend.js').prepend; -},{"../impls/$prepend/prepend.js":326}],639:[function(require,module,exports){ +},{"../impls/$prepend/prepend.js":342}],669:[function(require,module,exports){ module.exports = require('../impls/range/range.js').range; -},{"../impls/range/range.js":444}],640:[function(require,module,exports){ +},{"../impls/range/range.js":464}],670:[function(require,module,exports){ module.exports = require('../impls/$reduce/reduce.js').reduce; -},{"../impls/$reduce/reduce.js":328}],641:[function(require,module,exports){ +},{"../impls/$reduce/reduce.js":344}],671:[function(require,module,exports){ module.exports = require('../impls/repeat-times/repeat-times.js').repeatTimes; -},{"../impls/repeat-times/repeat-times.js":445}],642:[function(require,module,exports){ +},{"../impls/repeat-times/repeat-times.js":465}],672:[function(require,module,exports){ module.exports = require('../impls/repeat/repeat.js').repeat; -},{"../impls/repeat/repeat.js":446}],643:[function(require,module,exports){ +},{"../impls/repeat/repeat.js":466}],673:[function(require,module,exports){ module.exports = require('../impls/$reverse/reverse.js').reverse; -},{"../impls/$reverse/reverse.js":330}],644:[function(require,module,exports){ +},{"../impls/$reverse/reverse.js":346}],674:[function(require,module,exports){ module.exports = require('../impls/$round-robin/round-robin.js').roundRobin; -},{"../impls/$round-robin/round-robin.js":333}],645:[function(require,module,exports){ +},{"../impls/$round-robin/round-robin.js":349}],675:[function(require,module,exports){ module.exports = require('../impls/$size/size.js').size; -},{"../impls/$size/size.js":335}],646:[function(require,module,exports){ +},{"../impls/$size/size.js":351}],676:[function(require,module,exports){ module.exports = require('../impls/$slice/slice.js').slice; -},{"../impls/$slice/slice.js":338}],647:[function(require,module,exports){ +},{"../impls/$slice/slice.js":354}],677:[function(require,module,exports){ module.exports = require('../impls/$some/some.js').some; -},{"../impls/$some/some.js":340}],648:[function(require,module,exports){ +},{"../impls/$some/some.js":356}],678:[function(require,module,exports){ module.exports = require('../impls/$split-groups/split-groups.js').splitGroups; -},{"../impls/$split-groups/split-groups.js":342}],649:[function(require,module,exports){ +},{"../impls/$split-groups/split-groups.js":358}],679:[function(require,module,exports){ module.exports = require('../impls/$split-on-any-seq/split-on-any-seq.js').splitOnAnySeq; -},{"../impls/$split-on-any-seq/split-on-any-seq.js":344}],650:[function(require,module,exports){ +},{"../impls/$split-on-any-seq/split-on-any-seq.js":360}],680:[function(require,module,exports){ module.exports = require('../impls/$split-on-any/split-on-any.js').splitOnAny; -},{"../impls/$split-on-any/split-on-any.js":346}],651:[function(require,module,exports){ +},{"../impls/$split-on-any/split-on-any.js":362}],681:[function(require,module,exports){ module.exports = require('../impls/$split-on-seq/split-on-seq.js').splitOnSeq; -},{"../impls/$split-on-seq/split-on-seq.js":348}],652:[function(require,module,exports){ +},{"../impls/$split-on-seq/split-on-seq.js":364}],682:[function(require,module,exports){ module.exports = require('../impls/$split-on/split-on.js').splitOn; -},{"../impls/$split-on/split-on.js":350}],653:[function(require,module,exports){ +},{"../impls/$split-on/split-on.js":366}],683:[function(require,module,exports){ module.exports = require('../impls/$split-when/split-when.js').splitWhen; -},{"../impls/$split-when/split-when.js":352}],654:[function(require,module,exports){ +},{"../impls/$split-when/split-when.js":368}],684:[function(require,module,exports){ module.exports = require('../impls/$split/split.js').split; -},{"../impls/$split/split.js":354}],655:[function(require,module,exports){ +},{"../impls/$split/split.js":370}],685:[function(require,module,exports){ module.exports = require('../impls/$spliterate-grouped/spliterate-grouped.js').spliterateGrouped; -},{"../impls/$spliterate-grouped/spliterate-grouped.js":356}],656:[function(require,module,exports){ +},{"../impls/$spliterate-grouped/spliterate-grouped.js":372}],686:[function(require,module,exports){ module.exports = require('../impls/$spliterate/spliterate.js').spliterate; -},{"../impls/$spliterate/spliterate.js":358}],657:[function(require,module,exports){ +},{"../impls/$spliterate/spliterate.js":374}],687:[function(require,module,exports){ module.exports = require('../impls/$starts-with-any-seq/starts-with-any-seq.js').startsWithAnySeq; -},{"../impls/$starts-with-any-seq/starts-with-any-seq.js":360}],658:[function(require,module,exports){ +},{"../impls/$starts-with-any-seq/starts-with-any-seq.js":376}],688:[function(require,module,exports){ module.exports = require('../impls/$starts-with-any/starts-with-any.js').startsWithAny; -},{"../impls/$starts-with-any/starts-with-any.js":362}],659:[function(require,module,exports){ +},{"../impls/$starts-with-any/starts-with-any.js":378}],689:[function(require,module,exports){ module.exports = require('../impls/$starts-with-seq/starts-with-seq.js').startsWithSeq; -},{"../impls/$starts-with-seq/starts-with-seq.js":364}],660:[function(require,module,exports){ +},{"../impls/$starts-with-seq/starts-with-seq.js":380}],690:[function(require,module,exports){ module.exports = require('../impls/$starts-with/starts-with.js').startsWith; -},{"../impls/$starts-with/starts-with.js":366}],661:[function(require,module,exports){ +},{"../impls/$starts-with/starts-with.js":382}],691:[function(require,module,exports){ module.exports = require('../impls/$str/str.js').str; -},{"../impls/$str/str.js":368}],662:[function(require,module,exports){ +},{"../impls/$str/str.js":384}],692:[function(require,module,exports){ module.exports = require('../impls/string-from-async/string-from-async.js').stringFromAsync; -},{"../impls/string-from-async/string-from-async.js":447}],663:[function(require,module,exports){ +},{"../impls/string-from-async/string-from-async.js":467}],693:[function(require,module,exports){ module.exports = require('../impls/string-from/string-from.js').stringFrom; -},{"../impls/string-from/string-from.js":448}],664:[function(require,module,exports){ +},{"../impls/string-from/string-from.js":468}],694:[function(require,module,exports){ module.exports = require('../impls/$take-last-or/take-last-or.js').takeLastOr; -},{"../impls/$take-last-or/take-last-or.js":370}],665:[function(require,module,exports){ +},{"../impls/$take-last-or/take-last-or.js":386}],695:[function(require,module,exports){ module.exports = require('../impls/$take-last/take-last.js').takeLast; -},{"../impls/$take-last/take-last.js":372}],666:[function(require,module,exports){ +},{"../impls/$take-last/take-last.js":388}],696:[function(require,module,exports){ module.exports = require('../impls/$take-sorted/take-sorted.js').takeSorted; -},{"../impls/$take-sorted/take-sorted.js":375}],667:[function(require,module,exports){ +},{"../impls/$take-sorted/take-sorted.js":391}],697:[function(require,module,exports){ module.exports = require('../impls/$take-while/take-while.js').takeWhile; -},{"../impls/$take-while/take-while.js":377}],668:[function(require,module,exports){ +},{"../impls/$take-while/take-while.js":393}],698:[function(require,module,exports){ module.exports = require('../impls/$take/take.js').take; -},{"../impls/$take/take.js":379}],669:[function(require,module,exports){ +},{"../impls/$take/take.js":395}],699:[function(require,module,exports){ module.exports = require('../impls/$tap/tap.js').tap; -},{"../impls/$tap/tap.js":381}],670:[function(require,module,exports){ +},{"../impls/$tap/tap.js":397}],700:[function(require,module,exports){ module.exports = require('../impls/$to-array/to-array.js').toArray; -},{"../impls/$to-array/to-array.js":383}],671:[function(require,module,exports){ +},{"../impls/$to-array/to-array.js":399}],701:[function(require,module,exports){ module.exports = require('../impls/$to-object/to-object.js').toObject; -},{"../impls/$to-object/to-object.js":385}],672:[function(require,module,exports){ +},{"../impls/$to-object/to-object.js":401}],702:[function(require,module,exports){ module.exports = require('../impls/when/when.js').when; -},{"../impls/when/when.js":449}],673:[function(require,module,exports){ +},{"../impls/when/when.js":469}],703:[function(require,module,exports){ module.exports = require('../impls/$window-ahead/window-ahead.js').windowAhead; -},{"../impls/$window-ahead/window-ahead.js":387}],674:[function(require,module,exports){ +},{"../impls/$window-ahead/window-ahead.js":403}],704:[function(require,module,exports){ module.exports = require('../impls/$window-behind/window-behind.js').windowBehind; -},{"../impls/$window-behind/window-behind.js":389}],675:[function(require,module,exports){ +},{"../impls/$window-behind/window-behind.js":405}],705:[function(require,module,exports){ module.exports = require('../impls/$window/window.js').window; -},{"../impls/$window/window.js":391}],676:[function(require,module,exports){ +},{"../impls/$window/window.js":407}],706:[function(require,module,exports){ module.exports = require('../impls/wrap-entries/wrap-entries.js').wrapEntries; -},{"../impls/wrap-entries/wrap-entries.js":450}],677:[function(require,module,exports){ +},{"../impls/wrap-entries/wrap-entries.js":470}],707:[function(require,module,exports){ module.exports = require('../impls/wrap-keys/wrap-keys.js').wrapKeys; -},{"../impls/wrap-keys/wrap-keys.js":451}],678:[function(require,module,exports){ +},{"../impls/wrap-keys/wrap-keys.js":471}],708:[function(require,module,exports){ module.exports = require('../impls/wrap-values/wrap-values.js').wrapValues; -},{"../impls/wrap-values/wrap-values.js":452}],679:[function(require,module,exports){ +},{"../impls/wrap-values/wrap-values.js":472}],709:[function(require,module,exports){ module.exports = require('../impls/$wrap/wrap.js').wrap; -},{"../impls/$wrap/wrap.js":393}],680:[function(require,module,exports){ +},{"../impls/$wrap/wrap.js":409}],710:[function(require,module,exports){ module.exports = require('../impls/$zip-all/zip-all.js').zipAll; -},{"../impls/$zip-all/zip-all.js":395}],681:[function(require,module,exports){ +},{"../impls/$zip-all/zip-all.js":411}],711:[function(require,module,exports){ module.exports = require('../impls/$zip/zip.js').zip; -},{"../impls/$zip/zip.js":397}],682:[function(require,module,exports){ +},{"../impls/$zip/zip.js":413}],712:[function(require,module,exports){ /* Copyright 2013 Daniel Wirtz Copyright 2009 The Closure Library Authors. All Rights Reserved. @@ -62792,7 +63713,7 @@ module.exports = require('../impls/$zip/zip.js').zip; return Long; }); -},{}],683:[function(require,module,exports){ +},{}],713:[function(require,module,exports){ /* object-assign (c) Sindre Sorhus @@ -62884,7 +63805,7 @@ module.exports = shouldUseNative() ? Object.assign : function (target, source) { return to; }; -},{}],684:[function(require,module,exports){ +},{}],714:[function(require,module,exports){ // shim for using process in browser var process = module.exports = {}; @@ -63070,13 +63991,13 @@ process.chdir = function (dir) { }; process.umask = function() { return 0; }; -},{}],685:[function(require,module,exports){ +},{}],715:[function(require,module,exports){ // minimal library entry point. "use strict"; module.exports = require("./src/index-minimal"); -},{"./src/index-minimal":686}],686:[function(require,module,exports){ +},{"./src/index-minimal":716}],716:[function(require,module,exports){ "use strict"; var protobuf = exports; @@ -63114,7 +64035,7 @@ function configure() { // Set up buffer utility according to the environment configure(); -},{"./reader":687,"./reader_buffer":688,"./roots":689,"./rpc":690,"./util/minimal":693,"./writer":694,"./writer_buffer":695}],687:[function(require,module,exports){ +},{"./reader":717,"./reader_buffer":718,"./roots":719,"./rpc":720,"./util/minimal":723,"./writer":724,"./writer_buffer":725}],717:[function(require,module,exports){ "use strict"; module.exports = Reader; @@ -63527,7 +64448,7 @@ Reader._configure = function(BufferReader_) { }); }; -},{"./util/minimal":693}],688:[function(require,module,exports){ +},{"./util/minimal":723}],718:[function(require,module,exports){ "use strict"; module.exports = BufferReader; @@ -63580,7 +64501,7 @@ BufferReader.prototype.string = function read_string_buffer() { BufferReader._configure(); -},{"./reader":687,"./util/minimal":693}],689:[function(require,module,exports){ +},{"./reader":717,"./util/minimal":723}],719:[function(require,module,exports){ "use strict"; module.exports = {}; @@ -63600,7 +64521,7 @@ module.exports = {}; * var root = protobuf.roots["myroot"]; */ -},{}],690:[function(require,module,exports){ +},{}],720:[function(require,module,exports){ "use strict"; /** @@ -63638,7 +64559,7 @@ var rpc = exports; rpc.Service = require("./rpc/service"); -},{"./rpc/service":691}],691:[function(require,module,exports){ +},{"./rpc/service":721}],721:[function(require,module,exports){ "use strict"; module.exports = Service; @@ -63782,7 +64703,7 @@ Service.prototype.end = function end(endedByRPC) { return this; }; -},{"../util/minimal":693}],692:[function(require,module,exports){ +},{"../util/minimal":723}],722:[function(require,module,exports){ "use strict"; module.exports = LongBits; @@ -63984,7 +64905,7 @@ LongBits.prototype.length = function length() { : part2 < 128 ? 9 : 10; }; -},{"../util/minimal":693}],693:[function(require,module,exports){ +},{"../util/minimal":723}],723:[function(require,module,exports){ (function (global){(function (){ "use strict"; var util = exports; @@ -64410,7 +65331,7 @@ util._configure = function() { }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./longbits":692,"@protobufjs/aspromise":66,"@protobufjs/base64":67,"@protobufjs/eventemitter":68,"@protobufjs/float":69,"@protobufjs/inquire":70,"@protobufjs/pool":71,"@protobufjs/utf8":72}],694:[function(require,module,exports){ +},{"./longbits":722,"@protobufjs/aspromise":66,"@protobufjs/base64":67,"@protobufjs/eventemitter":68,"@protobufjs/float":69,"@protobufjs/inquire":70,"@protobufjs/pool":71,"@protobufjs/utf8":72}],724:[function(require,module,exports){ "use strict"; module.exports = Writer; @@ -64877,7 +65798,7 @@ Writer._configure = function(BufferWriter_) { BufferWriter._configure(); }; -},{"./util/minimal":693}],695:[function(require,module,exports){ +},{"./util/minimal":723}],725:[function(require,module,exports){ "use strict"; module.exports = BufferWriter; @@ -64964,7 +65885,724 @@ BufferWriter.prototype.string = function write_string_buffer(value) { BufferWriter._configure(); -},{"./util/minimal":693,"./writer":694}],696:[function(require,module,exports){ +},{"./util/minimal":723,"./writer":724}],726:[function(require,module,exports){ +(function (global){(function (){ +/*! https://mths.be/punycode v1.4.1 by @mathias */ +;(function(root) { + + /** Detect free variables */ + var freeExports = typeof exports == 'object' && exports && + !exports.nodeType && exports; + var freeModule = typeof module == 'object' && module && + !module.nodeType && module; + var freeGlobal = typeof global == 'object' && global; + if ( + freeGlobal.global === freeGlobal || + freeGlobal.window === freeGlobal || + freeGlobal.self === freeGlobal + ) { + root = freeGlobal; + } + + /** + * The `punycode` object. + * @name punycode + * @type Object + */ + var punycode, + + /** Highest positive signed 32-bit float value */ + maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1 + + /** Bootstring parameters */ + base = 36, + tMin = 1, + tMax = 26, + skew = 38, + damp = 700, + initialBias = 72, + initialN = 128, // 0x80 + delimiter = '-', // '\x2D' + + /** Regular expressions */ + regexPunycode = /^xn--/, + regexNonASCII = /[^\x20-\x7E]/, // unprintable ASCII chars + non-ASCII chars + regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g, // RFC 3490 separators + + /** Error messages */ + errors = { + 'overflow': 'Overflow: input needs wider integers to process', + 'not-basic': 'Illegal input >= 0x80 (not a basic code point)', + 'invalid-input': 'Invalid input' + }, + + /** Convenience shortcuts */ + baseMinusTMin = base - tMin, + floor = Math.floor, + stringFromCharCode = String.fromCharCode, + + /** Temporary variable */ + key; + + /*--------------------------------------------------------------------------*/ + + /** + * A generic error utility function. + * @private + * @param {String} type The error type. + * @returns {Error} Throws a `RangeError` with the applicable error message. + */ + function error(type) { + throw new RangeError(errors[type]); + } + + /** + * A generic `Array#map` utility function. + * @private + * @param {Array} array The array to iterate over. + * @param {Function} callback The function that gets called for every array + * item. + * @returns {Array} A new array of values returned by the callback function. + */ + function map(array, fn) { + var length = array.length; + var result = []; + while (length--) { + result[length] = fn(array[length]); + } + return result; + } + + /** + * A simple `Array#map`-like wrapper to work with domain name strings or email + * addresses. + * @private + * @param {String} domain The domain name or email address. + * @param {Function} callback The function that gets called for every + * character. + * @returns {Array} A new string of characters returned by the callback + * function. + */ + function mapDomain(string, fn) { + var parts = string.split('@'); + var result = ''; + if (parts.length > 1) { + // In email addresses, only the domain name should be punycoded. Leave + // the local part (i.e. everything up to `@`) intact. + result = parts[0] + '@'; + string = parts[1]; + } + // Avoid `split(regex)` for IE8 compatibility. See #17. + string = string.replace(regexSeparators, '\x2E'); + var labels = string.split('.'); + var encoded = map(labels, fn).join('.'); + return result + encoded; + } + + /** + * Creates an array containing the numeric code points of each Unicode + * character in the string. While JavaScript uses UCS-2 internally, + * this function will convert a pair of surrogate halves (each of which + * UCS-2 exposes as separate characters) into a single code point, + * matching UTF-16. + * @see `punycode.ucs2.encode` + * @see + * @memberOf punycode.ucs2 + * @name decode + * @param {String} string The Unicode input string (UCS-2). + * @returns {Array} The new array of code points. + */ + function ucs2decode(string) { + var output = [], + counter = 0, + length = string.length, + value, + extra; + while (counter < length) { + value = string.charCodeAt(counter++); + if (value >= 0xD800 && value <= 0xDBFF && counter < length) { + // high surrogate, and there is a next character + extra = string.charCodeAt(counter++); + if ((extra & 0xFC00) == 0xDC00) { // low surrogate + output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000); + } else { + // unmatched surrogate; only append this code unit, in case the next + // code unit is the high surrogate of a surrogate pair + output.push(value); + counter--; + } + } else { + output.push(value); + } + } + return output; + } + + /** + * Creates a string based on an array of numeric code points. + * @see `punycode.ucs2.decode` + * @memberOf punycode.ucs2 + * @name encode + * @param {Array} codePoints The array of numeric code points. + * @returns {String} The new Unicode string (UCS-2). + */ + function ucs2encode(array) { + return map(array, function(value) { + var output = ''; + if (value > 0xFFFF) { + value -= 0x10000; + output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800); + value = 0xDC00 | value & 0x3FF; + } + output += stringFromCharCode(value); + return output; + }).join(''); + } + + /** + * Converts a basic code point into a digit/integer. + * @see `digitToBasic()` + * @private + * @param {Number} codePoint The basic numeric code point value. + * @returns {Number} The numeric value of a basic code point (for use in + * representing integers) in the range `0` to `base - 1`, or `base` if + * the code point does not represent a value. + */ + function basicToDigit(codePoint) { + if (codePoint - 48 < 10) { + return codePoint - 22; + } + if (codePoint - 65 < 26) { + return codePoint - 65; + } + if (codePoint - 97 < 26) { + return codePoint - 97; + } + return base; + } + + /** + * Converts a digit/integer into a basic code point. + * @see `basicToDigit()` + * @private + * @param {Number} digit The numeric value of a basic code point. + * @returns {Number} The basic code point whose value (when used for + * representing integers) is `digit`, which needs to be in the range + * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is + * used; else, the lowercase form is used. The behavior is undefined + * if `flag` is non-zero and `digit` has no uppercase form. + */ + function digitToBasic(digit, flag) { + // 0..25 map to ASCII a..z or A..Z + // 26..35 map to ASCII 0..9 + return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5); + } + + /** + * Bias adaptation function as per section 3.4 of RFC 3492. + * https://tools.ietf.org/html/rfc3492#section-3.4 + * @private + */ + function adapt(delta, numPoints, firstTime) { + var k = 0; + delta = firstTime ? floor(delta / damp) : delta >> 1; + delta += floor(delta / numPoints); + for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) { + delta = floor(delta / baseMinusTMin); + } + return floor(k + (baseMinusTMin + 1) * delta / (delta + skew)); + } + + /** + * Converts a Punycode string of ASCII-only symbols to a string of Unicode + * symbols. + * @memberOf punycode + * @param {String} input The Punycode string of ASCII-only symbols. + * @returns {String} The resulting string of Unicode symbols. + */ + function decode(input) { + // Don't use UCS-2 + var output = [], + inputLength = input.length, + out, + i = 0, + n = initialN, + bias = initialBias, + basic, + j, + index, + oldi, + w, + k, + digit, + t, + /** Cached calculation results */ + baseMinusT; + + // Handle the basic code points: let `basic` be the number of input code + // points before the last delimiter, or `0` if there is none, then copy + // the first basic code points to the output. + + basic = input.lastIndexOf(delimiter); + if (basic < 0) { + basic = 0; + } + + for (j = 0; j < basic; ++j) { + // if it's not a basic code point + if (input.charCodeAt(j) >= 0x80) { + error('not-basic'); + } + output.push(input.charCodeAt(j)); + } + + // Main decoding loop: start just after the last delimiter if any basic code + // points were copied; start at the beginning otherwise. + + for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) { + + // `index` is the index of the next character to be consumed. + // Decode a generalized variable-length integer into `delta`, + // which gets added to `i`. The overflow checking is easier + // if we increase `i` as we go, then subtract off its starting + // value at the end to obtain `delta`. + for (oldi = i, w = 1, k = base; /* no condition */; k += base) { + + if (index >= inputLength) { + error('invalid-input'); + } + + digit = basicToDigit(input.charCodeAt(index++)); + + if (digit >= base || digit > floor((maxInt - i) / w)) { + error('overflow'); + } + + i += digit * w; + t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); + + if (digit < t) { + break; + } + + baseMinusT = base - t; + if (w > floor(maxInt / baseMinusT)) { + error('overflow'); + } + + w *= baseMinusT; + + } + + out = output.length + 1; + bias = adapt(i - oldi, out, oldi == 0); + + // `i` was supposed to wrap around from `out` to `0`, + // incrementing `n` each time, so we'll fix that now: + if (floor(i / out) > maxInt - n) { + error('overflow'); + } + + n += floor(i / out); + i %= out; + + // Insert `n` at position `i` of the output + output.splice(i++, 0, n); + + } + + return ucs2encode(output); + } + + /** + * Converts a string of Unicode symbols (e.g. a domain name label) to a + * Punycode string of ASCII-only symbols. + * @memberOf punycode + * @param {String} input The string of Unicode symbols. + * @returns {String} The resulting Punycode string of ASCII-only symbols. + */ + function encode(input) { + var n, + delta, + handledCPCount, + basicLength, + bias, + j, + m, + q, + k, + t, + currentValue, + output = [], + /** `inputLength` will hold the number of code points in `input`. */ + inputLength, + /** Cached calculation results */ + handledCPCountPlusOne, + baseMinusT, + qMinusT; + + // Convert the input in UCS-2 to Unicode + input = ucs2decode(input); + + // Cache the length + inputLength = input.length; + + // Initialize the state + n = initialN; + delta = 0; + bias = initialBias; + + // Handle the basic code points + for (j = 0; j < inputLength; ++j) { + currentValue = input[j]; + if (currentValue < 0x80) { + output.push(stringFromCharCode(currentValue)); + } + } + + handledCPCount = basicLength = output.length; + + // `handledCPCount` is the number of code points that have been handled; + // `basicLength` is the number of basic code points. + + // Finish the basic string - if it is not empty - with a delimiter + if (basicLength) { + output.push(delimiter); + } + + // Main encoding loop: + while (handledCPCount < inputLength) { + + // All non-basic code points < n have been handled already. Find the next + // larger one: + for (m = maxInt, j = 0; j < inputLength; ++j) { + currentValue = input[j]; + if (currentValue >= n && currentValue < m) { + m = currentValue; + } + } + + // Increase `delta` enough to advance the decoder's state to , + // but guard against overflow + handledCPCountPlusOne = handledCPCount + 1; + if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) { + error('overflow'); + } + + delta += (m - n) * handledCPCountPlusOne; + n = m; + + for (j = 0; j < inputLength; ++j) { + currentValue = input[j]; + + if (currentValue < n && ++delta > maxInt) { + error('overflow'); + } + + if (currentValue == n) { + // Represent delta as a generalized variable-length integer + for (q = delta, k = base; /* no condition */; k += base) { + t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); + if (q < t) { + break; + } + qMinusT = q - t; + baseMinusT = base - t; + output.push( + stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0)) + ); + q = floor(qMinusT / baseMinusT); + } + + output.push(stringFromCharCode(digitToBasic(q, 0))); + bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength); + delta = 0; + ++handledCPCount; + } + } + + ++delta; + ++n; + + } + return output.join(''); + } + + /** + * Converts a Punycode string representing a domain name or an email address + * to Unicode. Only the Punycoded parts of the input will be converted, i.e. + * it doesn't matter if you call it on a string that has already been + * converted to Unicode. + * @memberOf punycode + * @param {String} input The Punycoded domain name or email address to + * convert to Unicode. + * @returns {String} The Unicode representation of the given Punycode + * string. + */ + function toUnicode(input) { + return mapDomain(input, function(string) { + return regexPunycode.test(string) + ? decode(string.slice(4).toLowerCase()) + : string; + }); + } + + /** + * Converts a Unicode string representing a domain name or an email address to + * Punycode. Only the non-ASCII parts of the domain name will be converted, + * i.e. it doesn't matter if you call it with a domain that's already in + * ASCII. + * @memberOf punycode + * @param {String} input The domain name or email address to convert, as a + * Unicode string. + * @returns {String} The Punycode representation of the given domain name or + * email address. + */ + function toASCII(input) { + return mapDomain(input, function(string) { + return regexNonASCII.test(string) + ? 'xn--' + encode(string) + : string; + }); + } + + /*--------------------------------------------------------------------------*/ + + /** Define the public API */ + punycode = { + /** + * A string representing the current Punycode.js version number. + * @memberOf punycode + * @type String + */ + 'version': '1.4.1', + /** + * An object of methods to convert from JavaScript's internal character + * representation (UCS-2) to Unicode code points, and back. + * @see + * @memberOf punycode + * @type Object + */ + 'ucs2': { + 'decode': ucs2decode, + 'encode': ucs2encode + }, + 'decode': decode, + 'encode': encode, + 'toASCII': toASCII, + 'toUnicode': toUnicode + }; + + /** Expose `punycode` */ + // Some AMD build optimizers, like r.js, check for specific condition patterns + // like the following: + if ( + typeof define == 'function' && + typeof define.amd == 'object' && + define.amd + ) { + define('punycode', function() { + return punycode; + }); + } else if (freeExports && freeModule) { + if (module.exports == freeExports) { + // in Node.js, io.js, or RingoJS v0.8.0+ + freeModule.exports = punycode; + } else { + // in Narwhal or RingoJS v0.7.0- + for (key in punycode) { + punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]); + } + } + } else { + // in Rhino or a web browser + root.punycode = punycode; + } + +}(this)); + +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) + +},{}],727:[function(require,module,exports){ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +'use strict'; + +// If obj.hasOwnProperty has been overridden, then calling +// obj.hasOwnProperty(prop) will break. +// See: https://github.com/joyent/node/issues/1707 +function hasOwnProperty(obj, prop) { + return Object.prototype.hasOwnProperty.call(obj, prop); +} + +module.exports = function(qs, sep, eq, options) { + sep = sep || '&'; + eq = eq || '='; + var obj = {}; + + if (typeof qs !== 'string' || qs.length === 0) { + return obj; + } + + var regexp = /\+/g; + qs = qs.split(sep); + + var maxKeys = 1000; + if (options && typeof options.maxKeys === 'number') { + maxKeys = options.maxKeys; + } + + var len = qs.length; + // maxKeys <= 0 means that we should not limit keys count + if (maxKeys > 0 && len > maxKeys) { + len = maxKeys; + } + + for (var i = 0; i < len; ++i) { + var x = qs[i].replace(regexp, '%20'), + idx = x.indexOf(eq), + kstr, vstr, k, v; + + if (idx >= 0) { + kstr = x.substr(0, idx); + vstr = x.substr(idx + 1); + } else { + kstr = x; + vstr = ''; + } + + k = decodeURIComponent(kstr); + v = decodeURIComponent(vstr); + + if (!hasOwnProperty(obj, k)) { + obj[k] = v; + } else if (isArray(obj[k])) { + obj[k].push(v); + } else { + obj[k] = [obj[k], v]; + } + } + + return obj; +}; + +var isArray = Array.isArray || function (xs) { + return Object.prototype.toString.call(xs) === '[object Array]'; +}; + +},{}],728:[function(require,module,exports){ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +'use strict'; + +var stringifyPrimitive = function(v) { + switch (typeof v) { + case 'string': + return v; + + case 'boolean': + return v ? 'true' : 'false'; + + case 'number': + return isFinite(v) ? v : ''; + + default: + return ''; + } +}; + +module.exports = function(obj, sep, eq, name) { + sep = sep || '&'; + eq = eq || '='; + if (obj === null) { + obj = undefined; + } + + if (typeof obj === 'object') { + return map(objectKeys(obj), function(k) { + var ks = encodeURIComponent(stringifyPrimitive(k)) + eq; + if (isArray(obj[k])) { + return map(obj[k], function(v) { + return ks + encodeURIComponent(stringifyPrimitive(v)); + }).join(sep); + } else { + return ks + encodeURIComponent(stringifyPrimitive(obj[k])); + } + }).join(sep); + + } + + if (!name) return ''; + return encodeURIComponent(stringifyPrimitive(name)) + eq + + encodeURIComponent(stringifyPrimitive(obj)); +}; + +var isArray = Array.isArray || function (xs) { + return Object.prototype.toString.call(xs) === '[object Array]'; +}; + +function map (xs, f) { + if (xs.map) return xs.map(f); + var res = []; + for (var i = 0; i < xs.length; i++) { + res.push(f(xs[i], i)); + } + return res; +} + +var objectKeys = Object.keys || function (obj) { + var res = []; + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) res.push(key); + } + return res; +}; + +},{}],729:[function(require,module,exports){ +'use strict'; + +exports.decode = exports.parse = require('./decode'); +exports.encode = exports.stringify = require('./encode'); + +},{"./decode":727,"./encode":728}],730:[function(require,module,exports){ /** * Copyright (c) 2014-present, Facebook, Inc. * @@ -65720,7 +67358,4221 @@ try { } } -},{}],697:[function(require,module,exports){ +},{}],731:[function(require,module,exports){ +/*! safe-buffer. MIT License. Feross Aboukhadijeh */ +/* eslint-disable node/no-deprecated-api */ +var buffer = require('buffer') +var Buffer = buffer.Buffer + +// alternative to using Object.keys for old browsers +function copyProps (src, dst) { + for (var key in src) { + dst[key] = src[key] + } +} +if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) { + module.exports = buffer +} else { + // Copy properties from require('buffer') + copyProps(buffer, exports) + exports.Buffer = SafeBuffer +} + +function SafeBuffer (arg, encodingOrOffset, length) { + return Buffer(arg, encodingOrOffset, length) +} + +SafeBuffer.prototype = Object.create(Buffer.prototype) + +// Copy static methods from Buffer +copyProps(Buffer, SafeBuffer) + +SafeBuffer.from = function (arg, encodingOrOffset, length) { + if (typeof arg === 'number') { + throw new TypeError('Argument must not be a number') + } + return Buffer(arg, encodingOrOffset, length) +} + +SafeBuffer.alloc = function (size, fill, encoding) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + var buf = Buffer(size) + if (fill !== undefined) { + if (typeof encoding === 'string') { + buf.fill(fill, encoding) + } else { + buf.fill(fill) + } + } else { + buf.fill(0) + } + return buf +} + +SafeBuffer.allocUnsafe = function (size) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + return Buffer(size) +} + +SafeBuffer.allocUnsafeSlow = function (size) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + return buffer.SlowBuffer(size) +} + +},{"buffer":81}],732:[function(require,module,exports){ +(function (global){(function (){ +var ClientRequest = require('./lib/request') +var response = require('./lib/response') +var extend = require('xtend') +var statusCodes = require('builtin-status-codes') +var url = require('url') + +var http = exports + +http.request = function (opts, cb) { + if (typeof opts === 'string') + opts = url.parse(opts) + else + opts = extend(opts) + + // Normally, the page is loaded from http or https, so not specifying a protocol + // will result in a (valid) protocol-relative url. However, this won't work if + // the protocol is something else, like 'file:' + var defaultProtocol = global.location.protocol.search(/^https?:$/) === -1 ? 'http:' : '' + + var protocol = opts.protocol || defaultProtocol + var host = opts.hostname || opts.host + var port = opts.port + var path = opts.path || '/' + + // Necessary for IPv6 addresses + if (host && host.indexOf(':') !== -1) + host = '[' + host + ']' + + // This may be a relative url. The browser should always be able to interpret it correctly. + opts.url = (host ? (protocol + '//' + host) : '') + (port ? ':' + port : '') + path + opts.method = (opts.method || 'GET').toUpperCase() + opts.headers = opts.headers || {} + + // Also valid opts.auth, opts.mode + + var req = new ClientRequest(opts) + if (cb) + req.on('response', cb) + return req +} + +http.get = function get (opts, cb) { + var req = http.request(opts, cb) + req.end() + return req +} + +http.ClientRequest = ClientRequest +http.IncomingMessage = response.IncomingMessage + +http.Agent = function () {} +http.Agent.defaultMaxSockets = 4 + +http.globalAgent = new http.Agent() + +http.STATUS_CODES = statusCodes + +http.METHODS = [ + 'CHECKOUT', + 'CONNECT', + 'COPY', + 'DELETE', + 'GET', + 'HEAD', + 'LOCK', + 'M-SEARCH', + 'MERGE', + 'MKACTIVITY', + 'MKCOL', + 'MOVE', + 'NOTIFY', + 'OPTIONS', + 'PATCH', + 'POST', + 'PROPFIND', + 'PROPPATCH', + 'PURGE', + 'PUT', + 'REPORT', + 'SEARCH', + 'SUBSCRIBE', + 'TRACE', + 'UNLOCK', + 'UNSUBSCRIBE' +] +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) + +},{"./lib/request":734,"./lib/response":735,"builtin-status-codes":82,"url":753,"xtend":756}],733:[function(require,module,exports){ +(function (global){(function (){ +exports.fetch = isFunction(global.fetch) && isFunction(global.ReadableStream) + +exports.writableStream = isFunction(global.WritableStream) + +exports.abortController = isFunction(global.AbortController) + +// The xhr request to example.com may violate some restrictive CSP configurations, +// so if we're running in a browser that supports `fetch`, avoid calling getXHR() +// and assume support for certain features below. +var xhr +function getXHR () { + // Cache the xhr value + if (xhr !== undefined) return xhr + + if (global.XMLHttpRequest) { + xhr = new global.XMLHttpRequest() + // If XDomainRequest is available (ie only, where xhr might not work + // cross domain), use the page location. Otherwise use example.com + // Note: this doesn't actually make an http request. + try { + xhr.open('GET', global.XDomainRequest ? '/' : 'https://example.com') + } catch(e) { + xhr = null + } + } else { + // Service workers don't have XHR + xhr = null + } + return xhr +} + +function checkTypeSupport (type) { + var xhr = getXHR() + if (!xhr) return false + try { + xhr.responseType = type + return xhr.responseType === type + } catch (e) {} + return false +} + +// If fetch is supported, then arraybuffer will be supported too. Skip calling +// checkTypeSupport(), since that calls getXHR(). +exports.arraybuffer = exports.fetch || checkTypeSupport('arraybuffer') + +// These next two tests unavoidably show warnings in Chrome. Since fetch will always +// be used if it's available, just return false for these to avoid the warnings. +exports.msstream = !exports.fetch && checkTypeSupport('ms-stream') +exports.mozchunkedarraybuffer = !exports.fetch && checkTypeSupport('moz-chunked-arraybuffer') + +// If fetch is supported, then overrideMimeType will be supported too. Skip calling +// getXHR(). +exports.overrideMimeType = exports.fetch || (getXHR() ? isFunction(getXHR().overrideMimeType) : false) + +function isFunction (value) { + return typeof value === 'function' +} + +xhr = null // Help gc + +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) + +},{}],734:[function(require,module,exports){ +(function (process,global,Buffer){(function (){ +var capability = require('./capability') +var inherits = require('inherits') +var response = require('./response') +var stream = require('readable-stream') + +var IncomingMessage = response.IncomingMessage +var rStates = response.readyStates + +function decideMode (preferBinary, useFetch) { + if (capability.fetch && useFetch) { + return 'fetch' + } else if (capability.mozchunkedarraybuffer) { + return 'moz-chunked-arraybuffer' + } else if (capability.msstream) { + return 'ms-stream' + } else if (capability.arraybuffer && preferBinary) { + return 'arraybuffer' + } else { + return 'text' + } +} + +var ClientRequest = module.exports = function (opts) { + var self = this + stream.Writable.call(self) + + self._opts = opts + self._body = [] + self._headers = {} + if (opts.auth) + self.setHeader('Authorization', 'Basic ' + Buffer.from(opts.auth).toString('base64')) + Object.keys(opts.headers).forEach(function (name) { + self.setHeader(name, opts.headers[name]) + }) + + var preferBinary + var useFetch = true + if (opts.mode === 'disable-fetch' || ('requestTimeout' in opts && !capability.abortController)) { + // If the use of XHR should be preferred. Not typically needed. + useFetch = false + preferBinary = true + } else if (opts.mode === 'prefer-streaming') { + // If streaming is a high priority but binary compatibility and + // the accuracy of the 'content-type' header aren't + preferBinary = false + } else if (opts.mode === 'allow-wrong-content-type') { + // If streaming is more important than preserving the 'content-type' header + preferBinary = !capability.overrideMimeType + } else if (!opts.mode || opts.mode === 'default' || opts.mode === 'prefer-fast') { + // Use binary if text streaming may corrupt data or the content-type header, or for speed + preferBinary = true + } else { + throw new Error('Invalid value for opts.mode') + } + self._mode = decideMode(preferBinary, useFetch) + self._fetchTimer = null + self._socketTimeout = null + self._socketTimer = null + + self.on('finish', function () { + self._onFinish() + }) +} + +inherits(ClientRequest, stream.Writable) + +ClientRequest.prototype.setHeader = function (name, value) { + var self = this + var lowerName = name.toLowerCase() + // This check is not necessary, but it prevents warnings from browsers about setting unsafe + // headers. To be honest I'm not entirely sure hiding these warnings is a good thing, but + // http-browserify did it, so I will too. + if (unsafeHeaders.indexOf(lowerName) !== -1) + return + + self._headers[lowerName] = { + name: name, + value: value + } +} + +ClientRequest.prototype.getHeader = function (name) { + var header = this._headers[name.toLowerCase()] + if (header) + return header.value + return null +} + +ClientRequest.prototype.removeHeader = function (name) { + var self = this + delete self._headers[name.toLowerCase()] +} + +ClientRequest.prototype._onFinish = function () { + var self = this + + if (self._destroyed) + return + var opts = self._opts + + if ('timeout' in opts && opts.timeout !== 0) { + self.setTimeout(opts.timeout) + } + + var headersObj = self._headers + var body = null + if (opts.method !== 'GET' && opts.method !== 'HEAD') { + body = new Blob(self._body, { + type: (headersObj['content-type'] || {}).value || '' + }); + } + + // create flattened list of headers + var headersList = [] + Object.keys(headersObj).forEach(function (keyName) { + var name = headersObj[keyName].name + var value = headersObj[keyName].value + if (Array.isArray(value)) { + value.forEach(function (v) { + headersList.push([name, v]) + }) + } else { + headersList.push([name, value]) + } + }) + + if (self._mode === 'fetch') { + var signal = null + if (capability.abortController) { + var controller = new AbortController() + signal = controller.signal + self._fetchAbortController = controller + + if ('requestTimeout' in opts && opts.requestTimeout !== 0) { + self._fetchTimer = global.setTimeout(function () { + self.emit('requestTimeout') + if (self._fetchAbortController) + self._fetchAbortController.abort() + }, opts.requestTimeout) + } + } + + global.fetch(self._opts.url, { + method: self._opts.method, + headers: headersList, + body: body || undefined, + mode: 'cors', + credentials: opts.withCredentials ? 'include' : 'same-origin', + signal: signal + }).then(function (response) { + self._fetchResponse = response + self._resetTimers(false) + self._connect() + }, function (reason) { + self._resetTimers(true) + if (!self._destroyed) + self.emit('error', reason) + }) + } else { + var xhr = self._xhr = new global.XMLHttpRequest() + try { + xhr.open(self._opts.method, self._opts.url, true) + } catch (err) { + process.nextTick(function () { + self.emit('error', err) + }) + return + } + + // Can't set responseType on really old browsers + if ('responseType' in xhr) + xhr.responseType = self._mode + + if ('withCredentials' in xhr) + xhr.withCredentials = !!opts.withCredentials + + if (self._mode === 'text' && 'overrideMimeType' in xhr) + xhr.overrideMimeType('text/plain; charset=x-user-defined') + + if ('requestTimeout' in opts) { + xhr.timeout = opts.requestTimeout + xhr.ontimeout = function () { + self.emit('requestTimeout') + } + } + + headersList.forEach(function (header) { + xhr.setRequestHeader(header[0], header[1]) + }) + + self._response = null + xhr.onreadystatechange = function () { + switch (xhr.readyState) { + case rStates.LOADING: + case rStates.DONE: + self._onXHRProgress() + break + } + } + // Necessary for streaming in Firefox, since xhr.response is ONLY defined + // in onprogress, not in onreadystatechange with xhr.readyState = 3 + if (self._mode === 'moz-chunked-arraybuffer') { + xhr.onprogress = function () { + self._onXHRProgress() + } + } + + xhr.onerror = function () { + if (self._destroyed) + return + self._resetTimers(true) + self.emit('error', new Error('XHR error')) + } + + try { + xhr.send(body) + } catch (err) { + process.nextTick(function () { + self.emit('error', err) + }) + return + } + } +} + +/** + * Checks if xhr.status is readable and non-zero, indicating no error. + * Even though the spec says it should be available in readyState 3, + * accessing it throws an exception in IE8 + */ +function statusValid (xhr) { + try { + var status = xhr.status + return (status !== null && status !== 0) + } catch (e) { + return false + } +} + +ClientRequest.prototype._onXHRProgress = function () { + var self = this + + self._resetTimers(false) + + if (!statusValid(self._xhr) || self._destroyed) + return + + if (!self._response) + self._connect() + + self._response._onXHRProgress(self._resetTimers.bind(self)) +} + +ClientRequest.prototype._connect = function () { + var self = this + + if (self._destroyed) + return + + self._response = new IncomingMessage(self._xhr, self._fetchResponse, self._mode, self._resetTimers.bind(self)) + self._response.on('error', function(err) { + self.emit('error', err) + }) + + self.emit('response', self._response) +} + +ClientRequest.prototype._write = function (chunk, encoding, cb) { + var self = this + + self._body.push(chunk) + cb() +} + +ClientRequest.prototype._resetTimers = function (done) { + var self = this + + global.clearTimeout(self._socketTimer) + self._socketTimer = null + + if (done) { + global.clearTimeout(self._fetchTimer) + self._fetchTimer = null + } else if (self._socketTimeout) { + self._socketTimer = global.setTimeout(function () { + self.emit('timeout') + }, self._socketTimeout) + } +} + +ClientRequest.prototype.abort = ClientRequest.prototype.destroy = function (err) { + var self = this + self._destroyed = true + self._resetTimers(true) + if (self._response) + self._response._destroyed = true + if (self._xhr) + self._xhr.abort() + else if (self._fetchAbortController) + self._fetchAbortController.abort() + + if (err) + self.emit('error', err) +} + +ClientRequest.prototype.end = function (data, encoding, cb) { + var self = this + if (typeof data === 'function') { + cb = data + data = undefined + } + + stream.Writable.prototype.end.call(self, data, encoding, cb) +} + +ClientRequest.prototype.setTimeout = function (timeout, cb) { + var self = this + + if (cb) + self.once('timeout', cb) + + self._socketTimeout = timeout + self._resetTimers(false) +} + +ClientRequest.prototype.flushHeaders = function () {} +ClientRequest.prototype.setNoDelay = function () {} +ClientRequest.prototype.setSocketKeepAlive = function () {} + +// Taken from http://www.w3.org/TR/XMLHttpRequest/#the-setrequestheader%28%29-method +var unsafeHeaders = [ + 'accept-charset', + 'accept-encoding', + 'access-control-request-headers', + 'access-control-request-method', + 'connection', + 'content-length', + 'cookie', + 'cookie2', + 'date', + 'dnt', + 'expect', + 'host', + 'keep-alive', + 'origin', + 'referer', + 'te', + 'trailer', + 'transfer-encoding', + 'upgrade', + 'via' +] + +}).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer) + +},{"./capability":733,"./response":735,"_process":714,"buffer":81,"inherits":88,"readable-stream":750}],735:[function(require,module,exports){ +(function (process,global,Buffer){(function (){ +var capability = require('./capability') +var inherits = require('inherits') +var stream = require('readable-stream') + +var rStates = exports.readyStates = { + UNSENT: 0, + OPENED: 1, + HEADERS_RECEIVED: 2, + LOADING: 3, + DONE: 4 +} + +var IncomingMessage = exports.IncomingMessage = function (xhr, response, mode, resetTimers) { + var self = this + stream.Readable.call(self) + + self._mode = mode + self.headers = {} + self.rawHeaders = [] + self.trailers = {} + self.rawTrailers = [] + + // Fake the 'close' event, but only once 'end' fires + self.on('end', function () { + // The nextTick is necessary to prevent the 'request' module from causing an infinite loop + process.nextTick(function () { + self.emit('close') + }) + }) + + if (mode === 'fetch') { + self._fetchResponse = response + + self.url = response.url + self.statusCode = response.status + self.statusMessage = response.statusText + + response.headers.forEach(function (header, key){ + self.headers[key.toLowerCase()] = header + self.rawHeaders.push(key, header) + }) + + if (capability.writableStream) { + var writable = new WritableStream({ + write: function (chunk) { + resetTimers(false) + return new Promise(function (resolve, reject) { + if (self._destroyed) { + reject() + } else if(self.push(Buffer.from(chunk))) { + resolve() + } else { + self._resumeFetch = resolve + } + }) + }, + close: function () { + resetTimers(true) + if (!self._destroyed) + self.push(null) + }, + abort: function (err) { + resetTimers(true) + if (!self._destroyed) + self.emit('error', err) + } + }) + + try { + response.body.pipeTo(writable).catch(function (err) { + resetTimers(true) + if (!self._destroyed) + self.emit('error', err) + }) + return + } catch (e) {} // pipeTo method isn't defined. Can't find a better way to feature test this + } + // fallback for when writableStream or pipeTo aren't available + var reader = response.body.getReader() + function read () { + reader.read().then(function (result) { + if (self._destroyed) + return + resetTimers(result.done) + if (result.done) { + self.push(null) + return + } + self.push(Buffer.from(result.value)) + read() + }).catch(function (err) { + resetTimers(true) + if (!self._destroyed) + self.emit('error', err) + }) + } + read() + } else { + self._xhr = xhr + self._pos = 0 + + self.url = xhr.responseURL + self.statusCode = xhr.status + self.statusMessage = xhr.statusText + var headers = xhr.getAllResponseHeaders().split(/\r?\n/) + headers.forEach(function (header) { + var matches = header.match(/^([^:]+):\s*(.*)/) + if (matches) { + var key = matches[1].toLowerCase() + if (key === 'set-cookie') { + if (self.headers[key] === undefined) { + self.headers[key] = [] + } + self.headers[key].push(matches[2]) + } else if (self.headers[key] !== undefined) { + self.headers[key] += ', ' + matches[2] + } else { + self.headers[key] = matches[2] + } + self.rawHeaders.push(matches[1], matches[2]) + } + }) + + self._charset = 'x-user-defined' + if (!capability.overrideMimeType) { + var mimeType = self.rawHeaders['mime-type'] + if (mimeType) { + var charsetMatch = mimeType.match(/;\s*charset=([^;])(;|$)/) + if (charsetMatch) { + self._charset = charsetMatch[1].toLowerCase() + } + } + if (!self._charset) + self._charset = 'utf-8' // best guess + } + } +} + +inherits(IncomingMessage, stream.Readable) + +IncomingMessage.prototype._read = function () { + var self = this + + var resolve = self._resumeFetch + if (resolve) { + self._resumeFetch = null + resolve() + } +} + +IncomingMessage.prototype._onXHRProgress = function (resetTimers) { + var self = this + + var xhr = self._xhr + + var response = null + switch (self._mode) { + case 'text': + response = xhr.responseText + if (response.length > self._pos) { + var newData = response.substr(self._pos) + if (self._charset === 'x-user-defined') { + var buffer = Buffer.alloc(newData.length) + for (var i = 0; i < newData.length; i++) + buffer[i] = newData.charCodeAt(i) & 0xff + + self.push(buffer) + } else { + self.push(newData, self._charset) + } + self._pos = response.length + } + break + case 'arraybuffer': + if (xhr.readyState !== rStates.DONE || !xhr.response) + break + response = xhr.response + self.push(Buffer.from(new Uint8Array(response))) + break + case 'moz-chunked-arraybuffer': // take whole + response = xhr.response + if (xhr.readyState !== rStates.LOADING || !response) + break + self.push(Buffer.from(new Uint8Array(response))) + break + case 'ms-stream': + response = xhr.response + if (xhr.readyState !== rStates.LOADING) + break + var reader = new global.MSStreamReader() + reader.onprogress = function () { + if (reader.result.byteLength > self._pos) { + self.push(Buffer.from(new Uint8Array(reader.result.slice(self._pos)))) + self._pos = reader.result.byteLength + } + } + reader.onload = function () { + resetTimers(true) + self.push(null) + } + // reader.onerror = ??? // TODO: this + reader.readAsArrayBuffer(response) + break + } + + // The ms-stream case handles end separately in reader.onload() + if (self._xhr.readyState === rStates.DONE && self._mode !== 'ms-stream') { + resetTimers(true) + self.push(null) + } +} + +}).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer) + +},{"./capability":733,"_process":714,"buffer":81,"inherits":88,"readable-stream":750}],736:[function(require,module,exports){ +'use strict'; + +function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; } + +var codes = {}; + +function createErrorType(code, message, Base) { + if (!Base) { + Base = Error; + } + + function getMessage(arg1, arg2, arg3) { + if (typeof message === 'string') { + return message; + } else { + return message(arg1, arg2, arg3); + } + } + + var NodeError = + /*#__PURE__*/ + function (_Base) { + _inheritsLoose(NodeError, _Base); + + function NodeError(arg1, arg2, arg3) { + return _Base.call(this, getMessage(arg1, arg2, arg3)) || this; + } + + return NodeError; + }(Base); + + NodeError.prototype.name = Base.name; + NodeError.prototype.code = code; + codes[code] = NodeError; +} // https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js + + +function oneOf(expected, thing) { + if (Array.isArray(expected)) { + var len = expected.length; + expected = expected.map(function (i) { + return String(i); + }); + + if (len > 2) { + return "one of ".concat(thing, " ").concat(expected.slice(0, len - 1).join(', '), ", or ") + expected[len - 1]; + } else if (len === 2) { + return "one of ".concat(thing, " ").concat(expected[0], " or ").concat(expected[1]); + } else { + return "of ".concat(thing, " ").concat(expected[0]); + } + } else { + return "of ".concat(thing, " ").concat(String(expected)); + } +} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith + + +function startsWith(str, search, pos) { + return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search; +} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith + + +function endsWith(str, search, this_len) { + if (this_len === undefined || this_len > str.length) { + this_len = str.length; + } + + return str.substring(this_len - search.length, this_len) === search; +} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes + + +function includes(str, search, start) { + if (typeof start !== 'number') { + start = 0; + } + + if (start + search.length > str.length) { + return false; + } else { + return str.indexOf(search, start) !== -1; + } +} + +createErrorType('ERR_INVALID_OPT_VALUE', function (name, value) { + return 'The value "' + value + '" is invalid for option "' + name + '"'; +}, TypeError); +createErrorType('ERR_INVALID_ARG_TYPE', function (name, expected, actual) { + // determiner: 'must be' or 'must not be' + var determiner; + + if (typeof expected === 'string' && startsWith(expected, 'not ')) { + determiner = 'must not be'; + expected = expected.replace(/^not /, ''); + } else { + determiner = 'must be'; + } + + var msg; + + if (endsWith(name, ' argument')) { + // For cases like 'first argument' + msg = "The ".concat(name, " ").concat(determiner, " ").concat(oneOf(expected, 'type')); + } else { + var type = includes(name, '.') ? 'property' : 'argument'; + msg = "The \"".concat(name, "\" ").concat(type, " ").concat(determiner, " ").concat(oneOf(expected, 'type')); + } + + msg += ". Received type ".concat(typeof actual); + return msg; +}, TypeError); +createErrorType('ERR_STREAM_PUSH_AFTER_EOF', 'stream.push() after EOF'); +createErrorType('ERR_METHOD_NOT_IMPLEMENTED', function (name) { + return 'The ' + name + ' method is not implemented'; +}); +createErrorType('ERR_STREAM_PREMATURE_CLOSE', 'Premature close'); +createErrorType('ERR_STREAM_DESTROYED', function (name) { + return 'Cannot call ' + name + ' after a stream was destroyed'; +}); +createErrorType('ERR_MULTIPLE_CALLBACK', 'Callback called multiple times'); +createErrorType('ERR_STREAM_CANNOT_PIPE', 'Cannot pipe, not readable'); +createErrorType('ERR_STREAM_WRITE_AFTER_END', 'write after end'); +createErrorType('ERR_STREAM_NULL_VALUES', 'May not write null values to stream', TypeError); +createErrorType('ERR_UNKNOWN_ENCODING', function (arg) { + return 'Unknown encoding: ' + arg; +}, TypeError); +createErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event'); +module.exports.codes = codes; + +},{}],737:[function(require,module,exports){ +(function (process){(function (){ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. +// a duplex stream is just a stream that is both readable and writable. +// Since JS doesn't have multiple prototypal inheritance, this class +// prototypally inherits from Readable, and then parasitically from +// Writable. +'use strict'; +/**/ + +var objectKeys = Object.keys || function (obj) { + var keys = []; + + for (var key in obj) { + keys.push(key); + } + + return keys; +}; +/**/ + + +module.exports = Duplex; + +var Readable = require('./_stream_readable'); + +var Writable = require('./_stream_writable'); + +require('inherits')(Duplex, Readable); + +{ + // Allow the keys array to be GC'ed. + var keys = objectKeys(Writable.prototype); + + for (var v = 0; v < keys.length; v++) { + var method = keys[v]; + if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method]; + } +} + +function Duplex(options) { + if (!(this instanceof Duplex)) return new Duplex(options); + Readable.call(this, options); + Writable.call(this, options); + this.allowHalfOpen = true; + + if (options) { + if (options.readable === false) this.readable = false; + if (options.writable === false) this.writable = false; + + if (options.allowHalfOpen === false) { + this.allowHalfOpen = false; + this.once('end', onend); + } + } +} + +Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState.highWaterMark; + } +}); +Object.defineProperty(Duplex.prototype, 'writableBuffer', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState && this._writableState.getBuffer(); + } +}); +Object.defineProperty(Duplex.prototype, 'writableLength', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState.length; + } +}); // the no-half-open enforcer + +function onend() { + // If the writable side ended, then we're ok. + if (this._writableState.ended) return; // no more data can be written. + // But allow more writes to happen in this tick. + + process.nextTick(onEndNT, this); +} + +function onEndNT(self) { + self.end(); +} + +Object.defineProperty(Duplex.prototype, 'destroyed', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + if (this._readableState === undefined || this._writableState === undefined) { + return false; + } + + return this._readableState.destroyed && this._writableState.destroyed; + }, + set: function set(value) { + // we ignore the value if the stream + // has not been initialized yet + if (this._readableState === undefined || this._writableState === undefined) { + return; + } // backward compatibility, the user is explicitly + // managing destroyed + + + this._readableState.destroyed = value; + this._writableState.destroyed = value; + } +}); +}).call(this)}).call(this,require('_process')) + +},{"./_stream_readable":739,"./_stream_writable":741,"_process":714,"inherits":88}],738:[function(require,module,exports){ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. +// a passthrough stream. +// basically just the most minimal sort of Transform stream. +// Every written chunk gets output as-is. +'use strict'; + +module.exports = PassThrough; + +var Transform = require('./_stream_transform'); + +require('inherits')(PassThrough, Transform); + +function PassThrough(options) { + if (!(this instanceof PassThrough)) return new PassThrough(options); + Transform.call(this, options); +} + +PassThrough.prototype._transform = function (chunk, encoding, cb) { + cb(null, chunk); +}; +},{"./_stream_transform":740,"inherits":88}],739:[function(require,module,exports){ +(function (process,global){(function (){ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. +'use strict'; + +module.exports = Readable; +/**/ + +var Duplex; +/**/ + +Readable.ReadableState = ReadableState; +/**/ + +var EE = require('events').EventEmitter; + +var EElistenerCount = function EElistenerCount(emitter, type) { + return emitter.listeners(type).length; +}; +/**/ + +/**/ + + +var Stream = require('./internal/streams/stream'); +/**/ + + +var Buffer = require('buffer').Buffer; + +var OurUint8Array = global.Uint8Array || function () {}; + +function _uint8ArrayToBuffer(chunk) { + return Buffer.from(chunk); +} + +function _isUint8Array(obj) { + return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; +} +/**/ + + +var debugUtil = require('util'); + +var debug; + +if (debugUtil && debugUtil.debuglog) { + debug = debugUtil.debuglog('stream'); +} else { + debug = function debug() {}; +} +/**/ + + +var BufferList = require('./internal/streams/buffer_list'); + +var destroyImpl = require('./internal/streams/destroy'); + +var _require = require('./internal/streams/state'), + getHighWaterMark = _require.getHighWaterMark; + +var _require$codes = require('../errors').codes, + ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE, + ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF, + ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, + ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT; // Lazy loaded to improve the startup performance. + + +var StringDecoder; +var createReadableStreamAsyncIterator; +var from; + +require('inherits')(Readable, Stream); + +var errorOrDestroy = destroyImpl.errorOrDestroy; +var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume']; + +function prependListener(emitter, event, fn) { + // Sadly this is not cacheable as some libraries bundle their own + // event emitter implementation with them. + if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn); // This is a hack to make sure that our error handler is attached before any + // userland ones. NEVER DO THIS. This is here only because this code needs + // to continue to work with older versions of Node.js that do not include + // the prependListener() method. The goal is to eventually remove this hack. + + if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (Array.isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]]; +} + +function ReadableState(options, stream, isDuplex) { + Duplex = Duplex || require('./_stream_duplex'); + options = options || {}; // Duplex streams are both readable and writable, but share + // the same options object. + // However, some cases require setting options to different + // values for the readable and the writable sides of the duplex stream. + // These options can be provided separately as readableXXX and writableXXX. + + if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; // object stream flag. Used to make read(n) ignore n and to + // make all the buffer merging and length checks go away + + this.objectMode = !!options.objectMode; + if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode; // the point at which it stops calling _read() to fill the buffer + // Note: 0 is a valid value, means "don't call _read preemptively ever" + + this.highWaterMark = getHighWaterMark(this, options, 'readableHighWaterMark', isDuplex); // A linked list is used to store data chunks instead of an array because the + // linked list can remove elements from the beginning faster than + // array.shift() + + this.buffer = new BufferList(); + this.length = 0; + this.pipes = null; + this.pipesCount = 0; + this.flowing = null; + this.ended = false; + this.endEmitted = false; + this.reading = false; // a flag to be able to tell if the event 'readable'/'data' is emitted + // immediately, or on a later tick. We set this to true at first, because + // any actions that shouldn't happen until "later" should generally also + // not happen before the first read call. + + this.sync = true; // whenever we return null, then we set a flag to say + // that we're awaiting a 'readable' event emission. + + this.needReadable = false; + this.emittedReadable = false; + this.readableListening = false; + this.resumeScheduled = false; + this.paused = true; // Should close be emitted on destroy. Defaults to true. + + this.emitClose = options.emitClose !== false; // Should .destroy() be called after 'end' (and potentially 'finish') + + this.autoDestroy = !!options.autoDestroy; // has it been destroyed + + this.destroyed = false; // Crypto is kind of old and crusty. Historically, its default string + // encoding is 'binary' so we have to make this configurable. + // Everything else in the universe uses 'utf8', though. + + this.defaultEncoding = options.defaultEncoding || 'utf8'; // the number of writers that are awaiting a drain event in .pipe()s + + this.awaitDrain = 0; // if true, a maybeReadMore has been scheduled + + this.readingMore = false; + this.decoder = null; + this.encoding = null; + + if (options.encoding) { + if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder; + this.decoder = new StringDecoder(options.encoding); + this.encoding = options.encoding; + } +} + +function Readable(options) { + Duplex = Duplex || require('./_stream_duplex'); + if (!(this instanceof Readable)) return new Readable(options); // Checking for a Stream.Duplex instance is faster here instead of inside + // the ReadableState constructor, at least with V8 6.5 + + var isDuplex = this instanceof Duplex; + this._readableState = new ReadableState(options, this, isDuplex); // legacy + + this.readable = true; + + if (options) { + if (typeof options.read === 'function') this._read = options.read; + if (typeof options.destroy === 'function') this._destroy = options.destroy; + } + + Stream.call(this); +} + +Object.defineProperty(Readable.prototype, 'destroyed', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + if (this._readableState === undefined) { + return false; + } + + return this._readableState.destroyed; + }, + set: function set(value) { + // we ignore the value if the stream + // has not been initialized yet + if (!this._readableState) { + return; + } // backward compatibility, the user is explicitly + // managing destroyed + + + this._readableState.destroyed = value; + } +}); +Readable.prototype.destroy = destroyImpl.destroy; +Readable.prototype._undestroy = destroyImpl.undestroy; + +Readable.prototype._destroy = function (err, cb) { + cb(err); +}; // Manually shove something into the read() buffer. +// This returns true if the highWaterMark has not been hit yet, +// similar to how Writable.write() returns true if you should +// write() some more. + + +Readable.prototype.push = function (chunk, encoding) { + var state = this._readableState; + var skipChunkCheck; + + if (!state.objectMode) { + if (typeof chunk === 'string') { + encoding = encoding || state.defaultEncoding; + + if (encoding !== state.encoding) { + chunk = Buffer.from(chunk, encoding); + encoding = ''; + } + + skipChunkCheck = true; + } + } else { + skipChunkCheck = true; + } + + return readableAddChunk(this, chunk, encoding, false, skipChunkCheck); +}; // Unshift should *always* be something directly out of read() + + +Readable.prototype.unshift = function (chunk) { + return readableAddChunk(this, chunk, null, true, false); +}; + +function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) { + debug('readableAddChunk', chunk); + var state = stream._readableState; + + if (chunk === null) { + state.reading = false; + onEofChunk(stream, state); + } else { + var er; + if (!skipChunkCheck) er = chunkInvalid(state, chunk); + + if (er) { + errorOrDestroy(stream, er); + } else if (state.objectMode || chunk && chunk.length > 0) { + if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) { + chunk = _uint8ArrayToBuffer(chunk); + } + + if (addToFront) { + if (state.endEmitted) errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT());else addChunk(stream, state, chunk, true); + } else if (state.ended) { + errorOrDestroy(stream, new ERR_STREAM_PUSH_AFTER_EOF()); + } else if (state.destroyed) { + return false; + } else { + state.reading = false; + + if (state.decoder && !encoding) { + chunk = state.decoder.write(chunk); + if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state); + } else { + addChunk(stream, state, chunk, false); + } + } + } else if (!addToFront) { + state.reading = false; + maybeReadMore(stream, state); + } + } // We can push more data if we are below the highWaterMark. + // Also, if we have no data yet, we can stand some more bytes. + // This is to work around cases where hwm=0, such as the repl. + + + return !state.ended && (state.length < state.highWaterMark || state.length === 0); +} + +function addChunk(stream, state, chunk, addToFront) { + if (state.flowing && state.length === 0 && !state.sync) { + state.awaitDrain = 0; + stream.emit('data', chunk); + } else { + // update the buffer info. + state.length += state.objectMode ? 1 : chunk.length; + if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk); + if (state.needReadable) emitReadable(stream); + } + + maybeReadMore(stream, state); +} + +function chunkInvalid(state, chunk) { + var er; + + if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) { + er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer', 'Uint8Array'], chunk); + } + + return er; +} + +Readable.prototype.isPaused = function () { + return this._readableState.flowing === false; +}; // backwards compatibility. + + +Readable.prototype.setEncoding = function (enc) { + if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder; + var decoder = new StringDecoder(enc); + this._readableState.decoder = decoder; // If setEncoding(null), decoder.encoding equals utf8 + + this._readableState.encoding = this._readableState.decoder.encoding; // Iterate over current buffer to convert already stored Buffers: + + var p = this._readableState.buffer.head; + var content = ''; + + while (p !== null) { + content += decoder.write(p.data); + p = p.next; + } + + this._readableState.buffer.clear(); + + if (content !== '') this._readableState.buffer.push(content); + this._readableState.length = content.length; + return this; +}; // Don't raise the hwm > 1GB + + +var MAX_HWM = 0x40000000; + +function computeNewHighWaterMark(n) { + if (n >= MAX_HWM) { + // TODO(ronag): Throw ERR_VALUE_OUT_OF_RANGE. + n = MAX_HWM; + } else { + // Get the next highest power of 2 to prevent increasing hwm excessively in + // tiny amounts + n--; + n |= n >>> 1; + n |= n >>> 2; + n |= n >>> 4; + n |= n >>> 8; + n |= n >>> 16; + n++; + } + + return n; +} // This function is designed to be inlinable, so please take care when making +// changes to the function body. + + +function howMuchToRead(n, state) { + if (n <= 0 || state.length === 0 && state.ended) return 0; + if (state.objectMode) return 1; + + if (n !== n) { + // Only flow one buffer at a time + if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length; + } // If we're asking for more than the current hwm, then raise the hwm. + + + if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n); + if (n <= state.length) return n; // Don't have enough + + if (!state.ended) { + state.needReadable = true; + return 0; + } + + return state.length; +} // you can override either this method, or the async _read(n) below. + + +Readable.prototype.read = function (n) { + debug('read', n); + n = parseInt(n, 10); + var state = this._readableState; + var nOrig = n; + if (n !== 0) state.emittedReadable = false; // if we're doing read(0) to trigger a readable event, but we + // already have a bunch of data in the buffer, then just trigger + // the 'readable' event and move on. + + if (n === 0 && state.needReadable && ((state.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || state.ended)) { + debug('read: emitReadable', state.length, state.ended); + if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this); + return null; + } + + n = howMuchToRead(n, state); // if we've ended, and we're now clear, then finish it up. + + if (n === 0 && state.ended) { + if (state.length === 0) endReadable(this); + return null; + } // All the actual chunk generation logic needs to be + // *below* the call to _read. The reason is that in certain + // synthetic stream cases, such as passthrough streams, _read + // may be a completely synchronous operation which may change + // the state of the read buffer, providing enough data when + // before there was *not* enough. + // + // So, the steps are: + // 1. Figure out what the state of things will be after we do + // a read from the buffer. + // + // 2. If that resulting state will trigger a _read, then call _read. + // Note that this may be asynchronous, or synchronous. Yes, it is + // deeply ugly to write APIs this way, but that still doesn't mean + // that the Readable class should behave improperly, as streams are + // designed to be sync/async agnostic. + // Take note if the _read call is sync or async (ie, if the read call + // has returned yet), so that we know whether or not it's safe to emit + // 'readable' etc. + // + // 3. Actually pull the requested chunks out of the buffer and return. + // if we need a readable event, then we need to do some reading. + + + var doRead = state.needReadable; + debug('need readable', doRead); // if we currently have less than the highWaterMark, then also read some + + if (state.length === 0 || state.length - n < state.highWaterMark) { + doRead = true; + debug('length less than watermark', doRead); + } // however, if we've ended, then there's no point, and if we're already + // reading, then it's unnecessary. + + + if (state.ended || state.reading) { + doRead = false; + debug('reading or ended', doRead); + } else if (doRead) { + debug('do read'); + state.reading = true; + state.sync = true; // if the length is currently zero, then we *need* a readable event. + + if (state.length === 0) state.needReadable = true; // call internal read method + + this._read(state.highWaterMark); + + state.sync = false; // If _read pushed data synchronously, then `reading` will be false, + // and we need to re-evaluate how much data we can return to the user. + + if (!state.reading) n = howMuchToRead(nOrig, state); + } + + var ret; + if (n > 0) ret = fromList(n, state);else ret = null; + + if (ret === null) { + state.needReadable = state.length <= state.highWaterMark; + n = 0; + } else { + state.length -= n; + state.awaitDrain = 0; + } + + if (state.length === 0) { + // If we have nothing in the buffer, then we want to know + // as soon as we *do* get something into the buffer. + if (!state.ended) state.needReadable = true; // If we tried to read() past the EOF, then emit end on the next tick. + + if (nOrig !== n && state.ended) endReadable(this); + } + + if (ret !== null) this.emit('data', ret); + return ret; +}; + +function onEofChunk(stream, state) { + debug('onEofChunk'); + if (state.ended) return; + + if (state.decoder) { + var chunk = state.decoder.end(); + + if (chunk && chunk.length) { + state.buffer.push(chunk); + state.length += state.objectMode ? 1 : chunk.length; + } + } + + state.ended = true; + + if (state.sync) { + // if we are sync, wait until next tick to emit the data. + // Otherwise we risk emitting data in the flow() + // the readable code triggers during a read() call + emitReadable(stream); + } else { + // emit 'readable' now to make sure it gets picked up. + state.needReadable = false; + + if (!state.emittedReadable) { + state.emittedReadable = true; + emitReadable_(stream); + } + } +} // Don't emit readable right away in sync mode, because this can trigger +// another read() call => stack overflow. This way, it might trigger +// a nextTick recursion warning, but that's not so bad. + + +function emitReadable(stream) { + var state = stream._readableState; + debug('emitReadable', state.needReadable, state.emittedReadable); + state.needReadable = false; + + if (!state.emittedReadable) { + debug('emitReadable', state.flowing); + state.emittedReadable = true; + process.nextTick(emitReadable_, stream); + } +} + +function emitReadable_(stream) { + var state = stream._readableState; + debug('emitReadable_', state.destroyed, state.length, state.ended); + + if (!state.destroyed && (state.length || state.ended)) { + stream.emit('readable'); + state.emittedReadable = false; + } // The stream needs another readable event if + // 1. It is not flowing, as the flow mechanism will take + // care of it. + // 2. It is not ended. + // 3. It is below the highWaterMark, so we can schedule + // another readable later. + + + state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark; + flow(stream); +} // at this point, the user has presumably seen the 'readable' event, +// and called read() to consume some data. that may have triggered +// in turn another _read(n) call, in which case reading = true if +// it's in progress. +// However, if we're not ended, or reading, and the length < hwm, +// then go ahead and try to read some more preemptively. + + +function maybeReadMore(stream, state) { + if (!state.readingMore) { + state.readingMore = true; + process.nextTick(maybeReadMore_, stream, state); + } +} + +function maybeReadMore_(stream, state) { + // Attempt to read more data if we should. + // + // The conditions for reading more data are (one of): + // - Not enough data buffered (state.length < state.highWaterMark). The loop + // is responsible for filling the buffer with enough data if such data + // is available. If highWaterMark is 0 and we are not in the flowing mode + // we should _not_ attempt to buffer any extra data. We'll get more data + // when the stream consumer calls read() instead. + // - No data in the buffer, and the stream is in flowing mode. In this mode + // the loop below is responsible for ensuring read() is called. Failing to + // call read here would abort the flow and there's no other mechanism for + // continuing the flow if the stream consumer has just subscribed to the + // 'data' event. + // + // In addition to the above conditions to keep reading data, the following + // conditions prevent the data from being read: + // - The stream has ended (state.ended). + // - There is already a pending 'read' operation (state.reading). This is a + // case where the the stream has called the implementation defined _read() + // method, but they are processing the call asynchronously and have _not_ + // called push() with new data. In this case we skip performing more + // read()s. The execution ends in this method again after the _read() ends + // up calling push() with more data. + while (!state.reading && !state.ended && (state.length < state.highWaterMark || state.flowing && state.length === 0)) { + var len = state.length; + debug('maybeReadMore read 0'); + stream.read(0); + if (len === state.length) // didn't get any data, stop spinning. + break; + } + + state.readingMore = false; +} // abstract method. to be overridden in specific implementation classes. +// call cb(er, data) where data is <= n in length. +// for virtual (non-string, non-buffer) streams, "length" is somewhat +// arbitrary, and perhaps not very meaningful. + + +Readable.prototype._read = function (n) { + errorOrDestroy(this, new ERR_METHOD_NOT_IMPLEMENTED('_read()')); +}; + +Readable.prototype.pipe = function (dest, pipeOpts) { + var src = this; + var state = this._readableState; + + switch (state.pipesCount) { + case 0: + state.pipes = dest; + break; + + case 1: + state.pipes = [state.pipes, dest]; + break; + + default: + state.pipes.push(dest); + break; + } + + state.pipesCount += 1; + debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts); + var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr; + var endFn = doEnd ? onend : unpipe; + if (state.endEmitted) process.nextTick(endFn);else src.once('end', endFn); + dest.on('unpipe', onunpipe); + + function onunpipe(readable, unpipeInfo) { + debug('onunpipe'); + + if (readable === src) { + if (unpipeInfo && unpipeInfo.hasUnpiped === false) { + unpipeInfo.hasUnpiped = true; + cleanup(); + } + } + } + + function onend() { + debug('onend'); + dest.end(); + } // when the dest drains, it reduces the awaitDrain counter + // on the source. This would be more elegant with a .once() + // handler in flow(), but adding and removing repeatedly is + // too slow. + + + var ondrain = pipeOnDrain(src); + dest.on('drain', ondrain); + var cleanedUp = false; + + function cleanup() { + debug('cleanup'); // cleanup event handlers once the pipe is broken + + dest.removeListener('close', onclose); + dest.removeListener('finish', onfinish); + dest.removeListener('drain', ondrain); + dest.removeListener('error', onerror); + dest.removeListener('unpipe', onunpipe); + src.removeListener('end', onend); + src.removeListener('end', unpipe); + src.removeListener('data', ondata); + cleanedUp = true; // if the reader is waiting for a drain event from this + // specific writer, then it would cause it to never start + // flowing again. + // So, if this is awaiting a drain, then we just call it now. + // If we don't know, then assume that we are waiting for one. + + if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain(); + } + + src.on('data', ondata); + + function ondata(chunk) { + debug('ondata'); + var ret = dest.write(chunk); + debug('dest.write', ret); + + if (ret === false) { + // If the user unpiped during `dest.write()`, it is possible + // to get stuck in a permanently paused state if that write + // also returned false. + // => Check whether `dest` is still a piping destination. + if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) { + debug('false write response, pause', state.awaitDrain); + state.awaitDrain++; + } + + src.pause(); + } + } // if the dest has an error, then stop piping into it. + // however, don't suppress the throwing behavior for this. + + + function onerror(er) { + debug('onerror', er); + unpipe(); + dest.removeListener('error', onerror); + if (EElistenerCount(dest, 'error') === 0) errorOrDestroy(dest, er); + } // Make sure our error handler is attached before userland ones. + + + prependListener(dest, 'error', onerror); // Both close and finish should trigger unpipe, but only once. + + function onclose() { + dest.removeListener('finish', onfinish); + unpipe(); + } + + dest.once('close', onclose); + + function onfinish() { + debug('onfinish'); + dest.removeListener('close', onclose); + unpipe(); + } + + dest.once('finish', onfinish); + + function unpipe() { + debug('unpipe'); + src.unpipe(dest); + } // tell the dest that it's being piped to + + + dest.emit('pipe', src); // start the flow if it hasn't been started already. + + if (!state.flowing) { + debug('pipe resume'); + src.resume(); + } + + return dest; +}; + +function pipeOnDrain(src) { + return function pipeOnDrainFunctionResult() { + var state = src._readableState; + debug('pipeOnDrain', state.awaitDrain); + if (state.awaitDrain) state.awaitDrain--; + + if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) { + state.flowing = true; + flow(src); + } + }; +} + +Readable.prototype.unpipe = function (dest) { + var state = this._readableState; + var unpipeInfo = { + hasUnpiped: false + }; // if we're not piping anywhere, then do nothing. + + if (state.pipesCount === 0) return this; // just one destination. most common case. + + if (state.pipesCount === 1) { + // passed in one, but it's not the right one. + if (dest && dest !== state.pipes) return this; + if (!dest) dest = state.pipes; // got a match. + + state.pipes = null; + state.pipesCount = 0; + state.flowing = false; + if (dest) dest.emit('unpipe', this, unpipeInfo); + return this; + } // slow case. multiple pipe destinations. + + + if (!dest) { + // remove all. + var dests = state.pipes; + var len = state.pipesCount; + state.pipes = null; + state.pipesCount = 0; + state.flowing = false; + + for (var i = 0; i < len; i++) { + dests[i].emit('unpipe', this, { + hasUnpiped: false + }); + } + + return this; + } // try to find the right one. + + + var index = indexOf(state.pipes, dest); + if (index === -1) return this; + state.pipes.splice(index, 1); + state.pipesCount -= 1; + if (state.pipesCount === 1) state.pipes = state.pipes[0]; + dest.emit('unpipe', this, unpipeInfo); + return this; +}; // set up data events if they are asked for +// Ensure readable listeners eventually get something + + +Readable.prototype.on = function (ev, fn) { + var res = Stream.prototype.on.call(this, ev, fn); + var state = this._readableState; + + if (ev === 'data') { + // update readableListening so that resume() may be a no-op + // a few lines down. This is needed to support once('readable'). + state.readableListening = this.listenerCount('readable') > 0; // Try start flowing on next tick if stream isn't explicitly paused + + if (state.flowing !== false) this.resume(); + } else if (ev === 'readable') { + if (!state.endEmitted && !state.readableListening) { + state.readableListening = state.needReadable = true; + state.flowing = false; + state.emittedReadable = false; + debug('on readable', state.length, state.reading); + + if (state.length) { + emitReadable(this); + } else if (!state.reading) { + process.nextTick(nReadingNextTick, this); + } + } + } + + return res; +}; + +Readable.prototype.addListener = Readable.prototype.on; + +Readable.prototype.removeListener = function (ev, fn) { + var res = Stream.prototype.removeListener.call(this, ev, fn); + + if (ev === 'readable') { + // We need to check if there is someone still listening to + // readable and reset the state. However this needs to happen + // after readable has been emitted but before I/O (nextTick) to + // support once('readable', fn) cycles. This means that calling + // resume within the same tick will have no + // effect. + process.nextTick(updateReadableListening, this); + } + + return res; +}; + +Readable.prototype.removeAllListeners = function (ev) { + var res = Stream.prototype.removeAllListeners.apply(this, arguments); + + if (ev === 'readable' || ev === undefined) { + // We need to check if there is someone still listening to + // readable and reset the state. However this needs to happen + // after readable has been emitted but before I/O (nextTick) to + // support once('readable', fn) cycles. This means that calling + // resume within the same tick will have no + // effect. + process.nextTick(updateReadableListening, this); + } + + return res; +}; + +function updateReadableListening(self) { + var state = self._readableState; + state.readableListening = self.listenerCount('readable') > 0; + + if (state.resumeScheduled && !state.paused) { + // flowing needs to be set to true now, otherwise + // the upcoming resume will not flow. + state.flowing = true; // crude way to check if we should resume + } else if (self.listenerCount('data') > 0) { + self.resume(); + } +} + +function nReadingNextTick(self) { + debug('readable nexttick read 0'); + self.read(0); +} // pause() and resume() are remnants of the legacy readable stream API +// If the user uses them, then switch into old mode. + + +Readable.prototype.resume = function () { + var state = this._readableState; + + if (!state.flowing) { + debug('resume'); // we flow only if there is no one listening + // for readable, but we still have to call + // resume() + + state.flowing = !state.readableListening; + resume(this, state); + } + + state.paused = false; + return this; +}; + +function resume(stream, state) { + if (!state.resumeScheduled) { + state.resumeScheduled = true; + process.nextTick(resume_, stream, state); + } +} + +function resume_(stream, state) { + debug('resume', state.reading); + + if (!state.reading) { + stream.read(0); + } + + state.resumeScheduled = false; + stream.emit('resume'); + flow(stream); + if (state.flowing && !state.reading) stream.read(0); +} + +Readable.prototype.pause = function () { + debug('call pause flowing=%j', this._readableState.flowing); + + if (this._readableState.flowing !== false) { + debug('pause'); + this._readableState.flowing = false; + this.emit('pause'); + } + + this._readableState.paused = true; + return this; +}; + +function flow(stream) { + var state = stream._readableState; + debug('flow', state.flowing); + + while (state.flowing && stream.read() !== null) { + ; + } +} // wrap an old-style stream as the async data source. +// This is *not* part of the readable stream interface. +// It is an ugly unfortunate mess of history. + + +Readable.prototype.wrap = function (stream) { + var _this = this; + + var state = this._readableState; + var paused = false; + stream.on('end', function () { + debug('wrapped end'); + + if (state.decoder && !state.ended) { + var chunk = state.decoder.end(); + if (chunk && chunk.length) _this.push(chunk); + } + + _this.push(null); + }); + stream.on('data', function (chunk) { + debug('wrapped data'); + if (state.decoder) chunk = state.decoder.write(chunk); // don't skip over falsy values in objectMode + + if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return; + + var ret = _this.push(chunk); + + if (!ret) { + paused = true; + stream.pause(); + } + }); // proxy all the other methods. + // important when wrapping filters and duplexes. + + for (var i in stream) { + if (this[i] === undefined && typeof stream[i] === 'function') { + this[i] = function methodWrap(method) { + return function methodWrapReturnFunction() { + return stream[method].apply(stream, arguments); + }; + }(i); + } + } // proxy certain important events. + + + for (var n = 0; n < kProxyEvents.length; n++) { + stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n])); + } // when we try to consume some more bytes, simply unpause the + // underlying stream. + + + this._read = function (n) { + debug('wrapped _read', n); + + if (paused) { + paused = false; + stream.resume(); + } + }; + + return this; +}; + +if (typeof Symbol === 'function') { + Readable.prototype[Symbol.asyncIterator] = function () { + if (createReadableStreamAsyncIterator === undefined) { + createReadableStreamAsyncIterator = require('./internal/streams/async_iterator'); + } + + return createReadableStreamAsyncIterator(this); + }; +} + +Object.defineProperty(Readable.prototype, 'readableHighWaterMark', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._readableState.highWaterMark; + } +}); +Object.defineProperty(Readable.prototype, 'readableBuffer', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._readableState && this._readableState.buffer; + } +}); +Object.defineProperty(Readable.prototype, 'readableFlowing', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._readableState.flowing; + }, + set: function set(state) { + if (this._readableState) { + this._readableState.flowing = state; + } + } +}); // exposed for testing purposes only. + +Readable._fromList = fromList; +Object.defineProperty(Readable.prototype, 'readableLength', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._readableState.length; + } +}); // Pluck off n bytes from an array of buffers. +// Length is the combined lengths of all the buffers in the list. +// This function is designed to be inlinable, so please take care when making +// changes to the function body. + +function fromList(n, state) { + // nothing buffered + if (state.length === 0) return null; + var ret; + if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) { + // read it all, truncate the list + if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.first();else ret = state.buffer.concat(state.length); + state.buffer.clear(); + } else { + // read part of list + ret = state.buffer.consume(n, state.decoder); + } + return ret; +} + +function endReadable(stream) { + var state = stream._readableState; + debug('endReadable', state.endEmitted); + + if (!state.endEmitted) { + state.ended = true; + process.nextTick(endReadableNT, state, stream); + } +} + +function endReadableNT(state, stream) { + debug('endReadableNT', state.endEmitted, state.length); // Check that we didn't get one last unshift. + + if (!state.endEmitted && state.length === 0) { + state.endEmitted = true; + stream.readable = false; + stream.emit('end'); + + if (state.autoDestroy) { + // In case of duplex streams we need a way to detect + // if the writable side is ready for autoDestroy as well + var wState = stream._writableState; + + if (!wState || wState.autoDestroy && wState.finished) { + stream.destroy(); + } + } + } +} + +if (typeof Symbol === 'function') { + Readable.from = function (iterable, opts) { + if (from === undefined) { + from = require('./internal/streams/from'); + } + + return from(Readable, iterable, opts); + }; +} + +function indexOf(xs, x) { + for (var i = 0, l = xs.length; i < l; i++) { + if (xs[i] === x) return i; + } + + return -1; +} +}).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) + +},{"../errors":736,"./_stream_duplex":737,"./internal/streams/async_iterator":742,"./internal/streams/buffer_list":743,"./internal/streams/destroy":744,"./internal/streams/from":746,"./internal/streams/state":748,"./internal/streams/stream":749,"_process":714,"buffer":81,"events":84,"inherits":88,"string_decoder/":751,"util":80}],740:[function(require,module,exports){ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. +// a transform stream is a readable/writable stream where you do +// something with the data. Sometimes it's called a "filter", +// but that's not a great name for it, since that implies a thing where +// some bits pass through, and others are simply ignored. (That would +// be a valid example of a transform, of course.) +// +// While the output is causally related to the input, it's not a +// necessarily symmetric or synchronous transformation. For example, +// a zlib stream might take multiple plain-text writes(), and then +// emit a single compressed chunk some time in the future. +// +// Here's how this works: +// +// The Transform stream has all the aspects of the readable and writable +// stream classes. When you write(chunk), that calls _write(chunk,cb) +// internally, and returns false if there's a lot of pending writes +// buffered up. When you call read(), that calls _read(n) until +// there's enough pending readable data buffered up. +// +// In a transform stream, the written data is placed in a buffer. When +// _read(n) is called, it transforms the queued up data, calling the +// buffered _write cb's as it consumes chunks. If consuming a single +// written chunk would result in multiple output chunks, then the first +// outputted bit calls the readcb, and subsequent chunks just go into +// the read buffer, and will cause it to emit 'readable' if necessary. +// +// This way, back-pressure is actually determined by the reading side, +// since _read has to be called to start processing a new chunk. However, +// a pathological inflate type of transform can cause excessive buffering +// here. For example, imagine a stream where every byte of input is +// interpreted as an integer from 0-255, and then results in that many +// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in +// 1kb of data being output. In this case, you could write a very small +// amount of input, and end up with a very large amount of output. In +// such a pathological inflating mechanism, there'd be no way to tell +// the system to stop doing the transform. A single 4MB write could +// cause the system to run out of memory. +// +// However, even in such a pathological case, only a single written chunk +// would be consumed, and then the rest would wait (un-transformed) until +// the results of the previous transformed chunk were consumed. +'use strict'; + +module.exports = Transform; + +var _require$codes = require('../errors').codes, + ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, + ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK, + ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING, + ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0; + +var Duplex = require('./_stream_duplex'); + +require('inherits')(Transform, Duplex); + +function afterTransform(er, data) { + var ts = this._transformState; + ts.transforming = false; + var cb = ts.writecb; + + if (cb === null) { + return this.emit('error', new ERR_MULTIPLE_CALLBACK()); + } + + ts.writechunk = null; + ts.writecb = null; + if (data != null) // single equals check for both `null` and `undefined` + this.push(data); + cb(er); + var rs = this._readableState; + rs.reading = false; + + if (rs.needReadable || rs.length < rs.highWaterMark) { + this._read(rs.highWaterMark); + } +} + +function Transform(options) { + if (!(this instanceof Transform)) return new Transform(options); + Duplex.call(this, options); + this._transformState = { + afterTransform: afterTransform.bind(this), + needTransform: false, + transforming: false, + writecb: null, + writechunk: null, + writeencoding: null + }; // start out asking for a readable event once data is transformed. + + this._readableState.needReadable = true; // we have implemented the _read method, and done the other things + // that Readable wants before the first _read call, so unset the + // sync guard flag. + + this._readableState.sync = false; + + if (options) { + if (typeof options.transform === 'function') this._transform = options.transform; + if (typeof options.flush === 'function') this._flush = options.flush; + } // When the writable side finishes, then flush out anything remaining. + + + this.on('prefinish', prefinish); +} + +function prefinish() { + var _this = this; + + if (typeof this._flush === 'function' && !this._readableState.destroyed) { + this._flush(function (er, data) { + done(_this, er, data); + }); + } else { + done(this, null, null); + } +} + +Transform.prototype.push = function (chunk, encoding) { + this._transformState.needTransform = false; + return Duplex.prototype.push.call(this, chunk, encoding); +}; // This is the part where you do stuff! +// override this function in implementation classes. +// 'chunk' is an input chunk. +// +// Call `push(newChunk)` to pass along transformed output +// to the readable side. You may call 'push' zero or more times. +// +// Call `cb(err)` when you are done with this chunk. If you pass +// an error, then that'll put the hurt on the whole operation. If you +// never call cb(), then you'll never get another chunk. + + +Transform.prototype._transform = function (chunk, encoding, cb) { + cb(new ERR_METHOD_NOT_IMPLEMENTED('_transform()')); +}; + +Transform.prototype._write = function (chunk, encoding, cb) { + var ts = this._transformState; + ts.writecb = cb; + ts.writechunk = chunk; + ts.writeencoding = encoding; + + if (!ts.transforming) { + var rs = this._readableState; + if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark); + } +}; // Doesn't matter what the args are here. +// _transform does all the work. +// That we got here means that the readable side wants more data. + + +Transform.prototype._read = function (n) { + var ts = this._transformState; + + if (ts.writechunk !== null && !ts.transforming) { + ts.transforming = true; + + this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); + } else { + // mark that we need a transform, so that any data that comes in + // will get processed, now that we've asked for it. + ts.needTransform = true; + } +}; + +Transform.prototype._destroy = function (err, cb) { + Duplex.prototype._destroy.call(this, err, function (err2) { + cb(err2); + }); +}; + +function done(stream, er, data) { + if (er) return stream.emit('error', er); + if (data != null) // single equals check for both `null` and `undefined` + stream.push(data); // TODO(BridgeAR): Write a test for these two error cases + // if there's nothing in the write buffer, then that means + // that nothing more will ever be provided + + if (stream._writableState.length) throw new ERR_TRANSFORM_WITH_LENGTH_0(); + if (stream._transformState.transforming) throw new ERR_TRANSFORM_ALREADY_TRANSFORMING(); + return stream.push(null); +} +},{"../errors":736,"./_stream_duplex":737,"inherits":88}],741:[function(require,module,exports){ +(function (process,global){(function (){ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. +// A bit simpler than readable streams. +// Implement an async ._write(chunk, encoding, cb), and it'll handle all +// the drain event emission and buffering. +'use strict'; + +module.exports = Writable; +/* */ + +function WriteReq(chunk, encoding, cb) { + this.chunk = chunk; + this.encoding = encoding; + this.callback = cb; + this.next = null; +} // It seems a linked list but it is not +// there will be only 2 of these for each stream + + +function CorkedRequest(state) { + var _this = this; + + this.next = null; + this.entry = null; + + this.finish = function () { + onCorkedFinish(_this, state); + }; +} +/* */ + +/**/ + + +var Duplex; +/**/ + +Writable.WritableState = WritableState; +/**/ + +var internalUtil = { + deprecate: require('util-deprecate') +}; +/**/ + +/**/ + +var Stream = require('./internal/streams/stream'); +/**/ + + +var Buffer = require('buffer').Buffer; + +var OurUint8Array = global.Uint8Array || function () {}; + +function _uint8ArrayToBuffer(chunk) { + return Buffer.from(chunk); +} + +function _isUint8Array(obj) { + return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; +} + +var destroyImpl = require('./internal/streams/destroy'); + +var _require = require('./internal/streams/state'), + getHighWaterMark = _require.getHighWaterMark; + +var _require$codes = require('../errors').codes, + ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE, + ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, + ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK, + ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE, + ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED, + ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES, + ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END, + ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING; + +var errorOrDestroy = destroyImpl.errorOrDestroy; + +require('inherits')(Writable, Stream); + +function nop() {} + +function WritableState(options, stream, isDuplex) { + Duplex = Duplex || require('./_stream_duplex'); + options = options || {}; // Duplex streams are both readable and writable, but share + // the same options object. + // However, some cases require setting options to different + // values for the readable and the writable sides of the duplex stream, + // e.g. options.readableObjectMode vs. options.writableObjectMode, etc. + + if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; // object stream flag to indicate whether or not this stream + // contains buffers or objects. + + this.objectMode = !!options.objectMode; + if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode; // the point at which write() starts returning false + // Note: 0 is a valid value, means that we always return false if + // the entire buffer is not flushed immediately on write() + + this.highWaterMark = getHighWaterMark(this, options, 'writableHighWaterMark', isDuplex); // if _final has been called + + this.finalCalled = false; // drain event flag. + + this.needDrain = false; // at the start of calling end() + + this.ending = false; // when end() has been called, and returned + + this.ended = false; // when 'finish' is emitted + + this.finished = false; // has it been destroyed + + this.destroyed = false; // should we decode strings into buffers before passing to _write? + // this is here so that some node-core streams can optimize string + // handling at a lower level. + + var noDecode = options.decodeStrings === false; + this.decodeStrings = !noDecode; // Crypto is kind of old and crusty. Historically, its default string + // encoding is 'binary' so we have to make this configurable. + // Everything else in the universe uses 'utf8', though. + + this.defaultEncoding = options.defaultEncoding || 'utf8'; // not an actual buffer we keep track of, but a measurement + // of how much we're waiting to get pushed to some underlying + // socket or file. + + this.length = 0; // a flag to see when we're in the middle of a write. + + this.writing = false; // when true all writes will be buffered until .uncork() call + + this.corked = 0; // a flag to be able to tell if the onwrite cb is called immediately, + // or on a later tick. We set this to true at first, because any + // actions that shouldn't happen until "later" should generally also + // not happen before the first write call. + + this.sync = true; // a flag to know if we're processing previously buffered items, which + // may call the _write() callback in the same tick, so that we don't + // end up in an overlapped onwrite situation. + + this.bufferProcessing = false; // the callback that's passed to _write(chunk,cb) + + this.onwrite = function (er) { + onwrite(stream, er); + }; // the callback that the user supplies to write(chunk,encoding,cb) + + + this.writecb = null; // the amount that is being written when _write is called. + + this.writelen = 0; + this.bufferedRequest = null; + this.lastBufferedRequest = null; // number of pending user-supplied write callbacks + // this must be 0 before 'finish' can be emitted + + this.pendingcb = 0; // emit prefinish if the only thing we're waiting for is _write cbs + // This is relevant for synchronous Transform streams + + this.prefinished = false; // True if the error was already emitted and should not be thrown again + + this.errorEmitted = false; // Should close be emitted on destroy. Defaults to true. + + this.emitClose = options.emitClose !== false; // Should .destroy() be called after 'finish' (and potentially 'end') + + this.autoDestroy = !!options.autoDestroy; // count buffered requests + + this.bufferedRequestCount = 0; // allocate the first CorkedRequest, there is always + // one allocated and free to use, and we maintain at most two + + this.corkedRequestsFree = new CorkedRequest(this); +} + +WritableState.prototype.getBuffer = function getBuffer() { + var current = this.bufferedRequest; + var out = []; + + while (current) { + out.push(current); + current = current.next; + } + + return out; +}; + +(function () { + try { + Object.defineProperty(WritableState.prototype, 'buffer', { + get: internalUtil.deprecate(function writableStateBufferGetter() { + return this.getBuffer(); + }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003') + }); + } catch (_) {} +})(); // Test _writableState for inheritance to account for Duplex streams, +// whose prototype chain only points to Readable. + + +var realHasInstance; + +if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') { + realHasInstance = Function.prototype[Symbol.hasInstance]; + Object.defineProperty(Writable, Symbol.hasInstance, { + value: function value(object) { + if (realHasInstance.call(this, object)) return true; + if (this !== Writable) return false; + return object && object._writableState instanceof WritableState; + } + }); +} else { + realHasInstance = function realHasInstance(object) { + return object instanceof this; + }; +} + +function Writable(options) { + Duplex = Duplex || require('./_stream_duplex'); // Writable ctor is applied to Duplexes, too. + // `realHasInstance` is necessary because using plain `instanceof` + // would return false, as no `_writableState` property is attached. + // Trying to use the custom `instanceof` for Writable here will also break the + // Node.js LazyTransform implementation, which has a non-trivial getter for + // `_writableState` that would lead to infinite recursion. + // Checking for a Stream.Duplex instance is faster here instead of inside + // the WritableState constructor, at least with V8 6.5 + + var isDuplex = this instanceof Duplex; + if (!isDuplex && !realHasInstance.call(Writable, this)) return new Writable(options); + this._writableState = new WritableState(options, this, isDuplex); // legacy. + + this.writable = true; + + if (options) { + if (typeof options.write === 'function') this._write = options.write; + if (typeof options.writev === 'function') this._writev = options.writev; + if (typeof options.destroy === 'function') this._destroy = options.destroy; + if (typeof options.final === 'function') this._final = options.final; + } + + Stream.call(this); +} // Otherwise people can pipe Writable streams, which is just wrong. + + +Writable.prototype.pipe = function () { + errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE()); +}; + +function writeAfterEnd(stream, cb) { + var er = new ERR_STREAM_WRITE_AFTER_END(); // TODO: defer error events consistently everywhere, not just the cb + + errorOrDestroy(stream, er); + process.nextTick(cb, er); +} // Checks that a user-supplied chunk is valid, especially for the particular +// mode the stream is in. Currently this means that `null` is never accepted +// and undefined/non-string values are only allowed in object mode. + + +function validChunk(stream, state, chunk, cb) { + var er; + + if (chunk === null) { + er = new ERR_STREAM_NULL_VALUES(); + } else if (typeof chunk !== 'string' && !state.objectMode) { + er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer'], chunk); + } + + if (er) { + errorOrDestroy(stream, er); + process.nextTick(cb, er); + return false; + } + + return true; +} + +Writable.prototype.write = function (chunk, encoding, cb) { + var state = this._writableState; + var ret = false; + + var isBuf = !state.objectMode && _isUint8Array(chunk); + + if (isBuf && !Buffer.isBuffer(chunk)) { + chunk = _uint8ArrayToBuffer(chunk); + } + + if (typeof encoding === 'function') { + cb = encoding; + encoding = null; + } + + if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding; + if (typeof cb !== 'function') cb = nop; + if (state.ending) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) { + state.pendingcb++; + ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb); + } + return ret; +}; + +Writable.prototype.cork = function () { + this._writableState.corked++; +}; + +Writable.prototype.uncork = function () { + var state = this._writableState; + + if (state.corked) { + state.corked--; + if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state); + } +}; + +Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) { + // node::ParseEncoding() requires lower case. + if (typeof encoding === 'string') encoding = encoding.toLowerCase(); + if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new ERR_UNKNOWN_ENCODING(encoding); + this._writableState.defaultEncoding = encoding; + return this; +}; + +Object.defineProperty(Writable.prototype, 'writableBuffer', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState && this._writableState.getBuffer(); + } +}); + +function decodeChunk(state, chunk, encoding) { + if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') { + chunk = Buffer.from(chunk, encoding); + } + + return chunk; +} + +Object.defineProperty(Writable.prototype, 'writableHighWaterMark', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState.highWaterMark; + } +}); // if we're already writing something, then just put this +// in the queue, and wait our turn. Otherwise, call _write +// If we return false, then we need a drain event, so set that flag. + +function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) { + if (!isBuf) { + var newChunk = decodeChunk(state, chunk, encoding); + + if (chunk !== newChunk) { + isBuf = true; + encoding = 'buffer'; + chunk = newChunk; + } + } + + var len = state.objectMode ? 1 : chunk.length; + state.length += len; + var ret = state.length < state.highWaterMark; // we must ensure that previous needDrain will not be reset to false. + + if (!ret) state.needDrain = true; + + if (state.writing || state.corked) { + var last = state.lastBufferedRequest; + state.lastBufferedRequest = { + chunk: chunk, + encoding: encoding, + isBuf: isBuf, + callback: cb, + next: null + }; + + if (last) { + last.next = state.lastBufferedRequest; + } else { + state.bufferedRequest = state.lastBufferedRequest; + } + + state.bufferedRequestCount += 1; + } else { + doWrite(stream, state, false, len, chunk, encoding, cb); + } + + return ret; +} + +function doWrite(stream, state, writev, len, chunk, encoding, cb) { + state.writelen = len; + state.writecb = cb; + state.writing = true; + state.sync = true; + if (state.destroyed) state.onwrite(new ERR_STREAM_DESTROYED('write'));else if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite); + state.sync = false; +} + +function onwriteError(stream, state, sync, er, cb) { + --state.pendingcb; + + if (sync) { + // defer the callback if we are being called synchronously + // to avoid piling up things on the stack + process.nextTick(cb, er); // this can emit finish, and it will always happen + // after error + + process.nextTick(finishMaybe, stream, state); + stream._writableState.errorEmitted = true; + errorOrDestroy(stream, er); + } else { + // the caller expect this to happen before if + // it is async + cb(er); + stream._writableState.errorEmitted = true; + errorOrDestroy(stream, er); // this can emit finish, but finish must + // always follow error + + finishMaybe(stream, state); + } +} + +function onwriteStateUpdate(state) { + state.writing = false; + state.writecb = null; + state.length -= state.writelen; + state.writelen = 0; +} + +function onwrite(stream, er) { + var state = stream._writableState; + var sync = state.sync; + var cb = state.writecb; + if (typeof cb !== 'function') throw new ERR_MULTIPLE_CALLBACK(); + onwriteStateUpdate(state); + if (er) onwriteError(stream, state, sync, er, cb);else { + // Check if we're actually ready to finish, but don't emit yet + var finished = needFinish(state) || stream.destroyed; + + if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) { + clearBuffer(stream, state); + } + + if (sync) { + process.nextTick(afterWrite, stream, state, finished, cb); + } else { + afterWrite(stream, state, finished, cb); + } + } +} + +function afterWrite(stream, state, finished, cb) { + if (!finished) onwriteDrain(stream, state); + state.pendingcb--; + cb(); + finishMaybe(stream, state); +} // Must force callback to be called on nextTick, so that we don't +// emit 'drain' before the write() consumer gets the 'false' return +// value, and has a chance to attach a 'drain' listener. + + +function onwriteDrain(stream, state) { + if (state.length === 0 && state.needDrain) { + state.needDrain = false; + stream.emit('drain'); + } +} // if there's something in the buffer waiting, then process it + + +function clearBuffer(stream, state) { + state.bufferProcessing = true; + var entry = state.bufferedRequest; + + if (stream._writev && entry && entry.next) { + // Fast case, write everything using _writev() + var l = state.bufferedRequestCount; + var buffer = new Array(l); + var holder = state.corkedRequestsFree; + holder.entry = entry; + var count = 0; + var allBuffers = true; + + while (entry) { + buffer[count] = entry; + if (!entry.isBuf) allBuffers = false; + entry = entry.next; + count += 1; + } + + buffer.allBuffers = allBuffers; + doWrite(stream, state, true, state.length, buffer, '', holder.finish); // doWrite is almost always async, defer these to save a bit of time + // as the hot path ends with doWrite + + state.pendingcb++; + state.lastBufferedRequest = null; + + if (holder.next) { + state.corkedRequestsFree = holder.next; + holder.next = null; + } else { + state.corkedRequestsFree = new CorkedRequest(state); + } + + state.bufferedRequestCount = 0; + } else { + // Slow case, write chunks one-by-one + while (entry) { + var chunk = entry.chunk; + var encoding = entry.encoding; + var cb = entry.callback; + var len = state.objectMode ? 1 : chunk.length; + doWrite(stream, state, false, len, chunk, encoding, cb); + entry = entry.next; + state.bufferedRequestCount--; // if we didn't call the onwrite immediately, then + // it means that we need to wait until it does. + // also, that means that the chunk and cb are currently + // being processed, so move the buffer counter past them. + + if (state.writing) { + break; + } + } + + if (entry === null) state.lastBufferedRequest = null; + } + + state.bufferedRequest = entry; + state.bufferProcessing = false; +} + +Writable.prototype._write = function (chunk, encoding, cb) { + cb(new ERR_METHOD_NOT_IMPLEMENTED('_write()')); +}; + +Writable.prototype._writev = null; + +Writable.prototype.end = function (chunk, encoding, cb) { + var state = this._writableState; + + if (typeof chunk === 'function') { + cb = chunk; + chunk = null; + encoding = null; + } else if (typeof encoding === 'function') { + cb = encoding; + encoding = null; + } + + if (chunk !== null && chunk !== undefined) this.write(chunk, encoding); // .end() fully uncorks + + if (state.corked) { + state.corked = 1; + this.uncork(); + } // ignore unnecessary end() calls. + + + if (!state.ending) endWritable(this, state, cb); + return this; +}; + +Object.defineProperty(Writable.prototype, 'writableLength', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState.length; + } +}); + +function needFinish(state) { + return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing; +} + +function callFinal(stream, state) { + stream._final(function (err) { + state.pendingcb--; + + if (err) { + errorOrDestroy(stream, err); + } + + state.prefinished = true; + stream.emit('prefinish'); + finishMaybe(stream, state); + }); +} + +function prefinish(stream, state) { + if (!state.prefinished && !state.finalCalled) { + if (typeof stream._final === 'function' && !state.destroyed) { + state.pendingcb++; + state.finalCalled = true; + process.nextTick(callFinal, stream, state); + } else { + state.prefinished = true; + stream.emit('prefinish'); + } + } +} + +function finishMaybe(stream, state) { + var need = needFinish(state); + + if (need) { + prefinish(stream, state); + + if (state.pendingcb === 0) { + state.finished = true; + stream.emit('finish'); + + if (state.autoDestroy) { + // In case of duplex streams we need a way to detect + // if the readable side is ready for autoDestroy as well + var rState = stream._readableState; + + if (!rState || rState.autoDestroy && rState.endEmitted) { + stream.destroy(); + } + } + } + } + + return need; +} + +function endWritable(stream, state, cb) { + state.ending = true; + finishMaybe(stream, state); + + if (cb) { + if (state.finished) process.nextTick(cb);else stream.once('finish', cb); + } + + state.ended = true; + stream.writable = false; +} + +function onCorkedFinish(corkReq, state, err) { + var entry = corkReq.entry; + corkReq.entry = null; + + while (entry) { + var cb = entry.callback; + state.pendingcb--; + cb(err); + entry = entry.next; + } // reuse the free corkReq. + + + state.corkedRequestsFree.next = corkReq; +} + +Object.defineProperty(Writable.prototype, 'destroyed', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + if (this._writableState === undefined) { + return false; + } + + return this._writableState.destroyed; + }, + set: function set(value) { + // we ignore the value if the stream + // has not been initialized yet + if (!this._writableState) { + return; + } // backward compatibility, the user is explicitly + // managing destroyed + + + this._writableState.destroyed = value; + } +}); +Writable.prototype.destroy = destroyImpl.destroy; +Writable.prototype._undestroy = destroyImpl.undestroy; + +Writable.prototype._destroy = function (err, cb) { + cb(err); +}; +}).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) + +},{"../errors":736,"./_stream_duplex":737,"./internal/streams/destroy":744,"./internal/streams/state":748,"./internal/streams/stream":749,"_process":714,"buffer":81,"inherits":88,"util-deprecate":755}],742:[function(require,module,exports){ +(function (process){(function (){ +'use strict'; + +var _Object$setPrototypeO; + +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +var finished = require('./end-of-stream'); + +var kLastResolve = Symbol('lastResolve'); +var kLastReject = Symbol('lastReject'); +var kError = Symbol('error'); +var kEnded = Symbol('ended'); +var kLastPromise = Symbol('lastPromise'); +var kHandlePromise = Symbol('handlePromise'); +var kStream = Symbol('stream'); + +function createIterResult(value, done) { + return { + value: value, + done: done + }; +} + +function readAndResolve(iter) { + var resolve = iter[kLastResolve]; + + if (resolve !== null) { + var data = iter[kStream].read(); // we defer if data is null + // we can be expecting either 'end' or + // 'error' + + if (data !== null) { + iter[kLastPromise] = null; + iter[kLastResolve] = null; + iter[kLastReject] = null; + resolve(createIterResult(data, false)); + } + } +} + +function onReadable(iter) { + // we wait for the next tick, because it might + // emit an error with process.nextTick + process.nextTick(readAndResolve, iter); +} + +function wrapForNext(lastPromise, iter) { + return function (resolve, reject) { + lastPromise.then(function () { + if (iter[kEnded]) { + resolve(createIterResult(undefined, true)); + return; + } + + iter[kHandlePromise](resolve, reject); + }, reject); + }; +} + +var AsyncIteratorPrototype = Object.getPrototypeOf(function () {}); +var ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf((_Object$setPrototypeO = { + get stream() { + return this[kStream]; + }, + + next: function next() { + var _this = this; + + // if we have detected an error in the meanwhile + // reject straight away + var error = this[kError]; + + if (error !== null) { + return Promise.reject(error); + } + + if (this[kEnded]) { + return Promise.resolve(createIterResult(undefined, true)); + } + + if (this[kStream].destroyed) { + // We need to defer via nextTick because if .destroy(err) is + // called, the error will be emitted via nextTick, and + // we cannot guarantee that there is no error lingering around + // waiting to be emitted. + return new Promise(function (resolve, reject) { + process.nextTick(function () { + if (_this[kError]) { + reject(_this[kError]); + } else { + resolve(createIterResult(undefined, true)); + } + }); + }); + } // if we have multiple next() calls + // we will wait for the previous Promise to finish + // this logic is optimized to support for await loops, + // where next() is only called once at a time + + + var lastPromise = this[kLastPromise]; + var promise; + + if (lastPromise) { + promise = new Promise(wrapForNext(lastPromise, this)); + } else { + // fast path needed to support multiple this.push() + // without triggering the next() queue + var data = this[kStream].read(); + + if (data !== null) { + return Promise.resolve(createIterResult(data, false)); + } + + promise = new Promise(this[kHandlePromise]); + } + + this[kLastPromise] = promise; + return promise; + } +}, _defineProperty(_Object$setPrototypeO, Symbol.asyncIterator, function () { + return this; +}), _defineProperty(_Object$setPrototypeO, "return", function _return() { + var _this2 = this; + + // destroy(err, cb) is a private API + // we can guarantee we have that here, because we control the + // Readable class this is attached to + return new Promise(function (resolve, reject) { + _this2[kStream].destroy(null, function (err) { + if (err) { + reject(err); + return; + } + + resolve(createIterResult(undefined, true)); + }); + }); +}), _Object$setPrototypeO), AsyncIteratorPrototype); + +var createReadableStreamAsyncIterator = function createReadableStreamAsyncIterator(stream) { + var _Object$create; + + var iterator = Object.create(ReadableStreamAsyncIteratorPrototype, (_Object$create = {}, _defineProperty(_Object$create, kStream, { + value: stream, + writable: true + }), _defineProperty(_Object$create, kLastResolve, { + value: null, + writable: true + }), _defineProperty(_Object$create, kLastReject, { + value: null, + writable: true + }), _defineProperty(_Object$create, kError, { + value: null, + writable: true + }), _defineProperty(_Object$create, kEnded, { + value: stream._readableState.endEmitted, + writable: true + }), _defineProperty(_Object$create, kHandlePromise, { + value: function value(resolve, reject) { + var data = iterator[kStream].read(); + + if (data) { + iterator[kLastPromise] = null; + iterator[kLastResolve] = null; + iterator[kLastReject] = null; + resolve(createIterResult(data, false)); + } else { + iterator[kLastResolve] = resolve; + iterator[kLastReject] = reject; + } + }, + writable: true + }), _Object$create)); + iterator[kLastPromise] = null; + finished(stream, function (err) { + if (err && err.code !== 'ERR_STREAM_PREMATURE_CLOSE') { + var reject = iterator[kLastReject]; // reject if we are waiting for data in the Promise + // returned by next() and store the error + + if (reject !== null) { + iterator[kLastPromise] = null; + iterator[kLastResolve] = null; + iterator[kLastReject] = null; + reject(err); + } + + iterator[kError] = err; + return; + } + + var resolve = iterator[kLastResolve]; + + if (resolve !== null) { + iterator[kLastPromise] = null; + iterator[kLastResolve] = null; + iterator[kLastReject] = null; + resolve(createIterResult(undefined, true)); + } + + iterator[kEnded] = true; + }); + stream.on('readable', onReadable.bind(null, iterator)); + return iterator; +}; + +module.exports = createReadableStreamAsyncIterator; +}).call(this)}).call(this,require('_process')) + +},{"./end-of-stream":745,"_process":714}],743:[function(require,module,exports){ +'use strict'; + +function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } + +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } + +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +var _require = require('buffer'), + Buffer = _require.Buffer; + +var _require2 = require('util'), + inspect = _require2.inspect; + +var custom = inspect && inspect.custom || 'inspect'; + +function copyBuffer(src, target, offset) { + Buffer.prototype.copy.call(src, target, offset); +} + +module.exports = +/*#__PURE__*/ +function () { + function BufferList() { + _classCallCheck(this, BufferList); + + this.head = null; + this.tail = null; + this.length = 0; + } + + _createClass(BufferList, [{ + key: "push", + value: function push(v) { + var entry = { + data: v, + next: null + }; + if (this.length > 0) this.tail.next = entry;else this.head = entry; + this.tail = entry; + ++this.length; + } + }, { + key: "unshift", + value: function unshift(v) { + var entry = { + data: v, + next: this.head + }; + if (this.length === 0) this.tail = entry; + this.head = entry; + ++this.length; + } + }, { + key: "shift", + value: function shift() { + if (this.length === 0) return; + var ret = this.head.data; + if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next; + --this.length; + return ret; + } + }, { + key: "clear", + value: function clear() { + this.head = this.tail = null; + this.length = 0; + } + }, { + key: "join", + value: function join(s) { + if (this.length === 0) return ''; + var p = this.head; + var ret = '' + p.data; + + while (p = p.next) { + ret += s + p.data; + } + + return ret; + } + }, { + key: "concat", + value: function concat(n) { + if (this.length === 0) return Buffer.alloc(0); + var ret = Buffer.allocUnsafe(n >>> 0); + var p = this.head; + var i = 0; + + while (p) { + copyBuffer(p.data, ret, i); + i += p.data.length; + p = p.next; + } + + return ret; + } // Consumes a specified amount of bytes or characters from the buffered data. + + }, { + key: "consume", + value: function consume(n, hasStrings) { + var ret; + + if (n < this.head.data.length) { + // `slice` is the same for buffers and strings. + ret = this.head.data.slice(0, n); + this.head.data = this.head.data.slice(n); + } else if (n === this.head.data.length) { + // First chunk is a perfect match. + ret = this.shift(); + } else { + // Result spans more than one buffer. + ret = hasStrings ? this._getString(n) : this._getBuffer(n); + } + + return ret; + } + }, { + key: "first", + value: function first() { + return this.head.data; + } // Consumes a specified amount of characters from the buffered data. + + }, { + key: "_getString", + value: function _getString(n) { + var p = this.head; + var c = 1; + var ret = p.data; + n -= ret.length; + + while (p = p.next) { + var str = p.data; + var nb = n > str.length ? str.length : n; + if (nb === str.length) ret += str;else ret += str.slice(0, n); + n -= nb; + + if (n === 0) { + if (nb === str.length) { + ++c; + if (p.next) this.head = p.next;else this.head = this.tail = null; + } else { + this.head = p; + p.data = str.slice(nb); + } + + break; + } + + ++c; + } + + this.length -= c; + return ret; + } // Consumes a specified amount of bytes from the buffered data. + + }, { + key: "_getBuffer", + value: function _getBuffer(n) { + var ret = Buffer.allocUnsafe(n); + var p = this.head; + var c = 1; + p.data.copy(ret); + n -= p.data.length; + + while (p = p.next) { + var buf = p.data; + var nb = n > buf.length ? buf.length : n; + buf.copy(ret, ret.length - n, 0, nb); + n -= nb; + + if (n === 0) { + if (nb === buf.length) { + ++c; + if (p.next) this.head = p.next;else this.head = this.tail = null; + } else { + this.head = p; + p.data = buf.slice(nb); + } + + break; + } + + ++c; + } + + this.length -= c; + return ret; + } // Make sure the linked list only shows the minimal necessary information. + + }, { + key: custom, + value: function value(_, options) { + return inspect(this, _objectSpread({}, options, { + // Only inspect one level. + depth: 0, + // It should not recurse. + customInspect: false + })); + } + }]); + + return BufferList; +}(); +},{"buffer":81,"util":80}],744:[function(require,module,exports){ +(function (process){(function (){ +'use strict'; // undocumented cb() API, needed for core, not for public API + +function destroy(err, cb) { + var _this = this; + + var readableDestroyed = this._readableState && this._readableState.destroyed; + var writableDestroyed = this._writableState && this._writableState.destroyed; + + if (readableDestroyed || writableDestroyed) { + if (cb) { + cb(err); + } else if (err) { + if (!this._writableState) { + process.nextTick(emitErrorNT, this, err); + } else if (!this._writableState.errorEmitted) { + this._writableState.errorEmitted = true; + process.nextTick(emitErrorNT, this, err); + } + } + + return this; + } // we set destroyed to true before firing error callbacks in order + // to make it re-entrance safe in case destroy() is called within callbacks + + + if (this._readableState) { + this._readableState.destroyed = true; + } // if this is a duplex stream mark the writable part as destroyed as well + + + if (this._writableState) { + this._writableState.destroyed = true; + } + + this._destroy(err || null, function (err) { + if (!cb && err) { + if (!_this._writableState) { + process.nextTick(emitErrorAndCloseNT, _this, err); + } else if (!_this._writableState.errorEmitted) { + _this._writableState.errorEmitted = true; + process.nextTick(emitErrorAndCloseNT, _this, err); + } else { + process.nextTick(emitCloseNT, _this); + } + } else if (cb) { + process.nextTick(emitCloseNT, _this); + cb(err); + } else { + process.nextTick(emitCloseNT, _this); + } + }); + + return this; +} + +function emitErrorAndCloseNT(self, err) { + emitErrorNT(self, err); + emitCloseNT(self); +} + +function emitCloseNT(self) { + if (self._writableState && !self._writableState.emitClose) return; + if (self._readableState && !self._readableState.emitClose) return; + self.emit('close'); +} + +function undestroy() { + if (this._readableState) { + this._readableState.destroyed = false; + this._readableState.reading = false; + this._readableState.ended = false; + this._readableState.endEmitted = false; + } + + if (this._writableState) { + this._writableState.destroyed = false; + this._writableState.ended = false; + this._writableState.ending = false; + this._writableState.finalCalled = false; + this._writableState.prefinished = false; + this._writableState.finished = false; + this._writableState.errorEmitted = false; + } +} + +function emitErrorNT(self, err) { + self.emit('error', err); +} + +function errorOrDestroy(stream, err) { + // We have tests that rely on errors being emitted + // in the same tick, so changing this is semver major. + // For now when you opt-in to autoDestroy we allow + // the error to be emitted nextTick. In a future + // semver major update we should change the default to this. + var rState = stream._readableState; + var wState = stream._writableState; + if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err);else stream.emit('error', err); +} + +module.exports = { + destroy: destroy, + undestroy: undestroy, + errorOrDestroy: errorOrDestroy +}; +}).call(this)}).call(this,require('_process')) + +},{"_process":714}],745:[function(require,module,exports){ +// Ported from https://github.com/mafintosh/end-of-stream with +// permission from the author, Mathias Buus (@mafintosh). +'use strict'; + +var ERR_STREAM_PREMATURE_CLOSE = require('../../../errors').codes.ERR_STREAM_PREMATURE_CLOSE; + +function once(callback) { + var called = false; + return function () { + if (called) return; + called = true; + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + callback.apply(this, args); + }; +} + +function noop() {} + +function isRequest(stream) { + return stream.setHeader && typeof stream.abort === 'function'; +} + +function eos(stream, opts, callback) { + if (typeof opts === 'function') return eos(stream, null, opts); + if (!opts) opts = {}; + callback = once(callback || noop); + var readable = opts.readable || opts.readable !== false && stream.readable; + var writable = opts.writable || opts.writable !== false && stream.writable; + + var onlegacyfinish = function onlegacyfinish() { + if (!stream.writable) onfinish(); + }; + + var writableEnded = stream._writableState && stream._writableState.finished; + + var onfinish = function onfinish() { + writable = false; + writableEnded = true; + if (!readable) callback.call(stream); + }; + + var readableEnded = stream._readableState && stream._readableState.endEmitted; + + var onend = function onend() { + readable = false; + readableEnded = true; + if (!writable) callback.call(stream); + }; + + var onerror = function onerror(err) { + callback.call(stream, err); + }; + + var onclose = function onclose() { + var err; + + if (readable && !readableEnded) { + if (!stream._readableState || !stream._readableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE(); + return callback.call(stream, err); + } + + if (writable && !writableEnded) { + if (!stream._writableState || !stream._writableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE(); + return callback.call(stream, err); + } + }; + + var onrequest = function onrequest() { + stream.req.on('finish', onfinish); + }; + + if (isRequest(stream)) { + stream.on('complete', onfinish); + stream.on('abort', onclose); + if (stream.req) onrequest();else stream.on('request', onrequest); + } else if (writable && !stream._writableState) { + // legacy streams + stream.on('end', onlegacyfinish); + stream.on('close', onlegacyfinish); + } + + stream.on('end', onend); + stream.on('finish', onfinish); + if (opts.error !== false) stream.on('error', onerror); + stream.on('close', onclose); + return function () { + stream.removeListener('complete', onfinish); + stream.removeListener('abort', onclose); + stream.removeListener('request', onrequest); + if (stream.req) stream.req.removeListener('finish', onfinish); + stream.removeListener('end', onlegacyfinish); + stream.removeListener('close', onlegacyfinish); + stream.removeListener('finish', onfinish); + stream.removeListener('end', onend); + stream.removeListener('error', onerror); + stream.removeListener('close', onclose); + }; +} + +module.exports = eos; +},{"../../../errors":736}],746:[function(require,module,exports){ +module.exports = function () { + throw new Error('Readable.from is not available in the browser') +}; + +},{}],747:[function(require,module,exports){ +// Ported from https://github.com/mafintosh/pump with +// permission from the author, Mathias Buus (@mafintosh). +'use strict'; + +var eos; + +function once(callback) { + var called = false; + return function () { + if (called) return; + called = true; + callback.apply(void 0, arguments); + }; +} + +var _require$codes = require('../../../errors').codes, + ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS, + ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED; + +function noop(err) { + // Rethrow the error if it exists to avoid swallowing it + if (err) throw err; +} + +function isRequest(stream) { + return stream.setHeader && typeof stream.abort === 'function'; +} + +function destroyer(stream, reading, writing, callback) { + callback = once(callback); + var closed = false; + stream.on('close', function () { + closed = true; + }); + if (eos === undefined) eos = require('./end-of-stream'); + eos(stream, { + readable: reading, + writable: writing + }, function (err) { + if (err) return callback(err); + closed = true; + callback(); + }); + var destroyed = false; + return function (err) { + if (closed) return; + if (destroyed) return; + destroyed = true; // request.destroy just do .end - .abort is what we want + + if (isRequest(stream)) return stream.abort(); + if (typeof stream.destroy === 'function') return stream.destroy(); + callback(err || new ERR_STREAM_DESTROYED('pipe')); + }; +} + +function call(fn) { + fn(); +} + +function pipe(from, to) { + return from.pipe(to); +} + +function popCallback(streams) { + if (!streams.length) return noop; + if (typeof streams[streams.length - 1] !== 'function') return noop; + return streams.pop(); +} + +function pipeline() { + for (var _len = arguments.length, streams = new Array(_len), _key = 0; _key < _len; _key++) { + streams[_key] = arguments[_key]; + } + + var callback = popCallback(streams); + if (Array.isArray(streams[0])) streams = streams[0]; + + if (streams.length < 2) { + throw new ERR_MISSING_ARGS('streams'); + } + + var error; + var destroys = streams.map(function (stream, i) { + var reading = i < streams.length - 1; + var writing = i > 0; + return destroyer(stream, reading, writing, function (err) { + if (!error) error = err; + if (err) destroys.forEach(call); + if (reading) return; + destroys.forEach(call); + callback(error); + }); + }); + return streams.reduce(pipe); +} + +module.exports = pipeline; +},{"../../../errors":736,"./end-of-stream":745}],748:[function(require,module,exports){ +'use strict'; + +var ERR_INVALID_OPT_VALUE = require('../../../errors').codes.ERR_INVALID_OPT_VALUE; + +function highWaterMarkFrom(options, isDuplex, duplexKey) { + return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null; +} + +function getHighWaterMark(state, options, duplexKey, isDuplex) { + var hwm = highWaterMarkFrom(options, isDuplex, duplexKey); + + if (hwm != null) { + if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) { + var name = isDuplex ? duplexKey : 'highWaterMark'; + throw new ERR_INVALID_OPT_VALUE(name, hwm); + } + + return Math.floor(hwm); + } // Default value + + + return state.objectMode ? 16 : 16 * 1024; +} + +module.exports = { + getHighWaterMark: getHighWaterMark +}; +},{"../../../errors":736}],749:[function(require,module,exports){ +module.exports = require('events').EventEmitter; + +},{"events":84}],750:[function(require,module,exports){ +exports = module.exports = require('./lib/_stream_readable.js'); +exports.Stream = exports; +exports.Readable = exports; +exports.Writable = require('./lib/_stream_writable.js'); +exports.Duplex = require('./lib/_stream_duplex.js'); +exports.Transform = require('./lib/_stream_transform.js'); +exports.PassThrough = require('./lib/_stream_passthrough.js'); +exports.finished = require('./lib/internal/streams/end-of-stream.js'); +exports.pipeline = require('./lib/internal/streams/pipeline.js'); + +},{"./lib/_stream_duplex.js":737,"./lib/_stream_passthrough.js":738,"./lib/_stream_readable.js":739,"./lib/_stream_transform.js":740,"./lib/_stream_writable.js":741,"./lib/internal/streams/end-of-stream.js":745,"./lib/internal/streams/pipeline.js":747}],751:[function(require,module,exports){ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +'use strict'; + +/**/ + +var Buffer = require('safe-buffer').Buffer; +/**/ + +var isEncoding = Buffer.isEncoding || function (encoding) { + encoding = '' + encoding; + switch (encoding && encoding.toLowerCase()) { + case 'hex':case 'utf8':case 'utf-8':case 'ascii':case 'binary':case 'base64':case 'ucs2':case 'ucs-2':case 'utf16le':case 'utf-16le':case 'raw': + return true; + default: + return false; + } +}; + +function _normalizeEncoding(enc) { + if (!enc) return 'utf8'; + var retried; + while (true) { + switch (enc) { + case 'utf8': + case 'utf-8': + return 'utf8'; + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return 'utf16le'; + case 'latin1': + case 'binary': + return 'latin1'; + case 'base64': + case 'ascii': + case 'hex': + return enc; + default: + if (retried) return; // undefined + enc = ('' + enc).toLowerCase(); + retried = true; + } + } +}; + +// Do not cache `Buffer.isEncoding` when checking encoding names as some +// modules monkey-patch it to support additional encodings +function normalizeEncoding(enc) { + var nenc = _normalizeEncoding(enc); + if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc); + return nenc || enc; +} + +// StringDecoder provides an interface for efficiently splitting a series of +// buffers into a series of JS strings without breaking apart multi-byte +// characters. +exports.StringDecoder = StringDecoder; +function StringDecoder(encoding) { + this.encoding = normalizeEncoding(encoding); + var nb; + switch (this.encoding) { + case 'utf16le': + this.text = utf16Text; + this.end = utf16End; + nb = 4; + break; + case 'utf8': + this.fillLast = utf8FillLast; + nb = 4; + break; + case 'base64': + this.text = base64Text; + this.end = base64End; + nb = 3; + break; + default: + this.write = simpleWrite; + this.end = simpleEnd; + return; + } + this.lastNeed = 0; + this.lastTotal = 0; + this.lastChar = Buffer.allocUnsafe(nb); +} + +StringDecoder.prototype.write = function (buf) { + if (buf.length === 0) return ''; + var r; + var i; + if (this.lastNeed) { + r = this.fillLast(buf); + if (r === undefined) return ''; + i = this.lastNeed; + this.lastNeed = 0; + } else { + i = 0; + } + if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i); + return r || ''; +}; + +StringDecoder.prototype.end = utf8End; + +// Returns only complete characters in a Buffer +StringDecoder.prototype.text = utf8Text; + +// Attempts to complete a partial non-UTF-8 character using bytes from a Buffer +StringDecoder.prototype.fillLast = function (buf) { + if (this.lastNeed <= buf.length) { + buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed); + return this.lastChar.toString(this.encoding, 0, this.lastTotal); + } + buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length); + this.lastNeed -= buf.length; +}; + +// Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a +// continuation byte. If an invalid byte is detected, -2 is returned. +function utf8CheckByte(byte) { + if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4; + return byte >> 6 === 0x02 ? -1 : -2; +} + +// Checks at most 3 bytes at the end of a Buffer in order to detect an +// incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4) +// needed to complete the UTF-8 character (if applicable) are returned. +function utf8CheckIncomplete(self, buf, i) { + var j = buf.length - 1; + if (j < i) return 0; + var nb = utf8CheckByte(buf[j]); + if (nb >= 0) { + if (nb > 0) self.lastNeed = nb - 1; + return nb; + } + if (--j < i || nb === -2) return 0; + nb = utf8CheckByte(buf[j]); + if (nb >= 0) { + if (nb > 0) self.lastNeed = nb - 2; + return nb; + } + if (--j < i || nb === -2) return 0; + nb = utf8CheckByte(buf[j]); + if (nb >= 0) { + if (nb > 0) { + if (nb === 2) nb = 0;else self.lastNeed = nb - 3; + } + return nb; + } + return 0; +} + +// Validates as many continuation bytes for a multi-byte UTF-8 character as +// needed or are available. If we see a non-continuation byte where we expect +// one, we "replace" the validated continuation bytes we've seen so far with +// a single UTF-8 replacement character ('\ufffd'), to match v8's UTF-8 decoding +// behavior. The continuation byte check is included three times in the case +// where all of the continuation bytes for a character exist in the same buffer. +// It is also done this way as a slight performance increase instead of using a +// loop. +function utf8CheckExtraBytes(self, buf, p) { + if ((buf[0] & 0xC0) !== 0x80) { + self.lastNeed = 0; + return '\ufffd'; + } + if (self.lastNeed > 1 && buf.length > 1) { + if ((buf[1] & 0xC0) !== 0x80) { + self.lastNeed = 1; + return '\ufffd'; + } + if (self.lastNeed > 2 && buf.length > 2) { + if ((buf[2] & 0xC0) !== 0x80) { + self.lastNeed = 2; + return '\ufffd'; + } + } + } +} + +// Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer. +function utf8FillLast(buf) { + var p = this.lastTotal - this.lastNeed; + var r = utf8CheckExtraBytes(this, buf, p); + if (r !== undefined) return r; + if (this.lastNeed <= buf.length) { + buf.copy(this.lastChar, p, 0, this.lastNeed); + return this.lastChar.toString(this.encoding, 0, this.lastTotal); + } + buf.copy(this.lastChar, p, 0, buf.length); + this.lastNeed -= buf.length; +} + +// Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a +// partial character, the character's bytes are buffered until the required +// number of bytes are available. +function utf8Text(buf, i) { + var total = utf8CheckIncomplete(this, buf, i); + if (!this.lastNeed) return buf.toString('utf8', i); + this.lastTotal = total; + var end = buf.length - (total - this.lastNeed); + buf.copy(this.lastChar, 0, end); + return buf.toString('utf8', i, end); +} + +// For UTF-8, a replacement character is added when ending on a partial +// character. +function utf8End(buf) { + var r = buf && buf.length ? this.write(buf) : ''; + if (this.lastNeed) return r + '\ufffd'; + return r; +} + +// UTF-16LE typically needs two bytes per character, but even if we have an even +// number of bytes available, we need to check if we end on a leading/high +// surrogate. In that case, we need to wait for the next two bytes in order to +// decode the last character properly. +function utf16Text(buf, i) { + if ((buf.length - i) % 2 === 0) { + var r = buf.toString('utf16le', i); + if (r) { + var c = r.charCodeAt(r.length - 1); + if (c >= 0xD800 && c <= 0xDBFF) { + this.lastNeed = 2; + this.lastTotal = 4; + this.lastChar[0] = buf[buf.length - 2]; + this.lastChar[1] = buf[buf.length - 1]; + return r.slice(0, -1); + } + } + return r; + } + this.lastNeed = 1; + this.lastTotal = 2; + this.lastChar[0] = buf[buf.length - 1]; + return buf.toString('utf16le', i, buf.length - 1); +} + +// For UTF-16LE we do not explicitly append special replacement characters if we +// end on a partial character, we simply let v8 handle that. +function utf16End(buf) { + var r = buf && buf.length ? this.write(buf) : ''; + if (this.lastNeed) { + var end = this.lastTotal - this.lastNeed; + return r + this.lastChar.toString('utf16le', 0, end); + } + return r; +} + +function base64Text(buf, i) { + var n = (buf.length - i) % 3; + if (n === 0) return buf.toString('base64', i); + this.lastNeed = 3 - n; + this.lastTotal = 3; + if (n === 1) { + this.lastChar[0] = buf[buf.length - 1]; + } else { + this.lastChar[0] = buf[buf.length - 2]; + this.lastChar[1] = buf[buf.length - 1]; + } + return buf.toString('base64', i, buf.length - n); +} + +function base64End(buf) { + var r = buf && buf.length ? this.write(buf) : ''; + if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed); + return r; +} + +// Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex) +function simpleWrite(buf) { + return buf.toString(this.encoding); +} + +function simpleEnd(buf) { + return buf && buf.length ? this.write(buf) : ''; +} +},{"safe-buffer":731}],752:[function(require,module,exports){ (function (setImmediate,clearImmediate){(function (){ var nextTick = require('process/browser.js').nextTick; var apply = Function.prototype.apply; @@ -65800,5 +71652,850 @@ exports.clearImmediate = typeof clearImmediate === "function" ? clearImmediate : }; }).call(this)}).call(this,require("timers").setImmediate,require("timers").clearImmediate) -},{"process/browser.js":684,"timers":697}]},{},[1]) -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJicm93c2VyL2FwcC5qcyIsImRpc3QvYXNzZXJ0LWV4aXN0cy5qcyIsImRpc3QvY29uc3RzLmpzIiwiZGlzdC9jb252YXJzLmpzIiwiZGlzdC9jcm9zc2hhaXIuanMiLCJkaXN0L2RlbW8uanMiLCJkaXN0L2VudGl0aWVzLmpzIiwiZGlzdC9lbnRpdGllcy9iYXNlZW50aXR5LmpzIiwiZGlzdC9lbnRpdGllcy9nYW1lcnVsZXMuanMiLCJkaXN0L2VudGl0aWVzL2l0ZW1kZWZzLmpzIiwiZGlzdC9lbnRpdGllcy9uZXR3b3JrYWJsZS5qcyIsImRpc3QvZW50aXRpZXMvcGxheWVyLmpzIiwiZGlzd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bHJlYWR5IGhhdmUgbGlzdGVuZXJzIGZvciB0aGlzIGV2ZW50LCBub3RoaW5nIHRvIGRvXG4gICAgICAgICAgICBpZiAodGhpcy5saXN0ZW5lckNvdW50KGV2ZW50KSA+IDApXG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgY29uc3Qgc3VwcGxlbWVudCA9IHRoaXMuX2ZpbmRTdXBwbGVtZW50KGV2ZW50KTtcbiAgICAgICAgICAgIGlmIChzdXBwbGVtZW50ID09IG51bGwpXG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgY29uc3QgY2xlYW51cEZuID0gc3VwcGxlbWVudC5zZXR1cCh0aGlzKTtcbiAgICAgICAgICAgIHRoaXMuX3N1cHBsZW1lbnRDbGVhbnVwRm5zLnNldChzdXBwbGVtZW50LCBjbGVhbnVwRm4pO1xuICAgICAgICB9KTtcbiAgICAgICAgdGhpcy5vbihcInJlbW92ZUxpc3RlbmVyXCIsIChldmVudCkgPT4ge1xuICAgICAgICAgICAgLy8gSWYgdGhlcmUgYXJlIHN0aWxsIGxpc3RlbmVycyBmb3IgdGhpcyBldmVudCwgZWFybHkgb3V0XG4gICAgICAgICAgICBpZiAodGhpcy5saXN0ZW5lckNvdW50KGV2ZW50KSA+IDApXG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgY29uc3Qgc3VwcGxlbWVudCA9IHRoaXMuX2ZpbmRTdXBwbGVtZW50KGV2ZW50KTtcbiAgICAgICAgICAgIGlmIChzdXBwbGVtZW50ID09IG51bGwpXG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgLy8gRG9uJ3QgY2xlYW51cCBpZiB0aGVyZSBhcmUgbGlzdGVuZXJzIG9uIG90aGVyIGVtaXRzIHRoYXQgdGhpcyBzdXBwbGVtZW50IGVtaXRzXG4gICAgICAgICAgICBjb25zdCBleGlzdGluZ0xpc3RlbmVyQ291bnQgPSBzdXBwbGVtZW50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lbnRpdGllcy50ZWFtc2BcbiAgICAgKiBAcmV0dXJucyBBbGwgdGVhbSBlbnRpdGllc1xuICAgICAqL1xuICAgIGdldCB0ZWFtcygpIHtcbiAgICAgICAgcmV0dXJuIHRoaXMuZW50aXRpZXMudGVhbXM7XG4gICAgfVxuICAgIC8qKlxuICAgICAqIFNob3J0Y3V0IGZvciBgdGhpcy5lbnRpdGllcy5nYW1lUnVsZXNgXG4gICAgICogQHJldHVybnMgR2FtZVJ1bGVzIGVudGl0eVxuICAgICAqL1xuICAgIGdldCBnYW1lUnVsZXMoKSB7XG4gICAgICAgIHJldHVybiB0aGlzLmVudGl0aWVzLmdhbWVSdWxlcztcbiAgICB9XG4gICAgX2ZpbmRTdXBwbGVtZW50KGV2ZW50TmFtZSkge1xuICAgICAgICBmb3IgKGNvbnN0IHN1cHBsZW1lbnQgb2YgdGhpcy5fc3VwcGxlbWVudEV2ZW50cykge1xuICAgICAgICAgICAgaWYgKHN1cHBsZW1lbnQuZW1pdHMuaW5kZXhPZihldmVudE5hbWUpID49IDApXG4gICAgICAgICAgICAgICAgcmV0dXJuIHN1cHBsZW1lbnQ7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG51bGw7XG4gICAgfVxuICAgIHBhcnNlU3RyZWFtKHN0cmVhbSkge1xuICAgICAgICB0aGlzLl9oYXNFbmRlZCA9IGZhbHNlO1xuICAgICAgICBjb25zdCBvblJlY2VpdmVDaHVuayA9IChjaHVuaykgPT4ge1xuICAgICAgICAgICAgLy8gZXNsaW50LWRpc2FibGUtbmV4dC1saW5lIEB0eXBlc2NyaXB0LWVzbGludC9uby11bm5lY2Vzc2FyeS1jb25kaXRpb25cbiAgICAgICAgICAgIGlmICh0aGlzLl9ieXRlYnVmID09IG51bGwpIHtcbiAgICAgICAgICAgICAgICB0aGlzLl9ieXRlYnVmID0gQnl0ZUJ1ZmZlci53cmFwKGNodW5rLCB0cnVlKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgIHRoaXMuX2NodW5rcy5wdXNoKGNodW5rKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfTtcbiAgICAgICAgY29uc3QgcmVhZFBhY2tldENodW5rID0gKCkgPT4ge1xuICAgICAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgICAgICAvLyBLZWVwIHJlYWRpbmcgdW50aWwgd2UgY2FuJ3QgcmVhZCBhbnkgbW9yZVxuICAgICAgICAgICAgICAgIHdoaWxlICh0aGlzLl9ieXRlYnVmLnJlbWFpbmluZygpID4gMCB8fCB0aGlzLl9jaHVua3MubGVuZ3RoID4gMCkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLl9ieXRlYnVmLm1hcmsoKTtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5fcmVhZENvbW1hbmQoKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBjYXRjaCAoZSkge1xuICAgICAgICAgICAgICAgIGlmIChlIGluc3RhbmNlb2YgUmFuZ2VFcnJvcikge1xuICAgICAgICAgICAgICAgICAgICAvLyBSZXNldCB0aGUgYnl0ZSBidWZmZXIgdG8gdGhlIHN0YXJ0IG9mIHRoZSBsYXN0IGNvbW1hbmRcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5fYnl0ZWJ1Zi5vZmZzZXQgPSBNYXRoLm1heCgwLCB0aGlzLl9ieXRlYnVmLm1hcmtlZE9mZnNldCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICBzdHJlYW0ub2ZmKFwiZGF0YVwiLCBvblJlY2VpdmVDaHVuayk7XG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IGVycm9yID0gZSBpbnN0YW5jZW9mIEVycm9yXG4gICAgICAgICAgICAgICAgICAgICAgICA/IGVcbiAgICAgICAgICAgICAgICAgICAgICAgIDogbmV3IEVycm9yKGBFeGNlcHRp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oYml0YnVmLnJlYWRPbmVCaXQoKSlcbiAgICAgICAgICAgIG1vdmUuYWltRGlyZWN0aW9uLnkgPSBiaXRidWYucmVhZEZsb2F0MzIoKTtcbiAgICAgICAgaWYgKGJpdGJ1Zi5yZWFkT25lQml0KCkpXG4gICAgICAgICAgICBtb3ZlLmFpbURpcmVjdGlvbi56ID0gYml0YnVmLnJlYWRGbG9hdDMyKCk7XG4gICAgICAgIC8vIFJlYWQgbW92ZW1lbnRcbiAgICAgICAgaWYgKGJpdGJ1Zi5yZWFkT25lQml0KCkpXG4gICAgICAgICAgICBtb3ZlLmZvcndhcmRNb3ZlID0gYml0YnVmLnJlYWRGbG9hdDMyKCk7XG4gICAgICAgIGlmIChiaXRidWYucmVhZE9uZUJpdCgpKVxuICAgICAgICAgICAgbW92ZS5zaWRlTW92ZSA9IGJpdGJ1Zi5yZWFkRmxvYXQzMigpO1xuICAgICAgICBpZiAoYml0YnVmLnJlYWRPbmVCaXQoKSlcbiAgICAgICAgICAgIG1vdmUudXBNb3ZlID0gYml0YnVmLnJlYWRGbG9hdDMyKCk7XG4gICAgICAgIGlmIChiaXRidWYucmVhZE9uZUJpdCgpKSB7XG4gICAgICAgICAgICBjb25zdCBidXR0b25zID0gYml0YnVmLnJlYWRVSW50MzIoKTtcbiAgICAgICAgICAgIGlmIChidXR0b25zICYgKDEgPDwgMCkpXG4gICAgICAgICAgICAgICAgbW92ZS5idXR0b25zLnB1c2goXCJhdHRhY2tcIik7XG4gICAgICAgICAgICBpZiAoYnV0dG9ucyAmICgxIDw8IDEpKVxuICAgICAgICAgICAgICAgIG1vdmUuYnV0dG9ucy5wdXNoKFwianVtcFwiKTtcbiAgICAgICAgICAgIGlmIChidXR0b25zICYgKDEgPDwgMikpXG4gICAgICAgICAgICAgICAgbW92ZS5idXR0b25zLnB1c2goXCJkdWNrXCIpO1xuICAgICAgICAgICAgaWYgKGJ1dHRvbnMgJiAoMSA8PCAzKSlcbiAgICAgICAgICAgICAgICBtb3ZlLmJ1dHRvbnMucHVzaChcImZvcndhcmRcIik7XG4gICAgICAgICAgICBpZiAoYnV0dG9ucyAmICgxIDw8IDQpKVxuICAgICAgICAgICAgICAgIG1vdmUuYnV0dG9ucy5wdXNoKFwiYmFja1wiKTtcbiAgICAgICAgICAgIGlmIChidXR0b25zICYgKDEgPDwgNSkpXG4gICAgICAgICAgICAgICAgbW92ZS5idXR0b25zLnB1c2goXCJ1c2VcIik7XG4gICAgICAgICAgICBpZiAoYnV0dG9ucyAmICgxIDw8IDYpKVxuICAgICAgICAgICAgICAgIG1vdmUuYnV0dG9ucy5wdXNoKFwiY2FuY2VsXCIpO1xuICAgICAgICAgICAgaWYgKGJ1dHRvbnMgJiAoMSA8PCA3KSlcbiAgICAgICAgICAgICAgICBtb3ZlLmJ1dHRvbnMucHVzaChcImxlZnRcIik7XG4gICAgICAgICAgICBpZiAoYnV0dG9ucyAmICgxIDw8IDgpKVxuICAgICAgICAgICAgICAgIG1vdmUuYnV0dG9ucy5wdXNoKFwicmlnaHRcIik7XG4gICAgICAgICAgICBpZiAoYnV0dG9ucyAmICgxIDw8IDkpKVxuICAgICAgICAgICAgICAgIG1vdmUuYnV0dG9ucy5wdXNoKFwibW92ZWxlZnRcIik7XG4gICAgICAgICAgICBpZiAoYnV0dG9ucyAmICgxIDw8IDEwKSlcbiAgICAgICAgICAgICAgICBtb3ZlLmJ1dHRvbnMucHVzaChcIm1vdmVyaWdodFwiKTtcbiAgICAgICAgICAgIGlmIChidXR0b25zICYgKDEgPDwgMTEpKVxuICAgICAgICAgICAgICAgIG1vdmUuYnV0dG9ucy5wdXNoKFwiYXR0YWNrMlwiKTtcbiAgICAgICAgICAgIGlmIChidXR0b25zICYgKDEgPDwgMTIpKVxuICAgICAgICAgICAgICAgIG1vdmUuYnV0dG9ucy5wdXNoKFwicnVuXCIpO1xuICAgICAgICAgICAgaWYgKGJ1dHRvbnMgJiAoMSA8PCAxMykpXG4gICAgICAgICAgICAgICAgbW92ZS5idXR0b25zLnB1c2goXCJyZWxvYWRcIik7XG4gICAgICAgICAgICBpZiAoYnV0dG9ucyAmICgxIDw8IDE0KSlcbiAgICAgICAgICAgICAgICBtb3ZlLmJ1dHRvbnMucHVzaChcImFsdDFcIik7XG4gICAgICAgICAgICBpZiAoYnV0dG9ucyAmICgxIDw8IDE1KSlcbiAgICAgICAgICAgICAgICBtb3ZlLmJ1dHRvbnMucHVzaChcImFsdDJcIik7XG4gICAgICAgICAgICBpZiAoYnV0dG9ucyAmICgxIDw8IDE2KSlcbiAgICAgICAgICAgICAgICBtb3ZlLmJ1dHRvbnMucHVzaChcInNjb3JlXCIpO1xuICAgICAgICAgICAgaWYgKGJ1dHRvbnMgJiAoMSA8PCAxNykpXG4gICAgICAgICAgICAgICAgbW92ZS5idXR0b25zLnB1c2goXCJzcGVlZFwiKTtcbiAgICAgICAgICAgIGlmIChidXR0b25zICYgKDEgPDwgMTgpKVxuICAgICAgICAgICAgICAgIG1vdmUuYnV0dG9ucy5wdXNoKFwid2Fsa1wiKTtcbiAgICAgICAgICAgIGlmIChidXR0b25zICYgKDEgPDwgMTkpKVxuICAgICAgICAgICAgICAgIG1vdmUuYnV0dG9ucy5wdXNoKFwiem9vbVwiKTtcbiAgICAgICAgICAgIGlmIChidXR0b25zICYgKDEgPDwgMjApKVxuICAgICAgICAgICAgICAgIG1vdmUuYnV0dG9ucy5wdXNoKFwid2VhcG9uMVwiKTtcbiAgICAgICAgICAgIGlmIChidXR0b25zICYgKDEgPDwgMjEpKVxuICAgICAgICAgICAgICAgIG1vdmUuYnV0dG9ucy5wdXNoKFwid2VhcG9uMlwiKTtcbiAgICAgICAgICAgIGlmIChidXR0b25zICYgKDEgPDwgMjIpKVxuICAgICAgICAgICAgICAgIG1vdmUuYnV0dG9ucy5wdXNoKFwiYnVsbHJ1c2hcIik7XG4gICAgICAgICAgICBpZiAoYnV0dG9ucyAmICgxIDw8IDIzKSlcbiAgICAgICAgICAgICAgICBtb3ZlLmJ1dHRvbnMucHVzaChcImd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ICAgICAgdGhpcy5lbWl0KFwidGlja3N0YXJ0XCIsIHRoaXMuY3VycmVudFRpY2spO1xuICAgICAgICB9XG4gICAgICAgIHN3aXRjaCAoY29tbWFuZCkge1xuICAgICAgICAgICAgY2FzZSAyIC8qIFBhY2tldCAqLzpcbiAgICAgICAgICAgIGNhc2UgMSAvKiBTaWdub24gKi86XG4gICAgICAgICAgICAgICAgdGhpcy5faGFuZGxlRGVtb1BhY2tldCgpO1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSA2IC8qIERhdGFUYWJsZXMgKi86XG4gICAgICAgICAgICAgICAgdGhpcy5faGFuZGxlRGF0YVRhYmxlcygpO1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSA5IC8qIFN0cmluZ1RhYmxlcyAqLzpcbiAgICAgICAgICAgICAgICB0aGlzLl9oYW5kbGVTdHJpbmdUYWJsZXMoKTtcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgNCAvKiBDb25zb2xlQ21kICovOiAvLyBUT0RPXG4gICAgICAgICAgICAgICAgdGhpcy5faGFuZGxlRGF0YUNodW5rKCk7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIDUgLyogVXNlckNtZCAqLzpcbiAgICAgICAgICAgICAgICB0aGlzLl9oYW5kbGVVc2VyQ21kKCk7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIDcgLyogU3RvcCAqLzpcbiAgICAgICAgICAgICAgICB0aGlzLmNhbmNlbCgpO1xuICAgICAgICAgICAgICAgIHRoaXMuZW1pdChcInRpY2tlbmRcIiwgdGhpcy5jdXJyZW50VGljayk7XG4gICAgICAgICAgICAgICAgdGhpcy5fZW1pdEVuZCh7IGluY29tcGxldGU6IGZhbHNlIH0pO1xuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIGNhc2UgOCAvKiBDdXN0b21EYXRhICovOlxuICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcIkN1c3RvbSBkYXRhIG5vdCBzdXBwb3J0ZWRcIik7XG4gICAgICAgICAgICBjYXNlIDMgLyogU3luY1RpY2sgKi86XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcIlVucmVjb2duaXNlZCBjb21tYW5kXCIpO1xuICAgICAgICB9XG4gICAgfVxuICAgIF9wYXJzZVJlY3Vyc2UoKSB7XG4gICAgICAgIGNvbnN0IG5vdyA9IERhdGUubm93KCk7XG4gICAgICAgIC8vIFNjaGVkdWxlIGFub3RoZXIgcm91bmQgb2YgcGFyc2luZ1xuICAgICAgICBpZiAobm93IC0gdGhpcy5fbGFzdFRocmVhZFlpZWxkVGltZSA8IDMyKSB7XG4gICAgICAgICAgICB0aGlzLl9pbW1lZGlhdGVUaW1lclRva2VuID0gdGltZXJzLnNldEltbWVkaWF0ZSh0aGlzLl9wYXJzZVJlY3Vyc2UuYmluZCh0aGlzKSk7XG4gICAgICAgIH1cbiAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICB0aGlzLl9sYXN0VGhyZWFkWWllbGRUaW1lID0gbm93O1xuICAgICAgICAgICAgdGhpcy5fdGltZW91dFRpbWVyVG9rZW4gPSB0aW1lcnMuc2V0VGltZW91dCh0aGlzLl9wYXJzZVJlY3Vyc2UuYmluZCh0aGlzKSwgMCk7XG4gICAgICAgIH1cbiAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgIHRoaXMuZW1pdChcInByb2dyZXNzXCIsIHRoaXMuX2J5dGVidWYub2Zmc2V0IC8gdGhpcy5fYnl0ZWJ1Zi5saW1pdCk7XG4gICAgICAgICAgICB0aGlzLl9yZWFkQ29tbWFuZCgpO1xuICAgICAgICB9XG4gICAgICAgIGNhdGNoIChlKSB7XG4gICAgICAgICAgICAvLyBBbHdheXMgY2FuY2VsIGlmIHdlIGhhdmUgYW4gZXJyb3IgLSB3ZSd2ZSBhbHJlYWR5IHNjaGVkdWxlZCB0aGUgbmV4dCB0aWNrXG4gICAgICAgICAgICB0aGlzLmNhbmNlbCgpO1xuICAgICAgICAgICAgLy8gIzExLCAjMTcyOiBTb21lIGRlbW9zIGhhdmUgYmVlbiB3cml0dGVuIGluY29tcGxldGVseS5cbiAgICAgICAgICAgIC8vIERvbid0IHRocm93IGFuIGVycm9yIHdoZW4gd2UgcnVuIG91dCBvZiBieXRlcyB0byByZWFkLlxuICAgICAgICAgICAgaWYgKGUgaW5zdGFuY2VvZiBSYW5nZUVycm9yICYmXG4gICAgICAgICAgICAgICAgdGhpcy5oZWFkZXIucGxheWJhY2tUaWNrcyA9PT0gMCAmJlxuICAgICAgICAgICAgICAgIHRoaXMuaGVhZGVyLnBsYXliYWNrVGltZSA9PT0gMCAmJlxuICAgICAgICAgICAgICAgIHRoaXMuaGVhZGVyLnBsYXliYWNrRnJhbWVzID09PSAwKSB7XG4gICAgICAgICAgICAgICAgdGhpcy5fZW1pdEVuZCh7IGluY29tcGxldGU6IHRydWUgfSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICBjb25zdCBlcnJvciA9IGUgaW5zdGFuY2VvZiBFcnJvciA/IGUgOiBuZXcgRXJyb3IoYEV4Y2VwdGlvbiBkdXJpbmcgcGFyc2luZzogJHtlfWApO1xuICAgICAgICAgICAgICAgIHRoaXMuX2VtaXRFbmQoeyBlcnJvciwgaW5jb21wbGV0ZTogZmFsc2UgfSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9XG59XG5leHBvcnRzLkRlbW9GaWxlID0gRGVtb0ZpbGU7XG4vLyMgc291cmNlTWFwcGluZ1VSTD1kZW1vLmpzLm1hcCIsIlwidXNlIHN0cmljdFwiO1xuT2JqZWN0LmRlZmluZVByb3BlcnR5KGV4cG9ydHMsIFwiX19lc01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ICAgICAgICB9KTtcbiAgICAgICAgZGVtby5vbihcIm5ldF9UaWNrXCIsIGUgPT4ge1xuICAgICAgICAgICAgdGhpcy5fY3VycmVudFNlcnZlclRpY2sgPSBlLnRpY2s7XG4gICAgICAgIH0pO1xuICAgICAgICBkZW1vLnN0cmluZ1RhYmxlcy5vbihcImNyZWF0ZVwiLCB0YWJsZSA9PiB7XG4gICAgICAgICAgICBpZiAodGFibGUubmFtZSA9PT0gXCJ1c2VyaW5mb1wiKVxuICAgICAgICAgICAgICAgIHRoaXMuX3VzZXJJbmZvVGFibGUgPSB0YWJsZTtcbiAgICAgICAgfSk7XG4gICAgICAgIGRlbW8uc3RyaW5nVGFibGVzLm9uKFwidXBkYXRlXCIsIGUgPT4gdGhpcy5faGFuZGxlU3RyaW5nVGFibGVVcGRhdGUoZSkpO1xuICAgICAgICBkZW1vLm9uKFwidGlja2VuZFwiLCAoKSA9PiB7XG4gICAgICAgICAgICBpZiAodGhpcy5tYXJrZWRGb3JEZWxldGlvbi5sZW5ndGggPiAwKSB7XG4gICAgICAgICAgICAgICAgZm9yIChjb25zdCBpbmRleCBvZiB0aGlzLm1hcmtlZEZvckRlbGV0aW9uKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuZW50aXRpZXMuZGVsZXRlKGluZGV4KTtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5lbWl0KFwicmVtb3ZlXCIsIHsgaW5kZXggfSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHRoaXMubWFya2VkRm9yRGVsZXRpb24ubGVuZ3RoID0gMDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSk7XG4gICAgfVxuICAgIC8qKlxuICAgICAqIERldGVybWluZXMgd2hldGhlciBoYW5kbGUgaXMgc2V0LlxuICAgICAqIFRoaXMgZnVuY3Rpb24gZG9lcyBub3QgZGV0ZXJtaW5lIHdoZXRoZXIgdGhlIGhhbmRsZSBwb2ludHMgdG8gYSB2YWxpZCBlbnR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G4gICAgLyoqXG4gICAgICogUmV0dXJucyB0aGUgZW50aXR5IHRoYXQgYmVsb25ncyB0byB0aGUgcGxheWVyIHdpdGggYSBnaXZlbiA2NC1iaXQgU3RlYW0gSUQuXG4gICAgICogQHBhcmFtIHtMb25nfHN0cmluZ30gc3RlYW02NElkIC0gNjQtYml0IFN0ZWFtIElEXG4gICAgICogQHJldHVybnMge1BsYXllcnxudWxsfSBFbnRpdHkgcmVmZXJlbmNlZCBieSB0aGUgU3RlYW0gSUQuIGBudWxsYCBpZiBubyBtYXRjaGluZyBwbGF5ZXIuXG4gICAgICovXG4gICAgZ2V0QnlTdGVhbTY0SWQoc3RlYW02NElkKSB7XG4gICAgICAgIGNvbnN0IGlkU3RyaW5nID0gc3RlYW02NElkIGluc3RhbmNlb2YgTG9uZyA/IHN0ZWFtNjRJZC50b1N0cmluZygpIDogc3RlYW02NElkO1xuICAgICAgICBjb25zdCBlbnRpdHlJbmRleCA9IHRoaXMuX3N0ZWFtNjRJZFRvRW50aXR5LmdldChpZFN0cmluZyk7XG4gICAgICAgIGlmIChlbnRpdHlJbmRleCA9PT0gdW5kZWZpbmVkKVxuICAgICAgICAgICAgcmV0dXJuIG51bGw7XG4gICAgICAgIHJldHVybiB0aGlzLmVudGl0aWVzLmdldChlbnRpdHlJbmRleCk7XG4gICAgfVxuICAgIGdldFNpbmdsZXRvbihzZXJ2ZXJDbGFzcykge1xuICAgICAgICBjb25zdCBleGlzdGluZyA9IHRoaXMuX3NpbmdsZXRvbkVudHNbc2VydmVyQ2xhc3NdO1xuICAgICAgICBpZiAoZXhpc3RpbmcpIHtcbiAgICAgICAgICAgIHJldHVybiBleGlzdGluZztcbiAgICAgICAgfVxuICAgICAgICBjb25zdCByZXN1bHQgPSAoMCwgaXRlcl90b29sc18xLmZpbmQpKChbLCBlbnRdKSA9PiBlbnQuc2VydmVyQ2xhc3MubmFtZSA9PT0gc2VydmVyQ2xhc3MsIHRoaXMuZW50aXRpZXMpO1xuICAgICAgICBpZiAoIXJlc3VsdCkge1xuICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKGBNaXNzaW5nIHNpbmdsZXRvbiAke3NlcnZlckNsYXNzfWApO1xuICAgICAgICB9XG4gICAgICAgIGNvbnN0IFssIGVudGl0eV0gPSByZXN1bHQ7XG4gICAgICAgIHRoaXMuX3NpbmdsZXRvbkVudHNbc2VydmVyQ2xhc3NdID0gZW50aXR5O1xuICAgICAgICByZXR1cm4gZW50aXR5O1xuICAgIH1cbiAgICAqZmluZEFsbFdpdGhUYWJsZSh0YWJsZSkge1xuICAgICAgICBmb3IgKGNvbnN0IGVudCBvZiB0aGlzLmVudGl0aWVzLnZhbHVlcygpKSB7XG4gICAgICAgICAgICBpZiAodGFibGUgaW4gZW50LnByb3BzKSB7XG4gICAgICAgICAgICAgICAgeWllbGQgZW50O1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfVxuICAgICpmaW5kQWxsV2l0aENsYXNzKGtsYXNzKSB7XG4gICAgICAgIGZvciAoY29uc3QgZW50IG9mIHRoaXMuZW50aXRpZXMudmFsdWVzKCkpIHtcbiAgICAgICAgICAgIGlmIChlbnQgaW5zdGFuY2VvZiBrbGFzcykge1xuICAgICAgICAgICAgICAgIHlpZWxkIGVudDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cbiAgICBoYW5kbGVEYXRhVGFibGVzKGNodW5rKSB7XG4gICAgICAgIC8vIGVzbGludC1kaXNhYmxlLW5leHQtbGluZSBuby1jb25zdGFudC1jb25kaXRpb25cbiAgICAgICAgd2hpbGUgKHRydWUpIHtcbiAgICAgICAgICAgIGNvbnN0IGRlc2NyaXB0b3IgPSBuZXQuZmluZEJ5VHlwZShjaHVuay5yZWFkVmFyaW50MzIoKSk7XG4gICAgICAgICAgICBhc3NlcnQoKGRlc2NyaXB0b3IgPT09IG51bGwgfHwgZGVzY3JpcHRvciA9PT0gdm9pZCAwID8gdm9pZCAwIDogZGVzY3JpcHRvci5uYW1lK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y5wZW5kaW5nQmFzZWxpbmVzW2NsYXNzSWRdO1xuICAgICAgICAgICAgaWYgKHBlbmRpbmdCYXNlbGluZSkge1xuICAgICAgICAgICAgICAgIHRoaXMuc3RhdGljQmFzZWxpbmVzW2NsYXNzSWRdID0gdGhpcy5fcGFyc2VJbnN0YW5jZUJhc2VsaW5lKHBlbmRpbmdCYXNlbGluZSwgY2xhc3NJZCk7XG4gICAgICAgICAgICAgICAgdGhpcy5lbWl0KFwiYmFzZWxpbmV1cGRhdGVcIiwge1xuICAgICAgICAgICAgICAgICAgICBjbGFzc0lkLFxuICAgICAgICAgICAgICAgICAgICBzZXJ2ZXJDbGFzcyxcbiAgICAgICAgICAgICAgICAgICAgYmFzZWxpbmU6IHRoaXMuc3RhdGljQmFzZWxpbmVzW2NsYXNzSWRdXG4gICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgZGVsZXRlIHRoaXMucGVuZGluZ0Jhc2VsaW5lc1tjbGFzc0lkXTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBhc3NlcnQuZXF1YWwoY2h1bmsucmVtYWluaW5nKCksIDApO1xuICAgICAgICB0aGlzLmVtaXQoXCJkYXRhdGFibGVzcmVhZHlcIik7XG4gICAgfVxuICAgIF9nYXRoZXJFeGNsdWRlcyh0YWJsZSkge1xuICAgICAgICBjb25zdCBleGNsdWRlcyA9IFtdO1xuICAgICAgICBmb3IgKGNvbnN0IHByb3Agb2YgdGFibGUucHJvcHMpIHtcbiAgICAgICAgICAgIGlmICgocHJvcC5mbGFncyAmIHByb3BzXzEuU1BST1BfRVhDTFVERSkgIT09IDApIHtcbiAgICAgICAgICAgICAgICBleGNsdWRlcy5wdXNoKHByb3ApO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKHByb3AudHlwZSA9PT0gNiAvKiBEYXRhVGFibGUgKi8pIHtcbiAgICAgICAgICAgICAgICBjb25zdCBzdWJUYWJsZSA9ICgwLCBhc3NlcnRfZXhpc3RzXzEuZGVmYXVsdCkodGhpcy5fZmluZFRhYmxlQnlOYW1lKHByb3AuZHROYW1lKSk7XG4gICAgICAgICAgICAgICAgZXhjbHVkZXMucHVzaCguLi50aGlzLl9nYXRoZXJFeGNsdWRlcyhzdWJUYWJsZSkpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBleGNsdWRlcztcbiAgICB9XG4gICAgX2dhdGhlclByb3BzKHRhYmxlLCBleGNsdWRlcykge1xuICAgICAgICBjb25zdCBmbGF0dGVuZWQgPSBbXTtcbiAgICAgICAgZm9yIChsZXQgaW5kZXggPSAwOyBpbmRleCA8IHRhYmxlLnByb3BzLmxlbmd0aDsgKytpbmRleCkge1xuICAgICAgICAgICAgY29uc3QgcHJvcCA9IHRhYmxlLnByb3BzW2luZGV4XTtcbiAgICAgICAgICAgIGlmICgocHJvcC5mbGFncyAmIHByb3BzXzEuU1BST1BfSU5TSURFQVJSQVkpICE9PSAwIHx8XG4gICAgICAgICAgICAgICAgKHByb3AuZmxhZ3MgJiBwcm9wc18xLlNQUk9QX0VYQ0xVREUpICE9PSAwIHx8XG4gICAgICAgICAgICAgICAgaXNQcm9wRXhjbHVkZWQoZXhjbHVkZXMsIHRhYmxlLCBwcm9wKSkge1xuICAgICAgICAgICAgICAgIGNvbnRpbnVlO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKHByb3AudHlwZSA9PT0gNiAvKiBEYXRhVGFibGUgKi8pIHtcbiAgICAgICAgICAgICAgICBjb25zdCBzdWJUYWJsZSA9ICgwLCBhc3NlcnRfZXhpc3RzXzEuZGVmYXVsdCkodGhpcy5fZmluZFRhYmxlQnlOYW1lKHByb3AuZHROYW1lKSk7XG4gICAgICAgICAgICAgICAgY29uc3QgY2hpbGRQcm9wcyA9IHRoaXMuX2dhdGhlclByb3BzKHN1YlRhYmxlLCBleGNsdWRlcyk7XG4gICAgICAgICAgICAgICAgaWYgKChwcm9wLmZsYWdzICYgcHJvcHNfMS5TUFJPUF9DT0xMQVBTSUJMRSkgPT09IDApIHtcbiAgICAgICAgICAgICAgICAgICAgZm9yIChjb25zdCBmcCBvZiBjaGlsZFByb3BzKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBmcC5jb2xsYXBzaWJsZSA9IGZhbHNlO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGZsYXR0ZW5lZC5wdXNoKC4uLmNoaWxkUHJvcHMpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgZmxhdHRlbmVkLnB1c2goe1xuICAgICAgICAgICAgICAgICAgICBwcm9wLFxuICAgICAgICAgICAgICAgICAgICB0YWJsZSxcbiAgICAgICAgICAgICAgICAgICAgZGVjb2RlOiAoMCwgcHJvcHNfMS5tYWtlRGVjb2RlcikocHJvcCwgcHJvcC50eXBlID09PSA1IC8qIEFycmF5ICovID8gdGFibGUucHJvcHNbaW5kZXggLSAxXSA6IHVuZGVmaW5lZCksXG4gICAgICAgICAgICAgICAgICAgIGNvbGxhcHNpYmxlOiB0cnVlXG4gICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgLy8gY29sbGFwc2libGUgcHJvcHMgc2hvdWxkIGNvbWUgYWZ0ZXIgbm9uLWNvbGxhcHNpYmxlXG4gICAgICAgIHJldHVybiBmbGF0dGVuZWQuc29ydCgoeyBjb2xsYXBzaWJsZTogYSB9LCB7IGNvbGxhcHNpYmxlOiBiIH0pID0+IChhID8gMSA6IDApIC0gKGIgPyAxIDogMCkpO1xuICAgIH1cbiAgICBfZmxhdHRlbkRhdGFUYWJsZSh0YWJsZSkge1xuICAgICAgICBjb25zdCBmbGF0dGVuZWRQcm9wcyA9IHRoaXMuX2dhdGhlclByb3BzKHRhYmxlLCB0aGlzLl9nYXRoZXJFeGNsdWRlcyh0YWJsZSkpO1xuICAgICAgICBjb25zdCBwcmlvcml0eVNldCA9IG5ldyBTZXQoZmxhdHRlbmVkUHJvcHMubWFwKGZwID0+IGZwLnByb3AucHJpb3JpdHkpKTtcbiAgICAgICAgcHJpb3JpdHlTZXQuYWRkKDY0KTtcbiAgICAgICAgY29uc3QgcHJpb3JpdGllcyA9IEFycmF5LmZyb20ocHJpb3JpdHlTZXQpLnNvcnQoKGEsIGIpID0+IGEgLSBiKTtcbiAgICAgICAgbGV0IHN0YXJ0ID0gMDtcbiAgICAgICAgLy8gT24gdGhpcyBzdXJmYWNlIHRoaXMgbG9va3MgbGlrZSBhIHNvcnQgYnkgcHJpb3JpdHkgKG9yIG1pbig2NCwgcHJpb3JpdHkpXG4gICAgICAgIC8vIGZvciBDSEFOR0VTX09GVEVOIHByb3BzKS4gSXQncyBub3QgYSBzdGFibGUgc29ydCBzbyBpdCBjYW4ndCBqdXN0IGJlXG4gICAgICAgIC8vIHJlcGxhY2VkIHdpdGggSlMgQXJyYXkjc29ydFxuICAgICAgICBmb3IgKGNvbnN0IHByaW9yaXR5IG9mIHByaW9yaXRpZXMpIHtcbiAgICAgICAgICAgIC8vIGVzbGludC1kaXNhYmxlLW5leHQtbGluZSBuby1jb25zdGFudC1jb25kaXRpb25cbiAgICAgICAgICAgIHdoaWxlICh0cnVlKSB7XG4gICAgICAgICAgICAgICAgbGV0IGN1cnJlbnRQcm9wO1xuICAgICAgICAgICAgICAgIGZvciAoY3VycmVudFByb3AgPSBzdGFydDsgY3VycmVudFByb3AgPCBmbGF0dGVuZWRQcm9wcy5sZW5ndGg7ICsrY3VycmVudFByb3ApIHtcbiAgICAgICAgICAgICAgICAgICAgY29uc3QgcHJvcCA9IGZsYXR0ZW5lZFByb3BzW2N1cnJlbnRQcm9wXS5wcm9wO1xuICAgICAgICAgICAgICAgICAgICBpZiAocHJvcC5wcmlvcml0eSA9PT0gcHJpb3JpdHkgfHxcbiAgICAgICAgICAgICAgICAgICAgICAgIChwcmlvcml0eSA9PT0gNjQgJiYgKHByb3AuZmxhZ3MgJiBwcm9wc18xLlNQUk9QX0NIQU5HRVNfT0ZURU4pICE9PSAwKSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHN0YXJ0ICE9PSBjdXJyZW50UHJvcCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHRlbXAgPSBmbGF0dGVuZWRQcm9wc1tzdGFydF07XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZmxhdHRlbmVkUHJvcHNbc3RhcnRdID0gZmxhdHRlbmVkUHJvcHNbY3VycmVudFByb3BdO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZsYXR0ZW5lZFByb3BzW2N1cnJlbnRQcm9wXSA9IHRlbXA7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICBzdGFydCsrO1xuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgaWYgKGN1cnJlbnRQcm9wID09PSBmbGF0dGVuZWRQcm9wcy5sZW5ndGgpIHtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBmbGF0dGVuZWRQcm9wcztcbiAgICB9XG4gICAgX2ZpbmRUYWJsZUJ5TmFtZShuYW1lKSB7XG4gICAgICAgIHJldHVybiB0aGlzLmRhdGFUYWJsZXMuZmluZCh0YWJsZSA9PiB0YWJsZS5uZXRUYWJsZU5hbWUgPT09IG5hbWUpO1xuICAgIH1cbiAgICBfYWRkRW50aXR5KGluZGV4LCBjbGFzc0lkLCBzZXJpYWxOdW0sIGV4aXN0aW5nRW50aXR5LCBlbnRpdHlCYXNlbGluZSkge1xuICAgICAgICBjb25zdCBiYXNlbGluZSA9IGVudGl0eUJhc2VsaW5lIHx8IH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ICAgY29uc3Qgc2VydmVyQ2xhc3MgPSB0aGlzLnNlcnZlckNsYXNzZXNbY2xhc3NJZF07XG4gICAgICAgIGNvbnN0IG5ld1dheSA9IGVudGl0eUJpdEJ1ZmZlci5yZWFkT25lQml0KCk7XG4gICAgICAgIGxldCBsYXN0SW5kZXggPSAtMTtcbiAgICAgICAgY29uc3QgZmllbGRJbmRpY2VzID0gW107XG4gICAgICAgIC8vIGVzbGludC1kaXNhYmxlLW5leHQtbGluZSBuby1jb25zdGFudC1jb25kaXRpb25cbiAgICAgICAgd2hpbGUgKHRydWUpIHtcbiAgICAgICAgICAgIGxhc3RJbmRleCA9IHJlYWRGaWVsZEluZGV4KGVudGl0eUJpdEJ1ZmZlciwgbGFzdEluZGV4LCBuZXdXYXkpO1xuICAgICAgICAgICAgaWYgKGxhc3RJbmRleCA9PT0gLTEpIHtcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGZpZWxkSW5kaWNlcy5wdXNoKGxhc3RJbmRleCk7XG4gICAgICAgIH1cbiAgICAgICAgY29uc3QgdXBkYXRlZFByb3BzID0gbmV3IEFycmF5KGZpZWxkSW5kaWNlcy5sZW5ndGgpO1xuICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGZpZWxkSW5kaWNlcy5sZW5ndGg7ICsraSkge1xuICAgICAgICAgICAgY29uc3QgcHJvcEluZGV4ID0gZmllbGRJbmRpY2VzW2ldO1xuICAgICAgICAgICAgY29uc3QgZmxhdHRlbmVkUHJvcCA9IHNlcnZlckNsYXNzLmZsYXR0ZW5lZFByb3BzW3Byb3BJbmRleF07XG4gICAgICAgICAgICBhc3NlcnQoZmxhdHRlbmVkUHJvcCk7XG4gICAgICAgICAgICB1cGRhdGVkUHJvcHNbaV0gPSB7XG4gICAgICAgICAgICAgICAgcHJvcDogZmxhdHRlbmVkUHJvcCxcbiAgICAgICAgICAgICAgICB2YWx1ZTogZmxhdHRlbmVkUHJvcC5kZWN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AgICAgICBjaGFuZ2VzW2ldID0ge1xuICAgICAgICAgICAgICAgICAgICB0YWJsZU5hbWUsXG4gICAgICAgICAgICAgICAgICAgIHZhck5hbWUsXG4gICAgICAgICAgICAgICAgICAgIG9sZFZhbHVlLFxuICAgICAgICAgICAgICAgICAgICBuZXdWYWx1ZTogdXBkYXRlLnZhbHVlXG4gICAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBpZiAocmVjb3JkQ2hhbmdlcykge1xuICAgICAgICAgICAgdGhpcy5lbWl0KFwiY2hhbmdlXCIsIHtcbiAgICAgICAgICAgICAgICBlbnRpdHksXG4gICAgICAgICAgICAgICAgY2hhbmdlc1xuICAgICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICB9XG4gICAgX3VwZGF0ZXNUb1Byb3BPYmplY3QodGFyZ2V0LCB1cGRhdGVzKSB7XG4gICAgICAgIGZvciAoY29uc3QgdXBkYXRlIG9mIHVwZGF0ZXMpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhYmxlTmFtZSA9IHVwZGF0ZS5wcm9wLnRhYmxlLm5ldFRhYmxlTmFtZTtcbiAgICAgICAgICAgIGNvbnN0IHZhck5hbWUgPSB1cGRhdGUucHJvcC5wcm9wLnZhck5hbWU7XG4gICAgICAgICAgICB0YXJnZXRbdGFibGVOYW1lXSA9IE9iamVjdC5hc3NpZ24odGFyZ2V0W3RhYmxlTmFtZV0gfHwge30sIHtcbiAgICAgICAgICAgICAgICBbdmFyTmFtZV06IHVwZGF0ZS52YWx1ZVxuICAgICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHRhcmdldDtcbiAgICB9XG4gICAgX2hhbmRsZVRlbXBFbnRpdGllcyhtc2cpIHtcbiAgICAgICAgY29uc3QgZW50aXR5Qml0QnVmZmVyID0gYml0YnVmZmVyXzEuQml0U3RyZWFtLmZyb20obXNnLmVudGl0eURhdGEpO1xuICAgICAgICBsZXQ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aW5lLmNsYXNzSWQpID09PSBjbGFzc0lkXG4gICAgICAgICAgICAgICAgICAgID8gZXhpc3RpbmdCYXNlbGluZS5wcm9wc1xuICAgICAgICAgICAgICAgICAgICA6IHVuZGVmaW5lZDtcbiAgICAgICAgICAgICAgICBjb25zdCBleGlzdGluZ0VudGl0eSA9IHRoaXMuZW50aXRpZXMuZ2V0KGVudGl0eUluZGV4KTtcbiAgICAgICAgICAgICAgICBjb25zdCBlbnRpdHkgPSB0aGlzLl9hZGRFbnRpdHkoZW50aXR5SW5kZXgsIGNsYXNzSWQsIHNlcmlhbE51bSwgZXhpc3RpbmdFbnRpdHksIGVudGl0eUJhc2VsaW5lUHJvcHMpO1xuICAgICAgICAgICAgICAgIHRoaXMuX3JlYWROZXdFbnRpdHkoZW50aXR5Qml0QnVmZmVyLCBlbnRpdHkpO1xuICAgICAgICAgICAgICAgIGlmIChlbnRpdHkgIT09IGV4aXN0aW5nRW50aXR5KSB7XG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IGV2ZW50VmFycyA9IHsgZW50aXR5IH07XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuZW1pdChcImNyZWF0ZVwiLCBldmVudFZhcnMpO1xuICAgICAgICAgICAgICAgICAgICAvLyBTdGlsbCBlbWl0ICdwb3N0Y3JlYXRlJyBmb3IgYmFja3dhcmRzIGNvbXBhdGliaWxpdHlcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5lbWl0KFwicG9zdGNyZWF0ZVwiLCBldmVudFZhcnMpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAvLyBVcGRhdGUgdGhlIE9USEVSIGJhc2VsaW5lIHdpdGggdGhlIG1lcmdlZCByZXN1bHQgb2YgYG9sZCBiYXNlbGluZSArIG5ldyBwcm9wc2BcbiAgICAgICAgICAgICAgICBpZiAobXNnLnVwZGF0ZUJhc2VsaW5lKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuX2VudGl0eUJhc2VsaW5lc1ttc2cuYmFzZWxpbmUgPyAwIDogMV0uc2V0KGVudGl0eUluZGV4LCB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjbGFzc0lkLFxuICAgICAgICAgICAgICAgICAgICAgICAgcHJvcHM6IGNsb25lUHJvcHMoZW50aXR5LnByb3BzKVxuICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAvLyAwYjAwOiBEZWx0YUVudFxuICAgICAgICAgICAgICAgIGNvbnN0IGVudGl0eSA9ICgwLCBhc3NlcnRfZXhpc3RzXzEuZGVmYXVsdCkodGhpcy5lbnRpdGllcy5nZXQoZW50aXR5SW5kZXgpLCBgbWlzc2luZyBjbGllbnQgZW50aXR5ICR7ZW50aXR5SW5kZXh9YCk7XG4gICAgICAgICAgICAgICAgYXNzZXJ0KGZyYW1lLmNvbnRhaW5zKGVudGl0eUluZGV4KSwgYGRlbHRhIG9uIGRvcm1hbnQgZW50aXR5ICR7ZW50aXR5SW5kZXh9YCk7XG4gICAgICAgICAgICAgICAgdGhpcy5fcmVhZE5ld0VudGl0eShlbnRpdHlCaXRCdWZmZXIsIGVudGl0eSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgLy8gUmVhZCBkZWxldGlvbnNcbiAgICAgICAgaWYgKG1zZy5pc0RlbHRhKSB7XG4gICAgICAgICAgICBlbnRpdHlJbmRleCA9IC0xO1xuICAgICAgICAgICAgY29uc3QgZGVsZXRpb25zID0gZW50aXR5Qml0QnVmZmVyLnJlYWRVQml0VmFyKCk7XG4gICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGRlbGV0aW9uczsgKytpKSB7XG4gICAgICAgICAgICAgICAgZW50aXR5SW5kZXggKz0gZW50aXR5Qml0QnVmZmVyLnJlYWRVQml0VmFyKCk7XG4gICAgICAgICAgICAgICAgLy8gRW50aXR5IHdhc24ndCBkZWFsdCB3aXRoIGluIHBhY2tldCwgYnV0IGhhcyBiZWVuIGRlbGV0ZWRcbiAgICAgICAgICAgICAgICBmcmFtZS5yZW1vdmUoZW50aXR5SW5kZXgpO1xuICAgICAgICAgICAgICAgIHRoaXMuX3JlbW92ZUVudGl0eShlbnRpdHlJbmRleCwgZmFsc2UpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfVxuICAgIF9wYXJzZUluc3RhbmNlQmFzZWxpbmUoYmFzZWxpbmVCdWYsIGNsYXNzSWQpIHtcbiAgICAgICAgY29uc3QgY2xhc3NCYXNlbGluZSA9IHt9O1xuICAgICAgICBmb3IgKGNvbnN0IGJsIG9mIHRoaXMuX3BhcnNlRW50aXR5VXBkYXRlKGJhc2VsaW5lQnVmLCBjbGFzc0lkKSkge1xuICAgICAgICAgICAgY29uc3QgdGFibGVOYW1lID0gYmwucHJvcC50YWJsZS5uZXRUYWJsZU5hbWU7XG4gICAgICAgICAgICBjb25zdCB2YXJOYW1lID0gYmwucHJvcC5wcm9wLnZhck5hbWU7XG4gICAgICAgICAgICBjb25zdCB0YWJsZSA9IGNsYXNzQmFzZWxpbmVbdGFibGVOYW1lXTtcbiAgICAgICAgICAgIGlmICh0YWJsZSA9PT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgICAgICAgY2xhc3NCYXNlbGluZVt0YWJsZU5hbWVdID0geyBbdmFyTmFtZV06IGJsLnZhbHVlIH07XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICB0YWJsZVt2YXJOYW1lXSA9IGJsLnZhbHVlO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBjbGFzc0Jhc2VsaW5lO1xuICAgIH1cbiAgICBfaGFuZGxlVXNlckluZm9VcGRhdGUoY2xpZW50U2xvdCwgb2xkUGxheWVySW5mbywgcGxheWVySW5mbykge1xuICAgICAgICBpZiAob2xkUGxheWVySW5mbyAhPSBudWxsKSB7XG4gICAgICAgICAgICB0aGlzLl91c2VySWRUb0VudGl0eS5kZWxldGUob2xkUGxheWVySW5mby51c2VySWQpO1xuICAgICAgICAgICAgdGhpcy5fc3RlYW02NElkVG9FbnRpdHkuZGVsZXRlKG9sZFBsYXllckluZm8ueHVpZC50b1N0cmluZygpKTtcbiAgICAgICAgICAgIHRoaXMuX2FjY291bnROdW1iZXJUb0VudGl0eS5kZWxldGUob2xkUGxheWVySW5mby5mcmllbmRzSWQpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChwbGF5ZXJJbmZvICE9IG51bGwpIHtcbiAgICAgICAgICAgIHRoaXMuX3VzZXJJZFRvRW50aXR5LnNldChwbGF5ZXJJbmZvLnVzZXJJZCwgY2xpZW50U2xvdCArIDEpO1xuICAgICAgICAgICAgdGhpcy5fc3RlYW02NElkVG9FbnRpdHkuc2V0KHBsYXllckluZm8ueHVpZC50b1N0cmluZygpLCBjbGllbnRTbG90ICsgMSk7XG4gICAgICAgICAgICB0aGlzLl9hY2NvdW50TnVtYmVyVG9FbnRpdHkuc2V0KHBsYXllckluZm8uZnJpZW5kc0lkLCBjbGllbnRTbG90ICsgMSk7XG4gICAgICAgIH1cbiAgICB9XG4gICAgX2hhbmRsZUluc3RhbmNlQmFzZWxpbmVVcGRhdGUoZXZlbnQpIHtcbiAgICAgICAgaWYgKCFldmVudC51c2VyRGF0YSlcbiAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgY29uc3QgY2xhc3NJZCA9IHBhcnNlSW50KGV2ZW50LmVudHJ5LCAxMCk7XG4gICAgICAgIGNvbnN0IGJhc2VsaW5lQnVmID0gYml0YnVmZmVyXzEuQml0U3RyZWFtLmZyb20oZXZlbnQudXNlckRhdGEpO1xuICAgICAgICBpZiAoIXRoaXMuc2VydmVyQ2xhc3Nlc1tjbGFzc0lkXSkge1xuICAgICAgICAgICAgdGhpcy5wZW5kaW5nQmFzZWxpbmVzW2NsYXNzSWRdID0gYmFzZWxpbmVCdW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uICAgIH0sXG4gICAgXCI2NDlcIjoge1xuICAgICAgICBuYW1lOiBcInNwX21wN190cmliYWxfeWVsbG93XCIsXG4gICAgICAgIHRhZzogXCJBa29iZW5cIlxuICAgIH0sXG4gICAgXCI2NTBcIjoge1xuICAgICAgICBuYW1lOiBcImFtX3AyNTBfc3B1dG5pa1wiLFxuICAgICAgICB0YWc6IFwiUmlwcGxlXCJcbiAgICB9LFxuICAgIFwiNjUxXCI6IHtcbiAgICAgICAgbmFtZTogXCJhYV9tYWMxMF90aGVfbGFzdF9kaXZlXCIsXG4gICAgICAgIHRhZzogXCJMYXN0IERpdmVcIlxuICAgIH0sXG4gICAgXCI2NTJcIjoge1xuICAgICAgICBuYW1lOiBcImdzX3VtcF9hYnlzc1wiLFxuICAgICAgICB0YWc6IFwiU2NhZmZvbGRcIlxuICAgIH0sXG4gICAgXCI2NTNcIjoge1xuICAgICAgICBuYW1lOiBcImN1X3VzcHNfbm9pclwiLFxuICAgICAgICB0YWc6IFwiTmVvLU5vaXJcIlxuICAgIH0sXG4gICAgXCI2NTRcIjoge1xuICAgICAgICBuYW1lOiBcImFxX3htX2xlYWZfZmFkZVwiLFxuICAgICAgICB0YWc6IFwiU2Vhc29uc1wiXG4gICAgfSxcbiAgICBcIjY1NVwiOiB7XG4gICAgICAgIG5hbWU6IFwiYXFfc2F3ZWRvZmZfemFuZGVyMlwiLFxuICAgICAgICB0YWc6IFwiWmFuZGVyXCJcbiAgICB9LFxuICAgIFwiNjU2XCI6IHtcbiAgICAgICAgbmFtZTogXCJnc19ha19jb2xvbnkwMV9yZWRcIixcbiAgICAgICAgdGFnOiBcIk9yYml0IE1rMDFcIlxuICAgIH0sXG4gICAgXCI2NTdcIjoge1xuICAgICAgICBuYW1lOiBcImN1X3VzcHNfYmx1ZXByaW50XCIsXG4gICAgICAgIHRhZzogXCJCbHVlcHJpbnRcIlxuICAgIH0sXG4gICAgXCI2NThcIjoge1xuICAgICAgICBuYW1lOiBcImdzX2R1YWxiZXJld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AgICAgICByZXR1cm4gdGhpcy5saWZlU3RhdGUgPT09IDAgLyogQWxpdmUgKi87XG4gICAgfVxuICAgIC8qKlxuICAgICAqIEByZXR1cm5zIFVzZXIgaW5mbyBhc3NvY2lhdGVkIHdpdGggdGhpcyBwbGF5ZXJcbiAgICAgKi9cbiAgICBnZXQgdXNlckluZm8oKSB7XG4gICAgICAgIHJldHVybiB0aGlzLl9kZW1vLmVudGl0aWVzLl91c2VySW5mb1RhYmxlLmVudHJpZXNbdGhpcy5jbGllbnRTbG90XVxuICAgICAgICAgICAgLnVzZXJEYXRhO1xuICAgIH1cbiAgICAvKipcbiAgICAgKiBAcmV0dXJucyBVc2VyIElEXG4gICAgICovXG4gICAgZ2V0IHVzZXJJZCgpIHtcbiAgICAgICAgcmV0dXJuIHRoaXMudXNlckluZm8udXNlcklkO1xuICAgIH1cbiAgICAvKipcbiAgICAgKiBAcmV0dXJucyBTdGVhbSBJRFxuICAgICAqL1xuICAgIGdldCBzdGVhbUlkKCkge1xuICAgICAgICByZXR1cm4gdGhpcy51c2VySW5mby5ndWlkO1xuICAgIH1cbiAgICAvKipcbiAgICAgKiBAcmV0dXJucyBTdGVhbSA2NCBJRFxuICAgICAqL1xuICAgIGdldCBzdGVhbTY0SWQoKSB7XG4gICAgICAgIGlmICh0aGlzLl9zdGVhbTY0SWRDYWNoZSA9PT0gdW5kZWZpbmVkKVxuICAgICAgICAgICAgdGhpcy5fc3RlYW02NElkQ2FjaGUgPSB0aGlzLnVzZXJJbmZvLnh1aWQudG9TdHJpbmcoKTtcbiAgICAgICAgcmV0dXJuIHRoaXMuX3N0ZWFtNjRJZENhY2hlO1xuICAgIH1cbiAgICAvKipcbiAgICAgKiBAcmV0dXJucyBQbGF5ZXIgbmFtZVxuICAgICAqL1xuICAgIGdldCBuYW1lKCkge1xuICAgICAgICByZXR1cm4gdGhpcy51c2VySW5mby5uYW1lO1xuICAgIH1cbiAgICAvKipcbiAgICAgKiBAcmV0dXJucyBJcyB0aGlzIH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ZW1vLmVudGl0aWVzLnBsYXllclJlc291cmNlO1xuICAgICAgICByZXR1cm4gcHIuZ2V0UHJvcChcIkRUX0NTUGxheWVyUmVzb3VyY2VcIiwgXCJtX2lQbGF5ZXJDNFwiKSA9PT0gdGhpcy5pbmRleDtcbiAgICB9XG4gICAgLyoqXG4gICAgICogQHJldHVybnMgU2NvcmUgb2YgdGhlIHBsYXllclxuICAgICAqL1xuICAgIGdldCBzY29yZSgpIHtcbiAgICAgICAgY29uc3QgcHIgPSB0aGlzLl9kZW1vLmVudGl0aWVzLnBsYXllclJlc291cmNlO1xuICAgICAgICByZXR1cm4gcHIuZ2V0SW5kZXhlZFByb3BzKFwibV9pU2NvcmVcIilbdGhpcy5pbmRleF07XG4gICAgfVxuICAgIC8qKlxuICAgICAqIEByZXR1cm5zIE1WUHMgb2YgdGhlIHBsYXllclxuICAgICAqL1xuICAgIGdldCBtdnBzKCkge1xuICAgICAgICBjb25zdCBwciA9IHRoaXMuX2RlbW8uZW50aXRpZXMucGxheWVyUmVzb3VyY2U7XG4gICAgICAgIHJldHVybiBwci5nZXRJbmRleGVkUHJvcHMoXCJtX2lNVlBzXCIpW3RoaXMuaW5kZXhdO1xuICAgIH1cbiAgICAvKipcbiAgICAgKiBAcmV0dXJucyBDbGFudGFnIG9mIHRoZSBwbGF5ZXJcbiAgICAgKi9cbiAgICBnZXQgY2xhblRhZygpIHtcbiAgICAgICAgY29uc3QgcHIgPSB0aGlzLl9kZW1vLmVudGl0aWVzLnBsYXllclJlc291cmNlO1xuICAgICAgICByZXR1cm4gcHIuZ2V0SW5kZXhlZFByb3BzKFwibV9zekNsYW5cIilbdGhpcy5pbmRleF07XG4gICAgfVxuICAgIC8qKlxuICAgICAqIEByZXR1cm5zIEhhcyB0aGlzIHBsYXllciBiZWVuIHNwb3R0ZWQgYnkgYW55IG90aGVycz9cbiAgICAgKi9cbiAgICBnZXQgaXNTcG90dGVkKCkge1xuICAgICAgICByZXR1cm4gdGhpcy5nZXRQcm9wK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cy5nZXRCeVVzZXJJZChldmVudC51c2VyaWQpO1xuICAgICAgICBldmVudC5ib3QgPSBlbnRpdGllcy5nZXRCeVVzZXJJZChldmVudC5ib3RpZCk7XG4gICAgfVxuICAgIGVsc2UgaWYgKGV2ZW50TmFtZSA9PT0gXCJjc193aW5fcGFuZWxfcm91bmRcIikge1xuICAgICAgICBldmVudC5wbGF5ZXIgPSBlbnRpdGllcy5lbnRpdGllcy5nZXQoZXZlbnQuZnVuZmFjdF9wbGF5ZXIpO1xuICAgIH1cbiAgICBlbHNlIGlmIChldmVudE5hbWUgPT09IFwiZGVjb3lfZGV0b25hdGVcIikge1xuICAgICAgICBldmVudC5wbGF5ZXIgPSBlbnRpdGllcy5nZXRCeVVzZXJJZChldmVudC51c2VyaWQpO1xuICAgICAgICBldmVudC5lbnRpdHkgPSBlbnRpdGllcy5lbnRpdGllcy5nZXQoZXZlbnQuZW50aXR5aWQpO1xuICAgIH1cbiAgICBlbHNlIGlmIChldmVudE5hbWUgPT09IFwiZGVjb3lfc3RhcnRlZFwiKSB7XG4gICAgICAgIGV2ZW50LnBsYXllciA9IGVudGl0aWVzLmdldEJ5VXNlcklkKGV2ZW50LnVzZXJpZCk7XG4gICAgICAgIGV2ZW50LmVudGl0eSA9IGVudGl0aWVzLmVudGl0aWVzLmdldChldmVudC5lbnRpdHlpZCk7XG4gICAgfVxuICAgIGVsc2UgaWYgKGV2ZW50TmFtZSA9PT0gXCJkZWZ1c2VyX2Ryb3BwZWRcIikge1xuICAgICAgICBldmVudC5lbnRpdHkgPSBlbnRpdGllcy5lbnRpdGllcy5nZXQoZXZlbnQuZW50aXR5aWQpO1xuICAgIH1cbiAgICBlbHNlIGlmIChldmVudE5hbWUgPT09IFwiZGVmdXNlcl9waWNrdXBcIikge1xuICAgICAgICBldmVudC5lbnRpdHkgPSBlbnRpdGllcy5lbnRpdGllcy5nZXQoZXZlbnQuZW50aXR5aWQpO1xuICAgICAgICBldmVudC5wbGF5ZXIgPSBlbnRpdGll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ZlbnQudXNlcmlkKTtcbiAgICB9XG4gICAgZWxzZSBpZiAoZXZlbnROYW1lID09PSBcInBsYXllcl9kZWF0aFwiKSB7XG4gICAgICAgIGV2ZW50LnBsYXllciA9IGVudGl0aWVzLmdldEJ5VXNlcklkKGV2ZW50LnVzZXJpZCk7XG4gICAgICAgIGV2ZW50LmF0dGFja2VyRW50aXR5ID0gZW50aXRpZXMuZ2V0QnlVc2VySWQoZXZlbnQuYXR0YWNrZXIpO1xuICAgICAgICBldmVudC5hc3Npc3RlckVudGl0eSA9IGVudGl0aWVzLmdldEJ5VXNlcklkKGV2ZW50LmFzc2lzdGVyKTtcbiAgICAgICAgZXZlbnQuaXRlbURlZmluaXRpb24gPVxuICAgICAgICAgICAgZXZlbnQud2VhcG9uX2ZhdXhpdGVtaWQgIT0gXCJcIlxuICAgICAgICAgICAgICAgID8gaXRlbWRlZnNfMS5pdGVtRGVmaW5pdGlvbkluZGV4TWFwW0xvbmcuZnJvbVN0cmluZyhldmVudC53ZWFwb25fZmF1eGl0ZW1pZCwgdHJ1ZSlcbiAgICAgICAgICAgICAgICAgICAgLmFuZCgweGZmZmYpXG4gICAgICAgICAgICAgICAgICAgIC50b1N0cmluZygpXVxuICAgICAgICAgICAgICAgIDogbnVsbDtcbiAgICAgICAgZXZlbnQucGFpbnRLaXQgPVxuICAgICAgICAgICAgZXZlbnQud2VhcG9uX2ZhdXhpdGVtaWQgIT0gXCJcIlxuICAgICAgICAgICAgICAgID8gaXRlbWRlZnNfMS5wYWludEtpdEluZGV4TWFwW0xvbmcuZnJvbVN0cmluZyhldmVudC53ZWFwb25fZmF1eGl0ZW1pZCwgdHJ1ZSlcbiAgICAgICAgICAgICAgICAgICAgLnNoaWZ0UmlnaHRVbnNpZ25lZCgxNilcbiAgICAgICAgICAgICAgICAgICAgLmFuZCgweGZmZmYpXG4gICAgICAgICAgICAgICAgICAgIC50b1N0cmluZygpXVxuICAgICAgICAgICAgICAgIDogbnVsbDtcbiAgICAgICAgZXZl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PSB2YWx1ZS52YWxGbG9hdDtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSBFdmVudEtleVR5cGUuVFlQRV9MT05HOlxuICAgICAgICAgICAgICAgICAgICBldmVudFtrZXlOYW1lXSA9IHZhbHVlLnZhbExvbmc7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgRXZlbnRLZXlUeXBlLlRZUEVfU0hPUlQ6XG4gICAgICAgICAgICAgICAgICAgIGV2ZW50W2tleU5hbWVdID0gdmFsdWUudmFsU2hvcnQ7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgRXZlbnRLZXlUeXBlLlRZUEVfQllURTpcbiAgICAgICAgICAgICAgICAgICAgZXZlbnRba2V5TmFtZV0gPSB2YWx1ZS52YWxCeXRlO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIEV2ZW50S2V5VHlwZS5UWVBFX0JPT0w6XG4gICAgICAgICAgICAgICAgICAgIGV2ZW50W2tleU5hbWVdID0gdmFsdWUudmFsQm9vbDtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSBFdmVudEtleVR5cGUuVFlQRV9VSU5UNjQ6XG4gICAgICAgICAgICAgICAgICAgIGV2ZW50W2tleU5hbWVdID0gdmFsdWUudmFsVWludDY0O1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIEV2ZW50S2V5VHlwZS5UWVBFX1dTVFJJTkc6XG4gICAgICAgICAgICAgICAgICAgIGV2ZW50W2tleU5hbWVdID0gdmFsdWUudmFsV3N0cmluZztcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIGV2ZW50O1xuICAgIH1cbn1c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XG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgY29uc3QgZXZlbnRWYXJzID0gZXZlbnQubWVzc2FnZVRvT2JqZWN0KG1zZyk7XG4gICAgICAgICAgICAvLyBidWZmZXIgZ2FtZSBldmVudHMgdW50aWwgdGhlIGVuZCBvZiB0aGUgdGlja1xuICAgICAgICAgICAgdGhpcy5fdGlja0V2ZW50cy5wdXNoKHtcbiAgICAgICAgICAgICAgICBuYW1lOiBldmVudC5uYW1lLFxuICAgICAgICAgICAgICAgIGV2ZW50OiAoMCwgZXZlbnR0eXBlc18xLmFubm90YXRlRXZlbnQpKGVudGl0aWVzLCBldmVudC5uYW1lLCBldmVudFZhcnMpXG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfSk7XG4gICAgICAgIGRlbW8ub24oXCJ0aWNrZW5kXCIsICgpID0+IHtcbiAgICAgICAgICAgIHRoaXMuX3RpY2tFdmVudHMuZm9yRWFjaChldmVudCA9PiB7XG4gICAgICAgICAgICAgICAgdGhpcy5lbWl0KGV2ZW50Lm5hbWUsIGV2ZW50LmV2ZW50KTtcbiAgICAgICAgICAgICAgICB0aGlzLmVtaXQoXCJldmVudFwiLCB7XG4gICAgICAgICAgICAgICAgICAgIG5hbWU6IGV2ZW50Lm5hbWUsXG4gICAgICAgICAgICAgICAgICAgIC8vIGVzbGludC1kaXNhYmxlLW5leHQtbGluZSBAdHlwZXNjcmlwdC1lc2xpbnQvbm8tdW5zYWZlLWFzc2lnbm1lbnRcbiAgICAgICAgICAgICAgICAgICAgZXZlbnQ6IGV2ZW50LmV2ZW50XG4gICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIHRoaXMuX3RpY2tFdmVudHMgPSBbXTtcbiAgICAgICAgfSk7XG4gICAgfVxuICAgIF9oYW5kbGVHYW1lRXZlbnRMaXN0KG1zZykge1xuICAgICAgICBmb3IgKGNvbnN0IGRlc2NyaXB0b3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l6ZSwgaW4gYnl0ZXMuXG4gICAgYmxvY2tTaXplKCkge1xuICAgICAgICByZXR1cm4gODtcbiAgICB9XG4gICAgLy8gU2V0IHRoZSBrZXkgc2NoZWR1bGUgb2YgYW4gSUNFIGtleS5cbiAgICBzZXQoa2V5KSB7XG4gICAgICAgIGNvbnN0IGtiID0gbmV3IFVpbnQxNkFycmF5KDQpO1xuICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IDQ7IGkrKylcbiAgICAgICAgICAgIGtiW2ldID0gMDtcbiAgICAgICAgaWYgKHRoaXMucm91bmRzID09PSA4KSB7XG4gICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IDQ7IGkrKylcbiAgICAgICAgICAgICAgICBrYlszIC0gaV0gPSAoKGtleVtpICogMl0gJiAweGZmKSA8PCA4KSB8IChrZXlbaSAqIDIgKyAxXSAmIDB4ZmYpO1xuICAgICAgICAgICAgdGhpcy5zY2hlZHVsZUJ1aWxkKGtiLCAwLCAwKTtcbiAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfVxuICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IHRoaXMuc2l6ZTsgaSsrKSB7XG4gICAgICAgICAgICBmb3IgKGxldCBqID0gMDsgaiA8IDQ7IGorKylcbiAgICAgICAgICAgICAgICBrYlszIC0gal0gPVxuICAgICAgICAgICAgICAgICAgICAoKGtleVtpICogOCArIGogKiAyXSAmIDB4ZmYpIDw8IDgpIHxcbiAgICAgICAgICAgICAgICAgICAgICAgIChrZXlbaSAqIDggKyBqICogMiArIDFdICYgMHhmZik7XG4gICAgICAgICAgICB0aGlzLnNjaGVkdWxlQnVpbGQoa2IsIGkgKiA4LCAwKTtcbiAgICAgICAgICAgIHRoaXMuc2NoZWR1bGVCdWlsZChrYiwgdGhpcy5yb3VuZHMgLSA4IC0gaSAqIDgsIDgpO1xuICAgICAgICB9XG4gICAgfVxuICAgIC8vIENsZWFyIHRoZSBrZXkgc2NoZWR1bGUgdG8gcH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G4gICAgICAgIH1cbiAgICB9XG4gICAgLy8gRGVjcnlwdCBhIGJsb2NrIG9mIDggYnl0ZXMgb2YgZGF0YS5cbiAgICBkZWNyeXB0KGNpcGhlcnRleHQsIHBsYWludGV4dCkge1xuICAgICAgICBsZXQgaTtcbiAgICAgICAgbGV0IGwgPSAwO1xuICAgICAgICBsZXQgciA9IDA7XG4gICAgICAgIGZvciAoaSA9IDA7IGkgPCA0OyBpKyspIHtcbiAgICAgICAgICAgIGwgfD0gKGNpcGhlcnRleHRbaV0gJiAweGZmKSA8PCAoMjQgLSBpICogOCk7XG4gICAgICAgICAgICByIHw9IChjaXBoZXJ0ZXh0W2kgKyA0XSAmIDB4ZmYpIDw8ICgyNCAtIGkgKiA4KTtcbiAgICAgICAgfVxuICAgICAgICBmb3IgKGkgPSB0aGlzLnJvdW5kcyAtIDE7IGkgPiAwOyBpIC09IDIpIHtcbiAgICAgICAgICAgIGwgXj0gdGhpcy5yb3VuZEZ1bmMociwgdGhpcy5rZXlTY2hlZHVsZVtpXSk7XG4gICAgICAgICAgICByIF49IHRoaXMucm91bmRGdW5jKGwsIHRoaXMua2V5U2NoZWR1bGVbaSAtIDFdKTtcbiAgICAgICAgfVxuICAgICAgICBmb3IgKGkgPSAwOyBpIDwgNDsgaSsrKSB7XG4gICAgICAgICAgICBwbGFpbnRleHRbMyAtIGldID0gTnVtYmVyKHIgJiAweGZmKTtcbiAgICAgICAgICAgIHBsYWludGV4dFs3IC0gaV0gPSBOdW1iZXIobCAmIDB4ZmYpO1xuICAgICAgICAgICAgciA+Pj49IDg7XG4gICAgICAgICAgICBsID4+Pj0gODtcbiAgICAgICAgfVxuICAgIH1cbiAgICBkZWNyeXB0VWludDhBcnJheShjaXBoZXJBcnJheSwgcGxhaW5BcnJheSwgZnJvbSwgdG8pIHtcbiAgICAgICAgaWYgKGZyb20gPT0gbnVsbClcbiAgICAgICAgICAgIGZyb20gPSAwO1xuICAgICAgICBpZiAodG8gPT0gbnVsbClcbiAgICAgICAgICAgIHRvID0gY2lwaGVyQXJyYXkubGVuZ3RoO1xuICAgICAgICBsZXQgayA9IDA7XG4gICAgICAgIC8vIGRlY3J5cHQgZnVsbCBibG9ja3NcbiAgICAgICAgd2hpbGUgKGZyb20gKyA4IDw9IHRvKSB7XG4gICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IDg7IGkrKykge1xuICAgICAgICAgICAgICAgIHRoaXMuY2lwaGVySG9sZGVyW2ldID0gY2lwaGVyQXJyYXlbZnJvbSArIGldO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgdGhpcy5kZWNyeXB0KHRoaXMuY2lwaGVySG9sZGVyLCB0aGlzLnBsYWluSG9sZGVyKTtcbiAgICAgICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgODsgaSsrKSB7XG4gICAgICAgICAgICAgICAgcGxhaW5BcnJheVtrICsgaV0gPSB0aGlzLnBsYWluSG9sZGVyW2ldO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgayArPSA4O1xuICAgICAgICAgICAgZnJvbSArPSA4O1xuICAgICAgICB9XG4gICAgICAgIC8vIHJlbWFpbmluZyBieXRlcyBkbyBub3QgZ2V0IGVuY3J5cHRpb24sIGp1c3QgY29weSB0aGVtXG4gICAgICAgIGlmICgoKHRvIC0gZnJvbSkgJiAweDcpICE9PSAwKSB7XG4gICAgICAgICAgICBmb3IgKGxldCBpID0gZnJvbTsgaSA8IHRvOyBpKyspIHtcbiAgICAgICAgICAgICAgICBwbGFpbkFycmF5W2srK10gPSBjaXBoZXJBcnJheVtpXTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cbiAgICAvLyA4LWJpdCBHYWxvaXMgRmllbGQgbXVsdGlwbGljYXRpb24gb2YgYSBieSBiLCBtb2R1bG8gbS5cbiAgICAvLyBKdXN0IGxpa2UgYXJpdGhtZXRpYyBtdWx0aXBsaWNhdGlvbiwgZXhjZXB0IHRoYXRcbiAgICAvLyBhZGRpdGlvbnMgY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G4gICAgICAgICAgICBpKys7XG4gICAgICAgICAgICB4ID4+Pj0gMTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gcmVzO1xuICAgIH1cbiAgICAvLyBJbml0aWFsaXNlIHRoZSBzdWJzdGl0dXRpb24vcGVybXV0YXRpb24gYm94ZXMuXG4gICAgc3BCb3hJbml0KCkge1xuICAgICAgICBJY2VLZXkuc3BCb3ggPSBbXTtcbiAgICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCA0OyBpKyspIHtcbiAgICAgICAgICAgIEljZUtleS5zcEJveFtpXSA9IFtdO1xuICAgICAgICAgICAgZm9yIChsZXQgaiA9IDA7IGogPCAxMDI0OyBqKyspIHtcbiAgICAgICAgICAgICAgICBJY2VLZXkuc3BCb3hbaV1bal0gPSAwO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgMTAyNDsgaSsrKSB7XG4gICAgICAgICAgICBjb25zdCBjb2wgPSAoaSA+Pj4gMSkgJiAweGZmO1xuICAgICAgICAgICAgY29uc3Qgcm93ID0gKGkgJiAweDEpIHwgKChpICYgMHgyMDApID4+PiA4KTtcbiAgICAgICAgICAgIGxldCB4O1xuICAgICAgICAgICAgeCA9XG4gICAgICAgICAgICAgICAgdGhpcy5nZl9leHA3KGNvbCBeIEljZUtleS5zWG9yWzBdW3Jvd10sIEljZUtleS5zTW9kWzBdW3Jvd10pIDw8IDI0O1xuICAgICAgICAgICAgSWNlS2V5LnNwQm94WzBdW2ldID0gdGhpcy5wZXJtMzIoeCk7XG4gICAgICAgICAgICB4ID1cbiAgICAgICAgICAgICAgICB0aGlzLmdmX2V4cDcoY29sIF4gSWNlS2V5LnNYb3JbMV1bcm93XSwgSWNlS2V5LnNNb2RbMV1bcm93XSkgPDwgMTY7XG4gICAgICAgICAgICBJY2VLZXkuc3BCb3hbMV1baV0gPSB0aGlzLnBlcm0zMih4KTtcbiAgICAgICAgICAgIHggPSB0aGlzLmdmX2V4cDcoY29sIF4gSWNlS2V5LnNYb3JbMl1bcm93XSwgSWNlS2V5LnNNb2RbMl1bcm93XSkgPDwgODtcbiAgICAgICAgICAgIEljZUtleS5zcEJveFsyXVtpXSA9IHRoaXMucGVybTMyKHgpO1xuICAgICAgICAgICAgeCA9IHRoaXMuZ2ZfZXhwNyhjb2wgXiBJY2VLZXkuc1hvclszXVtyb3ddLCBJY2VLZXkuc01vZFszXVtyb3ddKTtcbiAgICAgICAgICAgIEljZUtleS5zcEJveFszXVtpXSA9IHRoaXMucGVybTMyKHgpO1xuICAgICAgICB9XG4gICAgfVxuICAgIC8vIFNldCA4IHJvdW5kcyBbbiwgbis3XSBvZiB0aGUga2V5IHNjaGVkdWxlIG9mIGFuIElDRSBrZXkuXG4gICAgc2NoZWR1bGVCdWlsZChrYiwgbiwga3JvdElkeCkge1xuICAgICAgICBsZXQgaTtcbiAgICAgICAgZm9yIChpID0gMDsgaSA8IDg7IGkrKykge1xuICAgICAgICAgICAgbGV0IGo7XG4gICAgICAgICAgICBjb25zdCBrciA9IEljZUtleS5rZXlyb3Rba3JvdElkeCArIGldO1xuICAgICAgICAgICAgY29uc3Qgc3Via2V5ID0gdGhpcy5rZXlTY2hlZHVsZVtuICsgaV07XG4gICAgICAgICAgICBmb3IgKGogPSAwOyBqIDwgMzsgaisrKVxuICAgICAgICAgICAgICAgIHRoaXMua2V5U2NoZWR1bGVbbiArIGldW2pdID0gMDtcbiAgICAgICAgICAgIGZvciAoaiA9IDA7IGogPCAxNTsgaisrKSB7XG4gICAgICAgICAgICAgICAgbGV0IGs7XG4gICAgICAgICAgICAgICAgY29uc3QgY3VyU2sgPSBqICUgMztcbiAgICAgICAgICAgICAgICBmb3IgKGsgPSAwOyBrIDwgNDsgaysrKSB7XG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IGN1cktiID0ga2JbKGtyICsgaykgJiAzXTtcbiAgICAgICAgICAgICAgICAgICAgY29uc3QgYml0ID0gY3VyS2IgJiAxO1xuICAgICAgICAgICAgICAgICAgICBzdWJrZXlbY3VyU2tdID0gKHN1YmtleVtjdXJTa10gPDwgMSkgfCBiaXQ7XG4gICAgICAgICAgICAgICAgICAgIGtiWyhrciArIGspICYgM10gPSAoY3VyS2IgPj4+IDEpIHwgKChiaXQgXiAxKSA8PCAxNSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfVxuICAgIC8vIFRoZSBzaW5nbGUgcm91bmQgSUNFIGYgZnVuY3Rpb24uXG4gICAgcm91bmRGdW5jKHAsIHN1YmtleSkge1xuICAgICAgICBjb25zdCB0bCA9ICgocCA+Pj4gMTYpICYgMHgzZmYpIHwgKCgocCA+Pj4gMTQpIHwgKHAgPDwgMTgpKSAmIDB4ZmZjMDApO1xuICAgICAgICBjb25zdCB0ciA9IChwICYgMHgzZmYpIHwgKChwIDw8IDIpICYgMHhmZmMwMCk7XG4gICAgICAgIGxldCBhbCA9IHN1YmtleVsyXSAmICh0bCBeIHRyKTtcbiAgICAgICAgbGV0IGFyID0gYWwgXiB0cjtcbiAgICAgICAgYWwgXj0gdGw7XG4gICAgICAgIGFsIF49IHN1YmtleVswXTtcbiAgICAgICAgYXIgXj0gc3Via2V5WzFdO1xuICAgICAgICByZXR1cm4gKEljZUtleS5zcEJveFswXVthbCA+Pj4gMTBdIHxcbiAgICAgICAgICAgIEljZUtleS5zcEJveFsxXVthbCAmIDB4M2ZmXSB8XG4gICAgICAgICAgICBJY2VLZXkuc3BCb3hbMl1bYXIgPj4+IDEwXSB8XG4gICAgICAgICAgICBJY2VLZXkuc3BCb3hbM11bYXIgJiAweDNmZl0pO1xuICAgIH1cbn1cbmV4cG9ydHMuSWNlS2V5ID0gSWNlS2V5O1xuSWNlS2V5LnNwQm94SW5pdGlhbGlzZWQgPSBmYWxzZTtcbkljZUtleS5zTW9kID0gW1xuICAgIFszMzMsIDMxMywgNTA1LCAzNjldLFxuICAgIFszNzksIDM3NSwgMzE5LCAzOTF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1bmN0aW9uIG1ha2VJbnREZWNvZGVyKHNlbmRQcm9wKSB7XG4gICAgaWYgKChzZW5kUHJvcC5mbGFncyAmIGV4cG9ydHMuU1BST1BfVkFSSU5UKSAhPT0gMCkge1xuICAgICAgICBpZiAoKHNlbmRQcm9wLmZsYWdzICYgZXhwb3J0cy5TUFJPUF9VTlNJR05FRCkgIT09IDApIHtcbiAgICAgICAgICAgIHJldHVybiBiaXRidWYgPT4gYml0YnVmLnJlYWRVVmFySW50MzIoKTtcbiAgICAgICAgfVxuICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgIHJldHVybiBiaXRidWYgPT4gYml0YnVmLnJlYWRWYXJJbnQzMigpO1xuICAgICAgICB9XG4gICAgfVxuICAgIGVsc2Uge1xuICAgICAgICBjb25zdCBudW1CaXRzID0gc2VuZFByb3AubnVtQml0cztcbiAgICAgICAgaWYgKChzZW5kUHJvcC5mbGFncyAmIGV4cG9ydHMuU1BST1BfVU5TSUdORUQpICE9PSAwKSB7XG4gICAgICAgICAgICBpZiAoKHNlbmRQcm9wLmZsYWdzICYgZXhwb3J0cy5TUFJPUF9OT1NDQUxFKSAhPT0gMCAmJlxuICAgICAgICAgICAgICAgIHNlbmRQcm9wLm51bUJpdHMgPT09IGNvbnN0c18xLk5VTV9ORVRXT1JLRURfRUhBTkRMRV9CSVRTKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGJpdGJ1ZiA9PiBuZXcgZW50aXR5aGFuZGxlXzEuRW50aXR5SGFuZGxlKGJpdGJ1Zi5yZWFkVUJpdHMobnVtQml0cykpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZWxzZSBpZiAobnVtQml0cyA9PT0gMSkge1xuICAgICAgICAgICAgICAgIHJldHVybiBiaXRidWYgPT4gYml0YnVmLnJlYWRPbmVCaXQoKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgIHJldHVybiBiaXRidWYgPT4gYml0YnVmLn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tcbiAgICBpZiAoKHNlbmRQcm9wLmZsYWdzICYgZXhwb3J0cy5TUFJPUF9WQVJJTlQpICE9PSAwKSB7XG4gICAgICAgIGlmICgoc2VuZFByb3AuZmxhZ3MgJiBleHBvcnRzLlNQUk9QX1VOU0lHTkVEKSAhPT0gMCkge1xuICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFwiNjQtYml0IHVuc2lnbmVkIHZhcmludCBub3QgaW1wbGVtZW50ZWRcIik7IC8vIFRPRE9cbiAgICAgICAgfVxuICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcIjY0LWJpdCBzaWduZWQgdmFyaW50IG5vdCBpbXBsZW1lbnRlZFwiKTsgLy8gVE9ET1xuICAgICAgICB9XG4gICAgfVxuICAgIGVsc2Uge1xuICAgICAgICBjb25zdCBoaWdoQml0cyA9IHNlbmRQcm9wLm51bUJpdHMgLSAzMjtcbiAgICAgICAgaWYgKChzZW5kUHJvcC5mbGFncyAmIGV4cG9ydHMuU1BST1BfVU5TSUdORUQpICE9PSAwKSB7XG4gICAgICAgICAgICByZXR1cm4gYml0YnVmID0+IHtcbiAgICAgICAgICAgICAgICBjb25zdCBsb3dJbnQgPSBiaXRidWYucmVhZFVCaXRzKDMyKTtcbiAgICAgICAgICAgICAgICBjb25zdCBoaWdoSW50ID0gYml0YnVmLnJlYWRVQml0cyhoaWdoQml0cyk7XG4gICAgICAgICAgICAgICAgcmV0dXJuIExvbmcuZnJvbUJpdHMobG93SW50LCBoaWdoSW50LCBmYWxzZSk7XG4gICAgICAgICAgICB9O1xuICAgICAgICB9XG4gICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgcmV0dXJuIGJpdGJ1ZiA9PiB7XG4gICAgICAgICAgICAgICAgY29uc3QgbmVnID0gYml0YnVmLnJlYWRPbmVCaXQoKTtcbiAgICAgICAgICAgICAgICBjb25zdCBsb3dJbnQgPSBiaXRidWYucmVhZFVCaXRzKDMyKTtcbiAgICAgICAgICAgICAgICBjb25zdCBoaWdoSW50ID0gYml0YnVmLnJlYWRVQml0cyhoaWdoQml0cyAtIDEpO1xuICAgICAgICAgICAgICAgIHJldHVybiBMb25nLmZyb21CaXRzKGxvd0ludCwgaGlnaEludCwgIW5lZyk7XG4gICAgICAgICAgICB9O1xuICAgICAgICB9XG4gICAgfVxufVxuZnVuY3Rpb24gbWFrZVZhbHVlRGVjb2RlcihzZW5kUHJvcCkge1xuICAgIHN3aXRjaCAoc2VuZFByb3AudHlwZSkge1xuICAgICAgICBjYXNlIDAgLyogSW50ICovOlxuICAgICAgICAgICAgcmV0dXJuIG1ha2VJbnREZWNvZGVyKHNlbmRQcm9wKTtcbiAgICAgICAgY2FzZSAxIC8qIEZsb2F0ICovOlxuICAgICAgICAgICAgcmV0dXJuIG1ha2VGbG9hdERlY29kZXIoc2VuZFByb3ApO1xuICAgICAgICBjYXNlIDIgLyogVmVjdG9yICovOlxuICAgICAgICAgICAgcmV0dXJuIG1ha2VWZWN0b3JEZWNvZGVyKHNlbmRQcm9wKTtcbiAgICAgICAgY2FzZSAzIC8qIFZlY3RvclhZICovOlxuICAgICAgICAgICAgcmV0dXJuIG1ha2VWZWN0b3JYWURlY29kZXIoc2VuZFByb3ApO1xuICAgICAgICBjYXNlIDQgLyogU3RyaW5nICovOlxuICAgICAgICAgICAgcmV0dXJuIG1ha2VTdHJpbmdEZWNvZGVyKHNlbmRQcm9wKTtcbiAgICAgICAgY2FzZSA3IC8qIEludDY0ICovOlxuICAgICAgICAgICAgcmV0dXJuIG1ha2VJbnQ2NERlY29kZXIoc2VuZFByb3ApO1xuICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKGBVbnN1cHBvcnRlZCBzZW5kIHByb3AgdHlwZSAke3NlbmRQcm9wLnR5cGV9YCk7XG4gICAgfVxufVxuZnVuY3Rpb24gbWFrZUFycmF5RGVjb2RlcihzZW5kUHJvcCwgYXJyYXlFbGVtZW50UHJvcCkge1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bmVkID8gcmVhZGVyLmxlbiA6IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlR2FtZVNlcnZlclBpbmcoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnBpbmcgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmlwID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuaW5zdGFuY2VzID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2IsIF9jO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUdhbWVTZXJ2ZXJQaW5nKCk7XG4gICAgICAgIG1lc3NhZ2UucGluZyA9IChfYSA9IG9iamVjdC5waW5nKSAhPT0gbnVsbCAmJiBfYSAhPT0gdm9pZCAwID8gX2EgOi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gY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VEYXRhQ2VudGVyUGluZygpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZGF0YUNlbnRlcklkID0gcmVhZGVyLmZpeGVkMzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnBpbmcgPSByZWFkZXIuc2ludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCBfYjtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VEYXRhQ2VudGVyUGluZygpO1xuICAgICAgICBtZXNzYWdlLmRhdGFDZW50ZXJJZCA9IChfYSA9IG9iamVjdC5kYXRhQ2VudGVySWQpICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6IDA7XG4gICAgICAgIG1lc3NhZ2UucGluZyA9IChfYiA9IG9iamVjdC5waW5nKSAhPT0gbnVsbCAmJiBfYiAhPT0gdm9pZCAwID8gX2IgOiAwO1xuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9XG59O1xuZnVuY3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cmNoU3RhdGlzdGljKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5nYW1lVHlwZSA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnNlYXJjaFRpbWVBdmcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5wbGF5ZXJzU2VhcmNoaW5nID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2IsIF9jO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZURldGFpbGVkU2VhcmNoU3RhdGlzdGljKCk7XG4gICAgICAgIG1lc3NhZ2UuZ2FtZVR5cGUgPSAoX2EgPSBvYmplY3QuZ2FtZVR5cGUpICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6IDA7XG4gICAgICAgIG1lc3NhZ2Uuc2VhcmNoVGltZUF2ZyA9IChf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G1lc3NhZ2UucGxheWVyTmFtZSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UucGxheWVyRG9iICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDMyKS51aW50MzIobWVzc2FnZS5wbGF5ZXJEb2IpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnBsYXllckZsYWcgIT09IFwiXCIpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNDIpLnN0cmluZyhtZXNzYWdlLnBsYXllckZsYWcpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnBsYXllckxvY2F0aW9uICE9PSBcIlwiKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDUwKS5zdHJpbmcobWVzc2FnZS5wbGF5ZXJMb2NhdGlvbik7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UucGxheWVyRGVzYyAhPT0gXCJcIikge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig1OCkuc3RyaW5nKG1lc3NhZ2UucGxheWVyRGVzYyk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VUb3VybmFtZW50UGxheWVyKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5hY2NvdW50SWQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5wbGF5ZXJOaWNrID0gcmVhZGVyLnN0cmluZygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucGxheWVyTmFtZSA9IHJlYWRlci5zdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnBsYXllckRvYiA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA1OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnBsYXllckZsYWcgPSByZWFkZXIuc3RyaW5nKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5wbGF5ZXJMb2NhdGlvbiA9IHJlYWRlci5zdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA3OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnBsYXllckRlc2MgPSByZWFkZXIuc3RyaW5nKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHl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mZvcmsoKSkubGRlbGltKCk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VUb3VybmFtZW50VGVhbSgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudGVhbUlkID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50ZWFtVGFnID0gcmVhZGVyLnN0cmluZygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudGVhbUZsYWcgPSByZWFkZXIuc3RyaW5nKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50ZWFtTmFtZSA9IHJlYWRlci5zdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG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5hbWUpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmV2ZW50VGltZVN0YXJ0ICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDMyKS51aW50MzIobWVzc2FnZS5ldmVudFRpbWVTdGFydCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuZXZlbnRUaW1lRW5kICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDQwKS51aW50MzIobWVzc2FnZS5ldmVudFRpbWVFbmQpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmV2ZW50UHVibGljICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDQ4KS5pbnQzMihtZXNzYWdlLmV2ZW50UHVibGljKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5ldmVudFN0YWdlSWQgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNTYpLmludDMyKG1lc3NhZ2UuZXZlbnRTdGFnZUlkKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5ldmVudFN0YWdlTmFtZSAhPT0gXCJcIikge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig2Nikuc3RyaW5nKG1lc3NhZ2UuZXZlbnRTdGFnZU5hbWUpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmFjdGl2ZVNlY3Rpb25JZCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig3MikudWludDMyKG1lc3NhZ2UuYWN0aXZlU2VjdGlvbklkKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZVRvdXJuYW1lbnRFdmVudCgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZXZlbnRJZCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZXZlbnRUYWcgPSByZWFkZXIuc3RyaW5nKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5ldmVudE5hbWUgPSByZWFkZXIuc3RyaW5nKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5ldmVudFRpbWVTdGFydCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA1OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmV2ZW50VGltZUVuZCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA2OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmV2ZW50UHVibGljID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5ldmVudFN0YWdlSWQgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA4OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmV2ZW50U3RhZ2VOYW1lID0gcmVhZGVyLnN0cmluZygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDk6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuYWN0aXZlU2VjdGlvbklkID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2IsIF9jLCBfZCwgX2UsIF9mLCBfZywgX2gsIF9qO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZVRvdXJuYW1lbnRFdmVudCgpO1xuICAgICAgICBtZXNzYWdlLmV2ZW50SWQgPSAoX2EgPSBvYmplY3QuZXZlbnRJZCkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogMDtcbiAgICAgICAgbWVzc2FnZS5ldmVudFRhZyA9IChfYiA9IG9iamVjdC5ldmVudFRhZykgIT09IG51bGwgJiYgX2IgIT09IHZvaWQgMCA/IF9iIDogXCJcI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ZTogMCxcbiAgICAgICAgcGxheWVyc1NlYXJjaGluZzogMCxcbiAgICAgICAgc2VydmVyc0F2YWlsYWJsZTogMCxcbiAgICAgICAgb25nb2luZ01hdGNoZXM6IDAsXG4gICAgICAgIHNlYXJjaFRpbWVBdmc6IDAsXG4gICAgICAgIHNlYXJjaFN0YXRpc3RpY3M6IFtdLFxuICAgICAgICBtYWluUG9zdFVybDogXCJcIixcbiAgICAgICAgcmVxdWlyZWRBcHBpZFZlcnNpb246IDAsXG4gICAgICAgIHByaWNlc2hlZXRWZXJzaW9uOiAwLFxuICAgICAgICB0d2l0Y2hTdHJlYW1zVmVyc2lvbjogMCxcbiAgICAgICAgYWN0aXZlVG91cm5hbWVudEV2ZW50aWQ6IDAsXG4gICAgICAgIGFjdGl2ZVN1cnZleUlkOiAwLFxuICAgICAgICBydGltZTMyQ3VyOiAwLFxuICAgICAgICBydGltZTMyRXZlbnRTdGFydDogMFxuICAgIH07XG59XG5leHBvcnRzLkdsb2JhbFN0YXRpc3RpY3MgPSB7XG4gICAgZW5jb2RlKG1lc3NhZ2UsIHdyaXRlciA9IG1pbmltYWxfMS5Xcml0ZXIuY3JlYXRlKCkpIHtcbiAgICAgICAgaWYgKG1lc3NhZ2UucGxheWVyc09ubGluZSAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig4KS51aW50MzIobWVzc2FnZS5wbGF5ZXJzT25saW5lKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5zZXJ2ZXJzT25saW5lICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDE2KS51aW50MzIobWVzc2FnZS5zZXJ2ZXJzT25saW5lKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5wbGF5ZXJzU2VhcmNoaW5nICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDI0KS51aW50MzIobWVzc2FnZS5wbGF5ZXJzU2VhcmNoaW5nKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5zZXJ2ZXJzQXZhaWxhYmxlICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDMyKS51aW50MzIobWVzc2FnZS5zZXJ2ZXJzQXZhaWxhYmxlKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5vbmdvaW5nTWF0Y2hlcyAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig0MCkudWludDMyKG1lc3NhZ2Uub25nb2luZ01hdGNoZXMpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnNlYXJjaFRpbWVBdmcgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNDgpLnVpbnQzMihtZXNzYWdlLnNlYXJjaFRpbWVBdmcpO1xuICAgICAgICB9XG4gICAgICAgIGZvciAoY29uc3QgdiBvZiBtZXNzYWdlLnNlYXJjaFN0YXRpc3RpY3MpIHtcbiAgICAgICAgICAgIGV4cG9ydHMuRGV0YWlsZWRTZWFyY2hTdGF0aXN0aWMuZW5jb2RlKHYsIHdyaXRlci51aW50MzIoNTgpLmZvcmsoKSkubGRlbGltKCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UubWFpblBvc3RVcmwgIT09IFwiXCIpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNjYpLnN0cmluZyhtZXNzYWdlLm1haW5Qb3N0VXJsKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5yZXF1aXJlZEFwcGlkVmVyc2lvbiAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig3MikudWludDMyKG1lc3NhZ2UucmVxdWlyZWRBcHBpZFZlcnNpb24pO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnByaWNlc2hlZXRWZXJzaW9uICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDgwKS51aW50MzIobWVzc2FnZS5wcmljZXNoZWV0VmVyc2lvbik7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UudHdpdGNoU3RyZWFtc1ZlcnNpb24gIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoODgpLnVpbnQzMihtZXNzYWdlLnR3aXRjaFN0cmVhbXNWZXJzaW9uKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5hY3RpdmVUb3VybmFtZW50RXZlbnRpZCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig5NikudWludDMyKG1lc3NhZ2UuYWN0aXZlVG91cm5hbWVudEV2ZW50aWQpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmFjdGl2ZVN1cnZleUlkICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDEwNCkudWludDMyKG1lc3NhZ2UuYWN0aXZlU3VydmV5SWQpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnJ0aW1lMzJDdXIgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTEyKS51aW50MzIobWVzc2FnZS5ydGltZTMyQ3VyKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5ydGltZTMyRXZlbnRTdGFydCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigxMjApLnVpbnQzMihtZXNzYWdlLnJ0aW1lMzJFdmVudFN0YXJ0KTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUdsb2JhbFN0YXRpc3RpY3MoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnBsYXllcnNPbmxpbmUgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zZXJ2ZXJzT25saW5lID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucGxheWVyc1NlYXJjaGluZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnNlcnZlcnNBdmFpbGFibGUgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5vbmdvaW5nTWF0Y2hlcyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA2OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnNlYXJjaFRpbWVBdmcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zZWFyY2hTdGF0aXN0aWNzLnB1c2goZXhwb3J0cy5EZXRhaWxlZFNlYXJjaFN0YXRpc3RpYy5kZWNvZGUocmVhZGVyLCByZWFkZXIudWludDMyKCkpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA4OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm1haW5Qb3N0VXJsID0gcmVhZGVyLnN0cmluZygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDk6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucmVxdWlyZWRBcHBpZFZlcnNpb24gPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTA6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucHJpY2VzaGVldFZlcnNpb24gPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudHdpdGNoU3RyZWFtc1ZlcnNpb24gPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuYWN0aXZlVG91cm5hbWVudEV2ZW50aWQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuYWN0aXZlU3VydmV5SWQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTQ6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucnRpbWUzMkN1ciA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxNTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5ydGltZTMyRXZlbnRTdGFydCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iLCBfYywgX2QsIF9lLCBfZiwgX2csIF9oLCBfaiwgX2ssIF9sLCBfbSwgX28sIF9wLCBfcTtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VHbG9iYWxTdGF0aXN0aWNzKCk7XG4gICAgICAgIG1lc3NhZ2UucGxheWVyc09ubGluZSA9IChfYSA9IG9iamVjdC5wbGF5ZXJzT25saW5lKSAhPT0gbnVsbCAmJiBfYSAhPT0gdm9pZCAwID8gX2EgOiAwO1xuICAgICAgICBtZXNzYWdlLnNlcnZlcnNPbmxpbmUgPSAoX2IgPSBvYmplY3Quc2VydmVyc09ubGluZSkgIT09IG51bGwgJiYgX2IgIT09IHZvaWQgMCA/IF9iIDogMDtcbiAgICAgICAgbWVzc2FnZS5wbGF5ZXJzU2VhcmNoaW5nID0gKF9jID0gb2JqZWN0LnBsYXllcnNTZ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iXCIpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTApLnN0cmluZyhtZXNzYWdlLm5hbWUpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmlka2V5ICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDE2KS51aW50MzIobWVzc2FnZS5pZGtleSk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VPcGVyYXRpb25hbFN0YXRpc3RpY0Rlc2NyaXB0aW9uKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5uYW1lID0gcmVhZGVyLnN0cmluZygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuaWRrZXkgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZS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gICAgICAgd3JpdGVyLmxkZWxpbSgpO1xuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZU9wZXJhdGlvbmFsU3RhdGlzdGljRWxlbWVudCgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuaWRrZXkgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgaWYgKCh0YWcgJiA3KSA9PT0gMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZW5kMiA9IHJlYWRlci51aW50MzIoKSArIHJlYWRlci5wb3M7XG4gICAgICAgICAgICAgICAgICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZDIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnZhbHVlcy5wdXNoKHJlYWRlci5pbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgIC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ICBpZiAobWVzc2FnZS5wYWNrZXRpZCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig4KS5pbnQzMihtZXNzYWdlLnBhY2tldGlkKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5tc3RpbWVzdGFtcCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigxNikuaW50MzIobWVzc2FnZS5tc3RpbWVzdGFtcCk7XG4gICAgICAgIH1cbiAgICAgICAgZm9yIChjb25zdCB2IG9mIG1lc3NhZ2UudmFsdWVzKSB7XG4gICAgICAgICAgICBleHBvcnRzLk9wZXJhdGlvbmFsU3RhdGlzdGljRWxlbWVudC5lbmNvZGUodiwgd3JpdGVyLnVpbnQzMigyNikuZm9yaygpKS5sZGVsaW0oKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZU9wZXJhdGlvbmFsU3RhdGlzdGljc1BhY2tldCgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucGFja2V0aWQgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm1zdGltZXN0YW1wID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS52YWx1ZXMucHVzaChleHBvcnRzLk9wZXJhdGlvbmFsU3RhdGlzdGljRWxlbWVudC5kZWNvZGUocmVhZGVyLCByZWFkZXIudWludDMyKCkpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iLCBfYztcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VPcGVyYXRpb25hbFN0YXRpc3RpY3NQYWNrZXQoKTtcbiAgICAgICAgbWVzc2FnZS5wYWNrZXRpZCA9IChfYSA9IG9iamVjdC5wYWNrZXRpZCkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogMDtcbiAgICAgICAgbWVzc2FnZS5tc3RpbWVzdGFtcCA9IChfYiA9IG9iamVjdC5tc3RpbWVzdGFtcCkgIT09IG51bGwgJiYgX2IgIT09IHZvaWQgMCA/IF9iIDogMDtcbiAgICAgICAgbWVzc2FnZS52YWx1ZXMgPVxuICAgICAgICAgICAgKChfYyA9IG9iamVjdC52YWx1ZXMpID09PSBudWxsIHx8IF9jID09PSB2b2lkIDAgPyB2b2lkIDAgOiBfYy5tYXAoZSA9PiBleHBvcnRzLk9wZXJhdGlvbmFsU3RhdGlzdGljRWxlbWVudC5mcm9tUGFydGlhbChlKSkpIHx8IFtdO1xuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9XG59O1xuZnVuY3Rpb24gY3JlYXRlQmFzZVBsYXllclJhbmtpbmdJbmZvKCkge1xuICAgIHJldHVybiB7XG4gICAgICAgIGFjY291bnRJZDogMCxcbiAgICAgICAgcmFua0lkOiAwLFxuICAgICAgICB3aW5zOiAwLFxuICAgICAgICByYW5rQ2hhbmdlOiAwLFxuICAgICAgICByYW5rVHlwZUlkOiAwLFxuICAgICAgICB0dkNvbnRyb2w6IDBcbiAgICB9O1xufVxuZXhwb3J0cy5QbGF5ZXJSYW5raW5nSW5mbyA9IHtcbiAgICBlbmNvZGUobWVzc2FnZSwgd3JpdGVyID0gbWluaW1hbF8xLldyaXRlci5jcmVhdGUoKSkge1xuICAgICAgICBpZiAobWVzc2FnZS5hY2NvdW50SWQgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoOCkudWludDMyKG1lc3NhZ2UuYWNjb3VudElkKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5yYW5rSWQgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTYpLnVpbnQzMihtZXNzYWdlLnJhbmtJZCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2Uud2lucyAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigyNCkudWludDMyKG1lc3NhZ2Uud2lucyk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UucmFua0NoYW5nZSAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigzNykuZmxvYXQobWVzc2FnZS5yYW5rQ2hhbmdlKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5yYW5rVHlwZUlkICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDQ4KS51aW50MzIobWVzc2FnZS5yYW5rVHlwZUlkKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS50dkNvbnRyb2wgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNTYpLnVpbnQzMihtZXNzYWdlLnR2Q29udHJvbCk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VQbGF5ZXJSYW5raW5nSW5mbygpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuYWNjb3VudElkID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucmFua0lkID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uud2lucyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnJhbmtDaGFuZ2UgPSByZWFkZXIuZmxvYXQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA2OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnJhbmtUeXBlSWQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50dkNvbnRyb2wgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCBfYiwgX2MsIF9kLCBfZSwgX2Y7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlUGxheWVyUmFua2luZ0luZm8oKTtcbiAgICAgICAgbWVzc2FnZS5hY2NvdW50SWQgPSAoX2EgPSBvYmplY3QuYWNjb3VudElkKSAhPT0gbnVsbCAmJiBfYSAhPT0gdm9pZCAwID8gX2EgOiAwO1xuICAgICAgICBtZXNzYWdlLnJhbmtJZCA9IChfYiA9IG9iamVjdC5yYW5rSWQpICE9PSBudWxsICYmIF9iICE9PSB2b2lkIDAgPyBfYiA6IDA7XG4gICAgICAgIG1lc3NhZ2Uud2lucyA9ICh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B7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDMyKS51aW50MzIobWVzc2FnZS5jbWRMZWFkZXIpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiB3cml0ZXI7XG4gICAgfSxcbiAgICBkZWNvZGUoaW5wdXQsIGxlbmd0aCkge1xuICAgICAgICBjb25zdCByZWFkZXIgPSBpbnB1dCBpbnN0YW5jZW9mIG1pbmltYWxfMS5SZWFkZXIgPyBpbnB1dCA6IG5ldyBtaW5pbWFsXzEuUmVhZGVyKGlucHV0KTtcbiAgICAgICAgbGV0IGVuZCA9IGxlbmd0aCA9PT0gdW5kZWZpbmVkID8gcmVhZGVyLmxlbiA6IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlUGxheWVyQ29tbWVuZGF0aW9uSW5mbygpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuY21kRnJpZW5kbHkgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5jbWRUZWFjaGluZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmNtZExlYWRlciA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgc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xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMih2KTtcbiAgICAgICAgfVxuICAgICAgICB3cml0ZXIubGRlbGltKCk7XG4gICAgICAgIGlmIChtZXNzYWdlLmZlYXR1cmVkRGlzcGxheUl0ZW1EZWZpZHggIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNjQpLnVpbnQzMihtZXNzYWdlLmZlYXR1cmVkRGlzcGxheUl0ZW1EZWZpZHgpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiB3cml0ZXI7XG4gICAgfSxcbiAgICBkZWNvZGUoaW5wdXQsIGxlbmd0aCkge1xuICAgICAgICBjb25zdCByZWFkZXIgPSBpbnB1dCBpbnN0YW5jZW9mIG1pbmltYWxfMS5SZWFkZXIgPyBpbnB1dCA6IG5ldyBtaW5pbWFsXzEuUmVhZGVyKGlucHV0KTtcbiAgICAgICAgbGV0IGVuZCA9IGxlbmd0aCA9PT0gdW5kZWZpbmVkID8gcmVhZGVyLmxlbiA6IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlUGxheWVyTWVkYWxzSW5mbygpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDc6XG4gICAgICAgICAgICAgICAgICAgIGlmICgodGFnICYgNykgPT09IDIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGVuZDIgPSByZWFkZXIudWludDMyKCkgKyByZWFkZXIucG9zO1xuICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5kaXNwbGF5SXRlbXNEZWZpZHgucHVzaChyZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5kaXNwbGF5SXRlbXNEZWZpZHgucHVzaChyZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgODpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5mZWF0dXJlZERpc3BsYXlJdGVtRGVmaWR4ID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2I7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlUGxheWVyTWVkYWxzSW5mbygpO1xuICAgICAgICBtZXNzYWdlLmRpc3BsYXlJdGVtc0RlZmlkeCA9ICgoX2EgPSBvYmplY3QuZGlzcGxheUl0ZW1zRGVmaWR4KSA9PT0gbnVsbCB8fCBfYSA9PT0gdm9pZCAwID8gdm9pZCAwIDogX2EubWFwKGUgPT4gZSkpIHx8IFtdO1xuICAgICAgICBtZXNzYWdlLmZlYXR1cmVkRGlzcGxheUl0ZW1EZWZpZHggPSAoX2IgPSBvYmplY3QuZmVhdHVyZWREaXNwbGF5SXRlbURlZmlkeCkgIT09IG51bGwgJiYgX2IgIT09IHZvaWQgMCA/IF9i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Z3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VBY2NvdW50QWN0aXZpdHkoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmFjdGl2aXR5ID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubW9kZSA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm1hcCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm1hdGNoaWQgPSByZWFkZXIudWludDY0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCBfYiwgX2M7XG4gICAgICAgIGNvbn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hZ2UudGVhbUlkQ3QgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTYpLmludDMyKG1lc3NhZ2UudGVhbUlkQ3QpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnRlYW1JZFQgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMjQpLmludDMyKG1lc3NhZ2UudGVhbUlkVCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuZXZlbnRTdGFnZUlkICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDMyKS5pbnQzMihtZXNzYWdlLmV2ZW50U3RhZ2VJZCk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VUb3VybmFtZW50TWF0Y2hTZXR1cCgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZXZlbnRJZCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudGVhbUlkQ3QgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnRlYW1JZFQgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmV2ZW50U3RhZ2VJZCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2IsIF9jLCBfZDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VUb3VybmFtZW50TWF0Y2hTZXR1cCgpO1xuICAgICAgICBtZXNzYWdlLmV2ZW50SWQgPSAoX2EgPSBvYmplY3QuZXZlbnRJZCkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogMDtcbiAgICAgICAgbWVzc2FnZS50ZWFtSWRDdCA9IChfYiA9IG9iamVjdC50ZWFtSWRDdCkgIT09IG51bGwgJiYgX2IgIT09IHZvaWQgMCA/IF9iIDogMDtcbiAgICAgICAgbWVzc2FnZS50ZWFtSWRUID0gKF9jID0gb2JqZWN0LnRlYW1JZFQpICE9PSBudWxsICYmIF9jICE9PSB2b2lkIDAgPyBfYyA6IDA7XG4gICAgICAgIG1lc3NhZ2UuZXZlbnRTdGFn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gICAgICAgd3JpdGVyLnVpbnQzMig4KS51aW50MzIobWVzc2FnZS50dlVkcFBvcnQpO1xuICAgICAgICB9XG4gICAgICAgIGlmICghbWVzc2FnZS50dldhdGNoS2V5LmlzWmVybygpKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDE2KS51aW50NjQobWVzc2FnZS50dldhdGNoS2V5KTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS50dlNsb3RzICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDI0KS51aW50MzIobWVzc2FnZS50dlNsb3RzKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS50dkNsaWVudHMgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMzIpLnVpbnQzMihtZXNzYWdlLnR2Q2xpZW50cyk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UudHZQcm94aWVzICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDQwKS51aW50MzIobWVzc2FnZS50dlByb3hpZXMpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnR2VGltZSAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig0OCkudWludDMyKG1lc3NhZ2UudHZUaW1lKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5nYW1lVHlwZSAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig2NCkudWludDMyKG1lc3NhZ2UuZ2FtZVR5cGUpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmdhbWVNYXBncm91cCAhPT0gXCJcIikge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig3NCkuc3RyaW5nKG1lc3NhZ2UuZ2FtZU1hcGdyb3VwKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5nYW1lTWFwICE9PSBcIlwiKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDgyKS5zdHJpbmcobWVzc2FnZS5nYW1lTWFwKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAoIW1lc3NhZ2UudHZNYXN0ZXJTdGVhbWlkLmlzWmVybygpKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDg4KS51aW50NjQobWVzc2FnZS50dk1hc3RlclN0ZWFtaWQpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnR2TG9jYWxTbG90cyAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig5NikudWludDMyKG1lc3NhZ2UudHZMb2NhbFNsb3RzKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS50dkxvY2FsQ2xpZW50cyAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigxMDQpLnVpbnQzMihtZXNzYWdlLnR2TG9jYWxDbGllbnRzKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS50dkxvY2FsUHJveGllcyAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigxMTIpLnVpbnQzMihtZXNzYWdlLnR2TG9jYWxQcm94aWVzKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS50dlJlbGF5U2xvdHMgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTIwKS51aW50MzIobWVzc2FnZS50dlJlbGF5U2xvdHMpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnR2UmVsYXlDbGllbnRzICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDEyOCkudWludDMyKG1lc3NhZ2UudHZSZWxheUNsaWVudHMpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnR2UmVsYXlQcm94aWVzICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDEzNikudWludDMyKG1lc3NhZ2UudHZSZWxheVByb3hpZXMpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnR2UmVsYXlBZGRyZXNzICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDE0NCkudWludDMyKG1lc3NhZ2UudHZSZWxheUFkZHJlc3MpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnR2UmVsYXlQb3J0ICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDE1MikudWludDMyKG1lc3NhZ2UudHZSZWxheVBvcnQpO1xuICAgICAgICB9XG4gICAgICAgIGlmICghbWVzc2FnZS50dlJlbGF5U3RlYW1pZC5pc1plcm8oKSkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigxNjApLnVpbnQ2NChtZXNzYWdlLnR2UmVsYXlTdGVhbWlkKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5mbGFncyAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigxNjgpLnVpbnQzMihtZXNzYWdlLmZsYWdzKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZVNlcnZlckhsdHZJbmZvKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50dlVkcFBvcnQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50dldhdGNoS2V5ID0gcmVhZGVyLnVpbnQ2NCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudHZTbG90cyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnR2Q2xpZW50cyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA1OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnR2UHJveGllcyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA2OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnR2VGltZSA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA4OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmdhbWVUeXBlID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDk6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZ2FtZU1hcGdyb3VwID0gcmVhZGVyLnN0cmluZygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDEwOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmdhbWVNYXAgPSByZWFkZXIuc3RyaW5nKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudHZNYXN0ZXJTdGVhbWlkID0gcmVhZGVyLnVpbnQ2NCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDEyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnR2TG9jYWxTbG90cyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50dkxvY2FsQ2xpZW50cyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50dkxvY2FsUHJveGllcyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxNTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50dlJlbGF5U2xvdHMgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTY6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudHZSZWxheUNsaWVudHMgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTc6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudHZSZWxheVByb3hpZXMgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTg6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudHZSZWxheUFkZHJlc3MgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTk6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudHZSZWxheVBvcnQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjA6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudHZSZWxheVN0ZWFtaWQgPSByZWFkZXIudWludDY0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZmxhZ3MgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCBfYiwgX2MsIF9kLCBfZSwgX2YsIF9nLCBfaCwgX2osIF9rLCBfbCwgX20sIF9vLCBfcCwgX3EsIF9yLCBfcztcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VTZXJ2ZXJIbHR2SW5mbygpO1xuICAgICAgICBtZXNzYWdlLnR2VWRwUG9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gICB3cml0ZXIudWludDMyKDE2KS51aW50MzIobWVzc2FnZS5iKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5jICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDI0KS51aW50MzIobWVzc2FnZS5jKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5kICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDMyKS51aW50MzIobWVzc2FnZS5kKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5iaXRzICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDQwKS51aW50MzIobWVzc2FnZS5iaXRzKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS50b2tlbiAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig0OCkudWludDMyKG1lc3NhZ2UudG9rZW4pO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiB3cml0ZXI7XG4gICAgfSxcbiAgICBkZWNvZGUoaW5wdXQsIGxlbmd0aCkge1xuICAgICAgICBjb25zdCByZWFkZXIgPSBpbnB1dCBpbnN0YW5jZW9mIG1pbmltYWxfMS5SZWFkZXIgPyBpbnB1dCA6IG5ldyBtaW5pbWFsXzEuUmVhZGVyKGlucHV0KTtcbiAgICAgICAgbGV0IGVuZCA9IGxlbmd0aCA9PT0gdW5kZWZpbmVkID8gcmVhZGVyLmxlbiA6IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlSXBBZGRyZXNzTWFzaygpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuYSA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmIgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5jID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA1OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmJpdHMgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50b2tlbiA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iLCBfYywgX2QsIF9lLCBfZjtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VJcEFkZHJlc3NNYXNrKCk7XG4gICAgICAgIG1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ICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmRlbHRhICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDE2KS5pbnQzMihtZXNzYWdlLmRlbHRhKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5hYnNvbHV0ZSA9PT0gdHJ1ZSkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigyNCkuYm9vbChtZXNzYWdlLmFic29sdXRlKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNNc2dDc2dvU3RlYW1Vc2VyU3RhdENoYW5nZSgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZWNzZ29zdGVhbXVzZXJzdGF0ID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5kZWx0YSA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztc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1lc3NhZ2UuaXRlbUF0dHJEZWZpZHggIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTYpLnVpbnQzMihtZXNzYWdlLml0ZW1BdHRyRGVmaWR4KTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5pdGVtQXR0ckRlbHRhVmFsdWUgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMjQpLnVpbnQzMihtZXNzYWdlLml0ZW1BdHRyRGVsdGFWYWx1ZSk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VNYXRjaEVuZEl0ZW1VcGRhdGVzKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5pdGVtSWQgPSByZWFkZXIudWludDY0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5pdGVtQXR0ckRlZmlkeCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLml0ZW1BdHRyRGVsdGFWYWx1ZSA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZU1hdGNoRW5kSXRlbVVwZGF0ZXMoKTtcbiAgICAgICAgbWVzc2FnZS5pdGVtSWQgPVxuICAgICAgICAgICAgb2JqZWN0Lml0ZW1JZCAhPT0gdW5kZWZpbmVkICYmIG9iamVjdC5pdGVtSWQgIT09IG51bGxcbiAgICAgICAgICAgICAgICA/IExvbmcuZnJvbVZhbHVlKG9iamVjdC5pdGVtSWQpXG4gICAgICAgICAgICAgICAgOiBMb25nLlVaRVJPO1xuICAgICAgICBtZXNzYWdlLml0ZW1BdHRyRGVmaWR4ID0gKF9hID0gb2JqZWN0Lml0ZW1BdHRyRGVmaWR4KSAhPT0gbnVsbCAmJiBfYSAhPT0gdm9pZCAwID8gX2EgOiAwO1xuICAgICAgICBtZXNzYWdlLml0ZW1BdHRyRGVsdGFWYWx1ZSA9IChfYiA9IG9iamVjdC5pdGVtQXR0ckRlbHRhVmFsdWUpICE9PSBudWxsICYmIF9iICE9PSB2b2lkIDAgPyBfYiA6IDA7XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH1cbn07XG5mdW5jdGlvbiBjcmVhdGVCYXNlU2NvcmVMZWFkZXJib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XIgPSBpbnB1dCBpbnN0YW5jZW9mIG1pbmltYWxfMS5SZWFkZXIgPyBpbnB1dCA6IG5ldyBtaW5pbWFsXzEuUmVhZGVyKGlucHV0KTtcbiAgICAgICAgbGV0IGVuZCA9IGxlbmd0aCA9PT0gdW5kZWZpbmVkID8gcmVhZGVyLmxlbiA6IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlU2NvcmVMZWFkZXJib2FyZERhdGEoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnF1ZXN0SWQgPSByZWFkZXIudWludDY0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zY29yZSA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmFjY291bnRlbnRyaWVzLnB1c2goZXhwb3J0cy5TY29yZUxlYWRlcmJvYXJkRGF0YV9BY2NvdW50RW50cmllcy5kZWNvZGUocmVhZGVyLCByZWFkZXIudWludDMyKCkpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA1OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm1hdGNoZW50cmllcy5wdXNoKGV4cG9ydHMuU2NvcmVMZWFkZXJib2FyZERhdGFfRW50cnkuZGVjb2RlKHJlYWRlciwgcmVhZGVyLnVpbnQzMigpKSk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCBfYiwgX2M7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlU2NvcmVMZWFkZXJib2FyZERhdGEoKTtcbiAgICAgICAgbWVzc2FnZS5xdWVzdElkID1cbiAgICAgICAgICAgIG9iamVjdC5xdWVzdElkICE9PSB1bmRlZmluZWQgJiYgb2JqZWN0LnF1ZXN0SWQgIT09IG51bGxcbiAgICAgICAgICAgICAgICA/IExvbmcuZnJvbVZhbHVlKG9iamVjdC5xdWVzdElkKVxuICAgICAgICAgICAgICAgIDogTG9uZy5VWkVSTztcbiAgICAgICAgbWVzc2FnZS5zY29yZSA9IChfYSA9IG9iamVjdC5zY29yZSkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogMDtcbiAgICAgICAgbWVzc2FnZS5hY2NvdW50ZW50cmllcyA9XG4gICAgICAgICAgICAoKF9iID0gb2JqZWN0LmFjY291bnRlbnRyaWVzKSA9PT0gbnVsbCB8fCBfYiA9PT0gdm9pZCAwID8gdm9pZCAwIDogX2IubWFwKGUgPT4gZXhwb3J0cy5TY29yZUxlYWRlcmJvYXJkRGF0YV9BY2NvdW50RW50cmllcy5mcm9tUGFydGlhbChlKSkpIHx8IFtdO1xuICAgICAgICBtZXNzYWdlLm1hdGNoZW50cmllcyA9XG4gICAgICAgICAgICAoKF9jID0gb2JqZWN0Lm1hdGNoZW50cmllcykgPT09IG51bGwgfHwgX2MgPT09IHZv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kge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudmFsID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2I7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlU2NvcmVMZWFkZXJib2FyZERhdGFfRW50cnkoKTtcbiAgICAgICAgbWVzc2FnZS50YWcgPSAoX2EgPSBvYmplY3QudGFnKSAhPT0gbnVsbCAmJiBfYSAhPT0gdm9pZCAwID8gX2EgOiAwO1xuICAgICAgICBtZXNzYWdlLnZhbCA9IChfYiA9IG9iamVjdC52YWwpICE9PSBudWxsICYmIF9iICE9PSB2b2lkIDAgPyBfYiA6IDA7XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH1cbn07XG5mdW5jdGlvbiBjcmVhdGVCYXNlU2NvcmVMZWFkZXJib2FyZERhdGFfQWNjb3VudEVudHJpZXMoKSB7XG4gICAgcmV0dXJuIHsgYWNjb3VudGlkOiAwLCBlbnRyaWVzOiBbXSB9O1xufVxuZXhwb3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RpZCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmVudHJpZXMucHVzaChleHBvcnRzLlNjb3JlTGVhZGVyYm9hcmREYXRhX0VudHJ5LmRlY29kZShyZWFkZXIsIHJlYWRlci51aW50MzIoKSkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2I7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlU2NvcmVMZWFkZXJib2FyZERhdGFfQWNjb3VudEVudHJpZXMoKTtcbiAgICAgICAgbWVzc2FnZS5hY2NvdW50aWQgPSAoX2EgPSBvYmplY3QuYWNjb3VudGlkKSAhPT0gbnVsbCAmJiBfYSAhPT0gdm9pZCAwID8gX2EgOiAwO1xuICAgICAgICBtZXNzYWdlLmVudHJpZXMgPVxuICAgICAgICAgICAgKChfYiA9IG9iamVjdC5lbnRyaWVzKSA9PT0gbnVsbCB8fCBfYiA9PT0gdm9pZCAwID8gdm9pZCAwIDogX2IubWFwKGUgPT4gZXhwb3J0cy5TY29yZUxlYWRlcmJvYXJkRGF0YV9FbnRyeS5mcm9tUGFydGlhbChlKSkpIHx8IFtdO1xuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9XG59O1xuZnVuY3Rpb24gY3JlYXRlQmFzZVBsYXllclF1ZXN0RGF0YSgpIHtcbiAgICByZXR1cm4ge1xuICAgICAgICB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Z2UgPSBjcmVhdGVCYXNlUGxheWVyUXVlc3REYXRhKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5xdWVzdGVyQWNjb3VudElkID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucXVlc3RJdGVtRGF0YS5wdXNoKGV4cG9ydHMuUGxheWVyUXVlc3REYXRhX1F1ZXN0SXRlbURhdGEuZGVjb2RlKHJlYWRlciwgcmVhZGVyLnVpbnQzMigpKSk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS54cFByb2dyZXNzRGF0YS5wdXNoKGV4cG9ydHMuWHBQcm9ncmVzc0RhdGEuZGVjb2RlKHJlYWRlciwgcmVhZGVyLnVpbnQzMigpKSk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50aW1lUGxheWVkID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubW1HYW1lTW9kZSA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA2OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdl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XN0Qm9udXNQb2ludHNFYXJuZWQpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiB3cml0ZXI7XG4gICAgfSxcbiAgICBkZWNvZGUoaW5wdXQsIGxlbmd0aCkge1xuICAgICAgICBjb25zdCByZWFkZXIgPSBpbnB1dCBpbnN0YW5jZW9mIG1pbmltYWxfMS5SZWFkZXIgPyBpbnB1dCA6IG5ldyBtaW5pbWFsXzEuUmVhZGVyKGlucHV0KTtcbiAgICAgICAgbGV0IGVuZCA9IGxlbmd0aCA9PT0gdW5kZWZpbmVkID8gcmVhZGVyLmxlbiA6IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlUGxheWVyUXVlc3REYXRhX1F1ZXN0SXRlbURhdGEoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnF1ZXN0SWQgPSByZWFkZXIudWludDY0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5xdWVzdE5vcm1hbFBvaW50c0Vhcm5lZCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucXVlc3RCb251c1BvaW50c0Vhcm5lZCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIu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3Q6IGZhbHNlLFxuICAgICAgICBtYXRjaE91dGNvbWU6IDAsXG4gICAgICAgIHJvdW5kc1dvbjogMCxcbiAgICAgICAgcm91bmRzTG9zdDogMCxcbiAgICAgICAgc3RhdFNjb3JlOiAwLFxuICAgICAgICBzdGF0RGVhdGhzOiAwLFxuICAgICAgICBzdGF0TXZwczogMCxcbiAgICAgICAgZW5lbXlLaWxsczogMCxcbiAgICAgICAgZW5lbXlIZWFkc2hvdHM6IDAsXG4gICAgICAgIGVuZW15MmtzOiAwLFxuICAgICAgICBlbmVteTNrczogMCxcbiAgICAgICAgZW5lbXk0a3M6IDAsXG4gICAgICAgIHRvdGFsRGFtYWdlOiAwLFxuICAgICAgICBlbmdhZ2VtZW50c0VudHJ5Q291bnQ6IDAsXG4gICAgICAgIGVuZ2FnZW1lbnRzRW50cnlXaW5zOiAwLFxuICAgICAgICBlbmdhZ2VtZW50czF2MUNvdW50OiAwLFxuICAgICAgICBlbmdhZ2VtZW50czF2MVdpbnM6IDAsXG4gICAgICAgIGVuZ2FnZW1lbnRzMXYyQ291bnQ6IDAsXG4gICAgICAgIGVuZ2FnZW1lbnRzMXYyV2luczogMCxcbiAgICAgICAgdXRpbGl0eUNvdW50OiAwLFxuICAgICAgICB1dGlsaXR5U3VjY2VzczogMCxcbiAgICAgICAgZmxhc2hDb3VudDogMCxcbiAgICAgICAgZmxhc2hTdWNjZXNzOiAwLFxuICAgICAgICBtYXRlczogW11cbiAgICB9O1xufVxuZXhwb3J0cy5EZWVwUGxheWVyU3RhdHNFbnRyeSA9IHtcbiAgICBlbmNvZGUobWVzc2FnZSwgd3JpdGVyID0gbWluaW1hbF8xLldyaXRlci5jcmVhdGUoKSkge1xuICAgICAgICBpZiAobWVzc2FnZS5hY2NvdW50aWQgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoOCkudWludDMyKG1lc3NhZ2UuYWNjb3VudGlkKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAoIW1lc3NhZ2UubWF0Y2hJZC5pc1plcm8oKSkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigxNikudWludDY0KG1lc3NhZ2UubWF0Y2hJZCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UubW1HYW1lTW9kZSAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigyNCkudWludDMyKG1lc3NhZ2UubW1HYW1lTW9kZSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UubWFwaWQgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMzIpLnVpbnQzMihtZXNzYWdlLm1hcGlkKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5iU3RhcnRpbmdDdCA9PT0gdHJ1ZSkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig0MCkuYm9vbChtZXNzYWdlLmJTdGFydGluZ0N0KTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5tYXRjaE91dGNvbWUgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNDgpLnVpbnQzMihtZXNzYWdlLm1hdGNoT3V0Y29tZSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2Uucm91bmRzV29uICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDU2KS51aW50MzIobWVzc2FnZS5yb3VuZHNXb24pO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnJvdW5kc0xvc3QgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNjQpLnVpbnQzMihtZXNzYWdlLnJvdW5kc0xvc3QpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnN0YXRTY29yZSAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig3MikudWludDMyKG1lc3NhZ2Uuc3RhdFNjb3JlKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5zdGF0RGVhdGhzICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDk2KS51aW50MzIobWVzc2FnZS5zdGF0RGVhdGhzKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5zdGF0TXZwcyAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigxMDQpLnVpbnQzMihtZXNzYWdlLnN0YXRNdnBzKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5lbmVteUtpbGxzICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDExMikudWludDMyKG1lc3NhZ2UuZW5lbXlLaWxscyk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuZW5lbXlIZWFkc2hvdHMgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTIwKS51aW50MzIobWVzc2FnZS5lbmVteUhlYWRzaG90cyk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuZW5lbXkya3MgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTI4KS51aW50MzIobWVzc2FnZS5lbmVteTJrcyk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuZW5lbXkza3MgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTM2KS51aW50MzIobWVzc2FnZS5lbmVteTNrcyk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuZW5lbXk0a3MgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTQ0KS51aW50MzIobWVzc2FnZS5lbmVteTRrcyk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UudG90YWxEYW1hZ2UgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTUyKS51aW50MzIobWVzc2FnZS50b3RhbERhbWFnZSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuZW5nYWdlbWVudHNFbnRyeUNvdW50ICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDE4NCkudWludDMyKG1lc3NhZ2UuZW5nYWdlbWVudHNFbnRyeUNvdW50KTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5lbmdhZ2VtZW50c0VudHJ5V2lucyAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigxOTIpLnVpbnQzMihtZXNzYWdlLmVuZ2FnZW1lbnRzRW50cnlXaW5zKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5lbmdhZ2VtZW50czF2MUNvdW50ICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDIwMCkudWludDMyKG1lc3NhZ2UuZW5nYWdlbWVudHMxdjFDb3VudCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuZW5nYWdlbWVudHMxdjFXaW5zICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDIwOCkudWludDMyKG1lc3NhZ2UuZW5nYWdlbWVudHMxdjFXaW5zKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5lbmdhZ2VtZW50czF2MkNvdW50ICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDIxNikudWludDMyKG1lc3NhZ2UuZW5nYWdlbWVudHMxdjJDb3VudCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuZW5nYWdlbWVudHMxdjJXaW5zICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDIyNCkudWludDMyKG1lc3NhZ2UuZW5nYWdlbWVudHMxdjJXaW5zKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS51dGlsaXR5Q291bnQgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMjMyKS51aW50MzIobWVzc2FnZS51dGlsaXR5Q291bnQpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnV0aWxpdHlTdWNjZXNzICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDI0MCkudWludDMyKG1lc3NhZ2UudXRpbGl0eVN1Y2Nlc3MpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmZsYXNoQ291bnQgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMjU2KS51aW50MzIobWVzc2FnZS5mbGFzaENvdW50KTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5mbGFzaFN1Y2Nlc3MgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMjY0KS51aW50MzIobWVzc2FnZS5mbGFzaFN1Y2Nlc3MpO1xuICAgICAgICB9XG4gICAgICAgIHdyaXRlci51aW50MzIoMjc0KS5mb3JrKCk7XG4gICAgICAgIGZvciAoY29uc3QgdiBvZiBtZXNzYWdlLm1hdGVzKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKHYpO1xuICAgICAgICB9XG4gICAgICAgIHdyaXRlci5sZGVsaW0oKTtcbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VEZWVwUGxheWVyU3RhdHNFbnRyeSgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuYWNjb3VudGlkID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubWF0Y2hJZCA9IHJlYWRlci51aW50NjQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm1tR2FtZU1vZGUgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5tYXBpZCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA1OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmJTdGFydGluZ0N0ID0gcmVhZGVyLmJvb2woKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA2OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm1hdGNoT3V0Y29tZSA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA3OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnJvdW5kc1dvbiA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA4OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnJvdW5kc0xvc3QgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgOTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zdGF0U2NvcmUgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc3RhdERlYXRocyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zdGF0TXZwcyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5lbmVteUtpbGxzID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDE1OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmVuZW15SGVhZHNob3RzID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDE2OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmVuZW15MmtzID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDE3OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmVuZW15M2tzID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDE4OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmVuZW15NGtzID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDE5OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnRvdGFsRGFtYWdlID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDIzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmVuZ2FnZW1lbnRzRW50cnlDb3VudCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5lbmdhZ2VtZW50c0VudHJ5V2lucyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyNTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5lbmdhZ2VtZW50czF2MUNvdW50ID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI2OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmVuZ2FnZW1lbnRzMXYxV2lucyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyNzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5lbmdhZ2VtZW50czF2MkNvdW50ID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI4OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmVuZ2FnZW1lbnRzMXYyV2lucyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS51dGlsaXR5Q291bnQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzA6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudXRpbGl0eVN1Y2Nlc3MgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZmxhc2hDb3VudCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5mbGFzaFN1Y2Nlc3MgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzQ6XG4gICAgICAgICAgICAgICAgICAgIGlmICgodGFnICYgNykgPT09IDIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGVuZDIgPSByZWFkZXIudWludDMyKCkgKyByZWFkZXIucG9zO1xuICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5tYXRlcy5wdXNoKHJlYWRlci51aW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm1hdGVzLnB1c2gocmVhZGVyLnVpbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2IsIF9jLCBfZCwgX2UsIF9mLCBfZywgX2gsIF9qLCBfaywgX2wsIF9tLCBfbywgX3AsIF9xLCBfciwgX3MsIF90LCBfdSwgX3YsIF93LCBfeCwgX3ksIF96LCBfMCwgXzEsIF8yO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZURlZXBQbGF5ZXJTdGF0c0VudHJ5KCk7XG4gICAgICAgIG1lc3NhZ2UuYWNjb3VudGlkID0gKF9hID0gb2JqZWN0LmFjY291bnRpZCkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogMDtcbiAgICAgICAgbWVzc2FnZS5tYXRjaElkID1cbiAgICAgICAgICAgIG9iamVjdC5tYXRjaElkICE9PSB1bmRlZmluZWQgJiYgb2JqZWN0Lm1hdGNoSWQgIT09IG51bGxcbiAgICAgICAgICAgICAgICA/IExvbmcuZnJvbVZhbHVlKG9iamVjdC5tYXRjaElkKVxuICAgICAgICAgICAgICAgIDogTG9uZy5VWkVSTztcbiAgICAgICAgbWVzc2FnZS5tbUdhbWVNb2RlID0gKF9iID0gb2JqZWN0Lm1tR2FtZU1vZGUpICE9PSBudWxsICYmIF9iICE9PSB2b2lkIDAgPyBfYiA6IDA7XG4gICAgICAgIG1lc3NhZ2UubWFwaWQgPSAoX2MgPSBvYmplY3QubWFwaW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3VudGlkOiAwLFxuICAgICAgICBtYXRjaElkOiBMb25nLlVaRVJPLFxuICAgICAgICBldmVudElkOiAwLFxuICAgICAgICBldmVudFR5cGU6IDAsXG4gICAgICAgIGJQbGF5aW5nQ3Q6IGZhbHNlLFxuICAgICAgICB1c2VyUG9zWDogMCxcbiAgICAgICAgdXNlclBvc1k6IDAsXG4gICAgICAgIHVzZXJQb3NaOiAwLFxuICAgICAgICB1c2VyRGVmaWR4OiAwLFxuICAgICAgICBvdGhlclBvc1g6IDAsXG4gICAgICAgIG90aGVyUG9zWTogMCxcbiAgICAgICAgb3RoZXJQb3NaOiAwLFxuICAgICAgICBvdGhlckRlZmlkeDogMCxcbiAgICAgICAgZXZlbnREYXRhOiAwXG4gICAgfTtcbn1cbmV4cG9ydHMuRGVlcFBsYXllck1hdGNoRXZlbnQgPSB7XG4gICAgZW5jb2RlKG1lc3NhZ2UsIHdyaXRlciA9IG1pbmltYWxfMS5Xcml0ZXIuY3JlYXRlKCkpIHtcbiAgICAgICAgaWYgKG1lc3NhZ2UuYWNjb3VudGlkICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDgpLnVpbnQzMihtZXNzYWdlLmFjY291bnRpZCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKCFtZXNzYWdlLm1hdGNoSWQuaXNaZXJvKCkpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTYpLnVpbnQ2NChtZXNzYWdlLm1hdGNoSWQpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmV2ZW50SWQgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMjQpLnVpbnQzMihtZXNzYWdlLmV2ZW50SWQpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmV2ZW50VHlwZSAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigzMikudWludDMyKG1lc3NhZ2UuZXZlbnRUeXBlKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5iUGxheWluZ0N0ID09PSB0cnVlKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDQwKS5ib29sKG1lc3NhZ2UuYlBsYXlpbmdDdCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UudXNlclBvc1ggIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNDgpLmludDMyKG1lc3NhZ2UudXNlclBvc1gpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnVzZXJQb3NZICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDU2KS5pbnQzMihtZXNzYWdlLnVzZXJQb3NZKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS51c2VyUG9zWiAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig5NikuaW50MzIobWVzc2FnZS51c2VyUG9zWik7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UudXNlckRlZmlkeCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig2NCkudWludDMyKG1lc3NhZ2UudXNlckRlZmlkeCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2Uub3RoZXJQb3NYICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDcyKS5pbnQzMihtZXNzYWdlLm90aGVyUG9zWCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2Uub3RoZXJQb3NZICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDgwKS5pbnQzMihtZXNzYWdlLm90aGVyUG9zWSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2Uub3RoZXJQb3NaICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDEwNCkuaW50MzIobWVzc2FnZS5vdGhlclBvc1opO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLm90aGVyRGVmaWR4ICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDg4KS51aW50MzIobWVzc2FnZS5vdGhlckRlZmlkeCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuZXZlbnREYXRhICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDExMikuaW50MzIobWVzc2FnZS5ldmVudERhdGEpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiB3cml0ZXI7XG4gICAgfSxcbiAgICBkZWNvZGUoaW5wdXQsIGxlbmd0aCkge1xuICAgICAgICBjb25zdCByZWFkZXIgPSBpbnB1dCBpbnN0YW5jZW9mIG1pbmltYWxfMS5SZWFkZXIgPyBpbnB1dCA6IG5ldyBtaW5pbWFsXzEuUmVhZGVyKGlucHV0KTtcbiAgICAgICAgbGV0IGVuZCA9IGxlbmd0aCA9PT0gdW5kZWZpbmVkID8gcmVhZGVyLmxlbiA6IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlRGVlcFBsYXllck1hdGNoRXZlbnQoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmFjY291bnRpZCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm1hdGNoSWQgPSByZWFkZXIudWludDY0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5ldmVudElkID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZXZlbnRUeXBlID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuYlBsYXlpbmdDdCA9IHJlYWRlci5ib29sKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS51c2VyUG9zWCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDc6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudXNlclBvc1kgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS51c2VyUG9zWiA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDg6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudXNlckRlZmlkeCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA5OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm90aGVyUG9zWCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDEwOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm90aGVyUG9zWSA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDEzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm90aGVyUG9zWiA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDExOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm90aGVyRGVmaWR4ID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDE0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmV2ZW50RGF0YSA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2IsIF9jLCBfZCwgX2UsIF9mLCBfZywgX2gsIF9qLCBfaywgX2wsIF9tLCBfbztcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VEZWVwUGxheWVyTWF0Y2hFdmVudCgpO1xuICAgICAgICBtZXNzYWdlLmFjY291bnRpZCA9IChfYSA9IG9iamVjdC5hY2NvdW50aWQpICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6IDA7XG4gICAgICAgIG1lc3NhZ2UubWF0Y2hJZCA9XG4gICAgICAgICAgICBvYmplY3QubWF0Y2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zKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnBsYXllclF1ZXN0RGF0YS5wdXNoKGV4cG9ydHMuUGxheWVyUXVlc3REYXRhLmRlY29kZShyZWFkZXIsIHJlYWRlci51aW50MzIoKSkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuYmluYXJ5RGF0YSA9IHJlYWRlci5ieXRlcygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubW1HYW1lTW9kZSA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm1pc3Npb25sYnNkYXRhID0gZXhwb3J0cy5TY29yZUxlYWRlcmJvYXJkRGF0YS5kZWNvZGUocmVhZGVyLCByZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2IsIF9jO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNNc2dHQ1NlcnZlclF1ZXN0VXBkYXRlRGF0YSgpO1xuICAgICAgICBtZXNzYWdlLnBsYXllclF1ZXN0RGF0YSA9XG4gICAgICAgICAgICAoKF9h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gICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucGFja2V0aWQgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm5hbWVrZXlzLnB1c2goZXhwb3J0cy5PcGVyYXRpb25hbFN0YXRpc3RpY0Rlc2NyaXB0aW9uLmRlY29kZShyZWFkZXIsIHJlYWRlci51aW50MzIoKSkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucGFja2V0cy5wdXNoKGV4cG9ydHMuT3BlcmF0aW9uYWxTdGF0aXN0aWNzUGFja2V0LmRlY29kZShyZWFkZXIsIHJlYWRlci51aW50MzIoKSkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2IsIF9jO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNNc2dHQ0NTdHJpa2UxNVYyTWF0Y2htYWtpbmdHQ09wZXJhdGlvbmFsU3RhdHMoKTtcbiAgICAgICAgbWVzc2FnZS5wYWNrZXRpZCA9IChfYSA9IG9iamVjdC5wYWNrZXRpZCkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogMDtcbiAgICAgICAg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biAgICAgICAgfVxuICAgICAgICBpZiAoIW1lc3NhZ2UuZXhjaGFuZ2UuaXNaZXJvKCkpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMjQpLnVpbnQ2NChtZXNzYWdlLmV4Y2hhbmdlKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNNc2dHQ0NTdHJpa2UxNVYyTWF0Y2htYWtpbmdHQzJTZXJ2ZXJDb25maXJtKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50b2tlbiA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnN0YW1wID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZXhjaGFuZ2UgPSByZWFkZXIudWludDY0KCk7XG4gICA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XJuIHtcbiAgICAgICAgYWNjb3VudElkczogW10sXG4gICAgICAgIGdhbWVUeXBlOiAwLFxuICAgICAgICB0aWNrZXREYXRhOiBcIlwiLFxuICAgICAgICBjbGllbnRWZXJzaW9uOiAwLFxuICAgICAgICB0b3VybmFtZW50TWF0Y2g6IHVuZGVmaW5lZCxcbiAgICAgICAgcHJpbWVPbmx5OiBmYWxzZSxcbiAgICAgICAgdHZDb250cm9sOiAwLFxuICAgICAgICBsb2JieUlkOiBMb25nLlVaRVJPXG4gICAgfTtcbn1cbmV4cG9ydHMuQ01zZ0dDQ1N0cmlrZTE1VjJNYXRjaG1ha2luZ1N0YXJ0ID0ge1xuICAgIGVuY29kZShtZXNzYWdlLCB3cml0ZXIgPSBtaW5pbWFsXzEuV3JpdGVyLmNyZWF0ZSgpKSB7XG4gICAgICAgIHdyaXRlci51aW50MzIoMTApLmZvcmsoKTtcbiAgICAgICAgZm9yIChjb25zdCB2IG9mIG1lc3NhZ2UuYWNjb3VudElkcykge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMih2KTtcbiAgICAgICAgfVxuICAgICAgICB3cml0ZXIubGRlbGltKCk7XG4gICAgICAgIGlmIChtZXNzYWdlLmdhbWVUeXBlICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDE2KS51aW50MzIobWVzc2FnZS5nYW1lVHlwZSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UudGlja2V0RGF0YSAhPT0gXCJcIikge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigyNikuc3RyaW5nKG1lc3NhZ2UudGlja2V0RGF0YSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuY2xpZW50VmVyc2lvbiAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigzMikudWludDMyKG1lc3NhZ2UuY2xpZW50VmVyc2lvbik7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UudG91cm5hbWVudE1hdGNoICE9PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgIGV4cG9ydHMuVG91cm5hbWVudE1hdGNoU2V0dXAuZW5jb2RlKG1lc3NhZ2UudG91cm5hbWVudE1hdGNoLCB3cml0ZXIudWludDMyKDQyKS5mb3JrKCkpLmxkZWxpbSgpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnByaW1lT25seSA9PT0gdHJ1ZSkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig0OCkuYm9vbChtZXNzYWdlLnByaW1lT25seSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UudHZDb250cm9sICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDU2KS51aW50MzIobWVzc2FnZS50dkNvbnRyb2wpO1xuICAgICAgICB9XG4gICAgICAgIGlmICghbWVzc2FnZS5sb2JieUlkLmlzWmVybygpKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDY0KS51aW50NjQobWVzc2FnZS5sb2JieUlkKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNNc2dHQ0NTdHJpa2UxNVYyTWF0Y2htYWtpbmdTdGFydCgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIGlmICgodGFnICYgNykgPT09IDIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGVuZDIgPSByZWFkZXIudWludDMyKCkgKyByZWFkZXIucG9zO1xuICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5hY2NvdW50SWRzLnB1c2gocmVhZGVyLnVpbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuYWNjb3VudElkcy5wdXNoKHJlYWRlci51aW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmdhbWVUeXBlID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudGlja2V0RGF0YSA9IHJlYWRlci5zdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmNsaWVudFZlcnNpb24gPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50b3VybmFtZW50TWF0Y2ggPSBleHBvcnRzLlRvdXJuYW1lbnRNYXRjaFNldHVwLmRlY29kZShyZWFkZXIsIHJlYWRlci51aW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5wcmltZU9ubHkgPSByZWFkZXIuYm9vbCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDc6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudHZDb250cm9sID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDg6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubG9iYnlJZCA9IHJlYWRlci51aW50NjQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iLCBfYywgX2QsIF9lLCBfZjtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMk1hdGNobWFraW5nU3RhcnQoKTtcbiAgICAgICAgbWVzc2FnZS5hY2NvdW50SWRzID0gKChfYSA9IG9iamVjdC5hY2NvdW50SWRzKSA9PT0gbnVsbCB8fCBfYSA9PT0gdm9pZCAwID8gdm9pZCAwIDogX2EubWFwKGUgPT4gZSkpIHx8IFtdO1xuICAgICAgICBtZXNzYWdlLmdhbWVUeXBlID0gKF9iID0gb2JqZWN0LmdhbWVUeXBlKSAhPT0gbnVsbCAmJiBfYiAhPT0gdm9pZCAwID8gX2IgOiAwO1xuICAgICAgICBtZXNzYWdlLnRpY2tldERhdGEgPSAoX2MgPSBvYmplY3QudGlja2V0RGF0YSkgIT09IG51bGwgJiYgX2MgIT09IHZvaWQgMCA/IF9jIDogXCJcIjtcbiAgICAgICAgbWVzc2FnZS5jbGllbnRWZXJzaW9uID0gKF9kID0gb2JqZWN0LmNsaWVudFZlcnNpb24pICE9PSBudWxsICYmIF9kICE9PSB2b2lkIDAgPyBfZCA6IDA7XG4gICAgICAgIG1lc3NhZ2UudG91cm5hbWVudE1hdGNoID1cbiAgICAgICAgICAgIG9iamVjdC50b3VybmFtZW50TWF0Y2ggIT09IHVuZGVmaW5lZCAmJiBvYmplY3QudG91cm5hbWVudE1hdGNoICE9PSBudWxsXG4gICAgICAgICAgICAgICAgPyBleHBvcnRzLlRvdXJuYW1lbnRNYXRjaFNldHVwLmZyb21QYXJ0aWFsKG9iamVjdC50b3VybmFtZW50TWF0Y2gpXG4gICAgICAgICAgICAgICAgOiB1bmRlZmluZWQ7XG4gICAgICAgIG1lc3NhZ2UucHJpbWVPbmx5ID0gKF9lID0gb2JqZWN0LnByaW1lT25seSkgIT09IG51bGwgJiYgX2UgIT09IHZvaWQgMCA/IF9lIDogZmFsc2U7XG4gICAgICAgIG1lc3NhZ2UudHZDb250cm9sID0gKF9mID0gb2JqZWN0LnR2Q29udHJvbCkgIT09IG51bGwgJiYgX2YgIT09IHZvaWQgMCA/IF9mIDogMDtcbiAgICAgICAgbWVzc2FnZS5sb2JieUlkID1cbiAgICAgICAgICAgIG9iamVjdC5sb2JieUlkICE9PSB1bmRlZmluZWQgJiYgb2JqZWN0LmxvYmJ5SWQgIT09IG51bGxcbiAgICAgICAgICAgICAgICA/IExvbmcuZnJvbVZhbHVlKG9iamVjdC5sb2JieUlkKVxuICAgICAgICAgICAgICAgIDogTG9uZy5VWkVST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gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNNc2dHQ0NTdHJpa2UxNVYyTWF0Y2htYWtpbmdDbGllbnQyU2VydmVyUGluZygpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZ2FtZXNlcnZlcnBpbmdzLnB1c2goZXhwb3J0cy5HYW1lU2VydmVyUGluZy5kZWNvZGUocmVhZGVyLCByZWFkZXIudWludDMyKCkpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm9mZnNldEluZGV4ID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5maW5hbEJhdGNoID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5kYXRhQ2VudGVyUGluZ3MucHVzaChleHBvcnRzLkRhdGFDZW50ZXJQaW5nLmRlY29kZShyZWFkZXIsIHJlYWRlci51aW50MzIoKSkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubWF4U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QsXG4gICAgICAgIG5vdGVzOiBbXSxcbiAgICAgICAgcGVuYWx0eUFjY291bnRJZFNlc3Npb25zR3JlZW46IFtdLFxuICAgICAgICBpbnN1ZmZpY2llbnRsZXZlbFNlc3Npb25zOiBbXSxcbiAgICAgICAgdnNuY2hlY2tBY2NvdW50SWRTZXNzaW9uczogW10sXG4gICAgICAgIGxhdW5jaGVyTWlzbWF0Y2hTZXNzaW9uczogW10sXG4gICAgICAgIGluc2VjdXJlQWNjb3VudElkU2Vzc2lvbnM6IFtdXG4gICAgfTtcbn1cbmV4cG9ydHMuQ01zZ0dDQ1N0cmlrZTE1VjJNYXRjaG1ha2luZ0dDMkNsaWVudFVwZGF0ZSA9IHtcbiAgICBlbmNvZGUobWVzc2FnZSwgd3JpdGVyID0gbWluaW1hbF8xLldyaXRlci5jcmVhdGUoKSkge1xuICAgICAgICBpZiAobWVzc2FnZS5tYXRjaG1ha2luZyAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig4KS5pbnQzMihtZXNzYWdlLm1hdGNobWFraW5nKTtcbiAgICAgICAgfVxuICAgICAgICB3cml0ZXIudWludDMyKDE4KS5mb3JrKCk7XG4gICAgICAgIGZvciAoY29uc3QgdiBvZiBtZXNzYWdlLndhaXRpbmdBY2NvdW50SWRTZXNzaW9ucykge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMih2KTtcbiAgICAgICAgfVxuICAgICAgICB3cml0ZXIubGRlbGltKCk7XG4gICAgICAgIGlmIChtZXNzYWdlLmVycm9yICE9PSBcIlwiKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDI2KS5zdHJpbmcobWVzc2FnZS5lcnJvcik7XG4gICAgICAgIH1cbiAgICAgICAgd3JpdGVyLnVpbnQzMig1MCkuZm9yaygpO1xuICAgICAgICBmb3IgKGNvbnN0IHYgb2YgbWVzc2FnZS5vbmdvaW5nbWF0Y2hBY2NvdW50SWRTZXNzaW9ucykge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMih2KTtcbiAgICAgICAgfVxuICAgICAgICB3cml0ZXIubGRlbGltKCk7XG4gICAgICAgIGlmIChtZXNzYWdlLmdsb2JhbFN0YXRzICE9PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgIGV4cG9ydHMuR2xvYmFsU3RhdGlzdGljcy5lbmNvZGUobWVzc2FnZS5nbG9iYWxTdGF0cywgd3JpdGVyLnVpbnQzMig1OCkuZm9yaygpKS5sZGVsaW0oKTtcbiAgICAgICAgfVxuICAgICAgICB3cml0ZXIudWludDMyKDY2KS5mb3JrKCk7XG4gICAgICAgIGZvciAoY29uc3QgdiBvZiBtZXNzYWdlLmZhaWxwaW5nQWNjb3VudElkU2Vzc2lvbnMpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIodik7XG4gICAgICAgIH1cbiAgICAgICAgd3JpdGVyLmxkZWxpbSgpO1xuICAgICAgICB3cml0ZXIudWludDMyKDc0KS5mb3JrKCk7XG4gICAgICAgIGZvciAoY29uc3QgdiBvZiBtZXNzYWdlLnBlbmFsdHlBY2NvdW50SWRTZXNzaW9ucykge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMih2KTtcbiAgICAgICAgfVxuICAgICAgICB3cml0ZXIubGRlbGltKCk7XG4gICAgICAgIHdyaXRlci51aW50MzIoODIpLmZvcmsoKTtcbiAgICAgICAgZm9yIChjb25zdCB2IG9mIG1lc3NhZ2UuZmFpbHJlYWR5QWNjb3VudElkU2Vzc2lvbnMpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIodik7XG4gICAgICAgIH1cbiAgICAgICAgd3JpdGVyLmxkZWxpbSgpO1xuICAgICAgICB3cml0ZXIudWludDMyKDkwKS5mb3JrKCk7XG4gICAgICAgIGZvciAoY29uc3QgdiBvZiBtZXNzYWdlLnZhY2Jhbm5lZEFjY291bnRJZFNlc3Npb25zKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKHYpO1xuICAgICAgICB9XG4g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gIH1cbiAgICAgICAgd3JpdGVyLmxkZWxpbSgpO1xuICAgICAgICB3cml0ZXIudWludDMyKDEzOCkuZm9yaygpO1xuICAgICAgICBmb3IgKGNvbnN0IHYgb2YgbWVzc2FnZS5sYXVuY2hlck1pc21hdGNoU2Vzc2lvbnMpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIodik7XG4gICAgICAgIH1cbiAgICAgICAgd3JpdGVyLmxkZWxpbSgpO1xuICAgICAgICB3cml0ZXIudWludDMyKDE0NikuZm9yaygpO1xuICAgICAgICBmb3IgKGNvbnN0IHYgb2YgbWVzc2FnZS5pbnNlY3VyZUFjY291bnRJZFNlc3Npb25zKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKHYpO1xuICAgICAgICB9XG4gICAgICAgIHdyaXRlci5sZGVsaW0oKTtcbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMk1hdGNobWFraW5nR0MyQ2xpZW50VXBkYXRlKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5tYXRjaG1ha2luZyA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIGlmICgodGFnICYgNykgPT09IDIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGVuZDIgPSByZWFkZXIudWludDMyKCkgKyByZWFkZXIucG9zO1xuICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS53YWl0aW5nQWNjb3VudElkU2Vzc2lvbnMucHVzaChyZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS53YWl0aW5nQWNjb3VudElkU2Vzc2lvbnMucHVzaChyZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5lcnJvciA9IHJlYWRlci5zdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA2OlxuICAgICAgICAgICAgICAgICAgICBpZiAoKHRhZyAmIDcpID09PSAyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBlbmQyID0gcmVhZGVyLnVpbnQzMigpICsgcmVhZGVyLnBvcztcbiAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uub25nb2luZ21hdGNoQWNjb3VudElkU2Vzc2lvbnMucHVzaChyZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5vbmdvaW5nbWF0Y2hBY2NvdW50SWRTZXNzaW9ucy5wdXNoKHJlYWRlci51aW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA3OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmdsb2JhbFN0YXRzID0gZXhwb3J0cy5HbG9iYWxTdGF0aXN0aWNzLmRlY29kZShyZWFkZXIsIHJlYWRlci51aW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgODpcbiAgICAgICAgICAgICAgICAgICAgaWYgKCh0YWcgJiA3KSA9PT0gMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZW5kMiA9IHJlYWRlci51aW50MzIoKSArIHJlYWRlci5wb3M7XG4gICAgICAgICAgICAgICAgICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZDIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmZhaWxwaW5nQWNjb3VudElkU2Vzc2lvbnMucHVzaChyZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5mYWlscGluZ0FjY291bnRJZFNlc3Npb25zLnB1c2gocmVhZGVyLnVpbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDk6XG4gICAgICAgICAgICAgICAgICAgIGlmICgodGFnICYgNykgPT09IDIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGVuZDIgPSByZWFkZXIudWludDMyKCkgKyByZWFkZXIucG9zO1xuICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5wZW5hbHR5QWNjb3VudElkU2Vzc2lvbnMucHVzaChyZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5wZW5hbHR5QWNjb3VudElkU2Vzc2lvbnMucHVzaChyZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTA6XG4gICAgICAgICAgICAgICAgICAgIGlmICgodGFnICYgNykgPT09IDIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGVuZDIgPSByZWFkZXIudWludDMyKCkgKyByZWFkZXIucG9zO1xuICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5mYWlscmVhZHlBY2NvdW50SWRTZXNzaW9ucy5wdXNoKHJlYWRlci51aW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmZhaWxyZWFkeUFjY291bnRJZFNlc3Npb25zLnB1c2gocmVhZGVyLnVpbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDExOlxuICAgICAgICAgICAgICAgICAgICBpZiAoKHRhZyAmIDcpID09PSAyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBlbmQyID0gcmVhZGVyLnVpbnQzMigpICsgcmVhZGVyLnBvcztcbiAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudmFjYmFubmVkQWNjb3VudElkU2Vzc2lvbnMucHVzaChyZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS52YWNiYW5uZWRBY2NvdW50SWRTZXNzaW9ucy5wdXNoKHJlYWRlci51aW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zZXJ2ZXJJcGFkZHJlc3NNYXNrID0gZXhwb3J0cy5JcEFkZHJlc3NNYXNrLmRlY29kZShyZWFkZXIsIHJlYWRlci51aW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uubm90ZXMucHVzaChleHBvcnRzLkNNc2dHQ0NTdHJpa2UxNVYyTWF0Y2htYWtpbmdHQzJDbGllbnRVcGRhdGVfTm90ZS5kZWNvZGUocmVhZGVyLCByZWFkZXIudWludDMyKCkpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxNDpcbiAgICAgICAgICAgICAgICAgICAgaWYgKCh0YWcgJiA3KSA9PT0gMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZW5kMiA9IHJlYWRlci51aW50MzIoKSArIHJlYWRlci5wb3M7XG4gICAgICAgICAgICAgICAgICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZDIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnBlbmFsdHlBY2NvdW50SWRTZXNzaW9uc0dyZWVuLnB1c2gocmVhZGVyLnVpbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucGVuYWx0eUFjY291bnRJZFNlc3Npb25zR3JlZW4ucHVzaChyZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTU6XG4gICAgICAgICAgICAgICAgICAgIGlmICgodGFnICYgNykgPT09IDIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGVuZDIgPSByZWFkZXIudWludDMyKCkgKyByZWFkZXIucG9zO1xuICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5pbnN1ZmZpY2llbnRsZXZlbFNlc3Npb25zLnB1c2gocmVhZGVyLnVpbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuaW5zdWZmaWNpZW50bGV2ZWxTZXNzaW9ucy5wdXNoKHJlYWRlci51aW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxNjpcbiAgICAgICAgICAgICAgICAgICAgaWYgKCh0YWcgJiA3KSA9PT0gMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZW5kMiA9IHJlYWRlci51aW50MzIoKSArIHJlYWRlci5wb3M7XG4gICAgICAgICAgICAgICAgICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZDIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnZzbmNoZWNrQWNjb3VudElkU2Vzc2lvbnMucHVzaChyZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS52c25jaGVja0FjY291bnRJZFNlc3Npb25zLnB1c2gocmVhZGVyLnVpbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDE3OlxuICAgICAgICAgICAgICAgICAgICBpZiAoKHRhZyAmIDcpID09PSAyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBlbmQyID0gcmVhZGVyLnVpbnQzMigpICsgcmVhZGVyLnBvcztcbiAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubGF1bmNoZXJNaXNtYXRjaFNlc3Npb25zLnB1c2gocmVhZGVyLnVpbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubGF1bmNoZXJNaXNtYXRjaFNlc3Npb25zLnB1c2gocmVhZGVyLnVpbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDE4OlxuICAgICAgICAgICAgICAgICAgICBpZiAoKHRhZyAmIDcpID09PSAyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBlbmQyID0gcmVhZGVyLnVpbnQzMigpICsgcmVhZGVyLnBvcztcbiAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuaW5zZWN1cmVBY2NvdW50SWRTZXNzaW9ucy5wdXNoKHJlYWRlci51aW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmluc2VjdXJlQWNjb3VudElkU2Vzc2lvbnMucHVzaChyZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCBfYiwgX2MsIF9kLCBfZSwgX2YsIF9nLCBfaCwgX2osIF9rLCBfbCwgX20sIF9vLCBfcDtcb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biAgICAgICAgICAgIHdyaXRlci51aW50MzIoMzcpLmZsb2F0KG1lc3NhZ2UuZGlzdGFuY2UpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiB3cml0ZXI7XG4gICAgfSxcbiAgICBkZWNvZGUoaW5wdXQsIGxlbmd0aCkge1xuICAgICAgICBjb25zdCByZWFkZXIgPSBpbnB1dCBpbnN0YW5jZW9mIG1pbmltYWxfMS5SZWFkZXIgPyBpbnB1dCA6IG5ldyBtaW5pbWFsXzEuUmVhZGVyKGlucHV0KTtcbiAgICAgICAgbGV0IGVuZCA9IGxlbmd0aCA9PT0gdW5kZWZpbmVkID8gcmVhZGVyLmxlbiA6IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ01zZ0dDQ1N0cmlrZTE1VjJNYXRjaG1ha2luZ0dDMkNsaWVudFVwZGF0ZV9Ob3RlKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50eXBlID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5yZWdpb25JZCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucmVnaW9uUiA9IHJlYWRlci5mbG9hdCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDQ6XG4gICA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R1cm4ge1xuICAgICAgICBldmVudElkOiAwLFxuICAgICAgICBldmVudFN0YWdlSWQ6IDAsXG4gICAgICAgIHRlYW1JZDA6IDAsXG4gICAgICAgIHRlYW1JZDE6IDAsXG4gICAgICAgIG1hcHNDb3VudDogMCxcbiAgICAgICAgbWFwc0N1cnJlbnQ6IDAsXG4gICAgICAgIHRlYW1JZFN0YXJ0OiAwLFxuICAgICAgICB0ZWFtSWRWZXRvMTogMCxcbiAgICAgICAgdGVhbUlkUGlja246IDAsXG4gICAgICAgIGRyYWZ0czogW11cbiAgICB9O1xufVxuZXhwb3J0cy5DRGF0YUdDQ1N0cmlrZTE1VjJUb3VybmFtZW50TWF0Y2hEcmFmdCA9IHtcbiAgICBlbmNvZGUobWVzc2FnZSwgd3JpdGVyID0gbWluaW1hbF8xLldyaXRlci5jcmVhdGUoKSkge1xuICAgICAgICBpZiAobWVzc2FnZS5ldmVudElkICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDgpLmludDMyKG1lc3NhZ2UuZXZlbnRJZCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuZXZlbnRTdGFnZUlkICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDE2KS5pbnQzMihtZXNzYWdlLmV2ZW50U3RhZ2VJZCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UudGVhbUlkMCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigyNCkuaW50MzIobWVzc2FnZS50ZWFtSWQwKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS50ZWFtSWQxICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDMyKS5pbnQzMihtZXNzYWdlLnRlYW1JZDEpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLm1hcHNDb3VudCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVp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ID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDRGF0YUdDQ1N0cmlrZTE1VjJUb3VybmFtZW50TWF0Y2hEcmFmdCgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZXZlbnRJZCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZXZlbnRTdGFnZUlkID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50ZWFtSWQwID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50ZWFtSWQxID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5tYXBzQ291bnQgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA2OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm1hcHNDdXJyZW50ID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50ZWFtSWRTdGFydCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDg6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudGVhbUlkVmV0bzEgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA5OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnRlYW1JZFBpY2tuID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTA6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZHJhZnRzLnB1c2goZXhwb3J0cy5DRGF0YUdDQ1N0cmlrZTE1VjJUb3VybmFtZW50TWF0Y2hEcmFmdF9FbnRyeS5kZWNvZGUocmVhZGVyLCByZWFkZXIudWludDMyKCkpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iLCBfYywgX2QsIF9lLCBfZiwgX2csIF9oLCBfaiwgX2s7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ0RhdGFHQ0NTdHJpa2UxNVYyVG91cm5hbWVudE1hdGNoRHJhZnQoKTtcbiAgICAgIC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mluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDRGF0YUdDQ1N0cmlrZTE1VjJUb3VybmFtZW50TWF0Y2hEcmFmdF9FbnRyeSgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubWFwaWQgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnRlYW1JZEN0ID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCBfYjtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDRGF0YUdDQ1N0cmlrZTE1VjJUb3VybmFtZW50TWF0Y2hEcmFmdF9FbnRyeSgpO1xuICAgICAgICBtZXNzYWdlLm1hcGlkID0gKF9hID0gb2JqZWN0Lm1hcGlkKSAhPT0gbnVsbCAmJiBfYSAhPT0gdm9pZCAwID8gX2EgOiAwO1xuICAgICAgICBtZXNzYWdlLnRlYW1JZE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ICAgICAgICAgd3JpdGVyLmludDMyKHYpO1xuICAgICAgICB9XG4gICAgICAgIHdyaXRlci5sZGVsaW0oKTtcbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDUHJlTWF0Y2hJbmZvRGF0YSgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucHJlZGljdGlvbnNQY3QgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmRyYWZ0ID0gZXhwb3J0cy5DRGF0YUdDQ1N0cmlrZTE1VjJUb3VybmFtZW50TWF0Y2hEcmFmdC5kZWNvZGUocmVhZGVyLCByZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc3RhdHMucHVzaChleHBvcnRzLkNQcmVNYXRjaEluZm9EYXRhX1RlYW1TdGF0cy5kZWNvZGUocmVhZGVyLCByZWFkZXIudWludDMyKCkpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA2OlxuICAgICAgICAgICAgICAgICAgICBpZiAoKHRhZyAmIDcpID09PSAyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBlbmQyID0gcmVhZGVyLnVpbnQzMigpICsgcmVhZGVyLnBvcztcbiAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uud2lucy5wdXNoKHJlYWRlci5pbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uud2lucy5wdXNoKHJlYWRlci5pbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2IsIF9jO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNQcmVNYXRjaEluZm9EYXRhKCk7XG4gICAgICAgIG1lc3NhZ2UucHJlZGljdGlvbnNQY3QgPSAoX2EgPSBvYmplY3QucHJlZGljdGlvbnNQY3QpICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6IDA7XG4gICAgICAgIG1lc3NhZ2U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7XG4gICAgICAgIH1cbiAgICAgICAgd3JpdGVyLmxkZWxpbSgpO1xuICAgICAgICBpZiAobWVzc2FnZS5nYW1lVHlwZSAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigxNikudWludDMyKG1lc3NhZ2UuZ2FtZVR5cGUpO1xuICAgICAgICB9XG4gICAgICAgIGlmICghbWVzc2FnZS5tYXRjaElkLmlzWmVybygpKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDI0KS51aW50NjQobWVzc2FnZS5tYXRjaElkKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5zZXJ2ZXJWZXJzaW9uICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDMyKS51aW50MzIobWVzc2FnZS5zZXJ2ZXJWZXJzaW9uKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5mbGFncyAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigxNDQpLnVpbnQzMihtZXNzYWdlLmZsYWdzKTtcbiAgICAgICAgfVxuICAgICAgICBmb3IgKGNvbnN0IHYgb2YgbWVzc2FnZS5yYW5raW5ncykge1xuICAgICAgICAgICAgZXhwb3J0cy5QbGF5ZXJSYW5raW5nSW5mby5lbmNvZGUodiwgd3JpdGVyLnVpbnQzMig0MikuZm9yaygpKS5sZGVsaW0oKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAoIW1lc3NhZ2UuZW5jcnlwdGlvbktleS5pc1plcm8oKSkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig0OCkudWludDY0KG1lc3NhZ2UuZW5jcnlwdGlvbktleSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKCFtZXNzYWdlLmVuY3J5cHRpb25LZXlQdWIuaXNaZXJvKCkpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNTYpLnVpbnQ2NChtZXNzYWdlLmVuY3J5cHRpb25LZXlQdWIpO1xuICAgICAgICB9XG4gICAgICAgIHdyaXRlci51aW50MzIoNjYpLmZvcmsoKTtcbiAgICAgICAgZm9yIChjb25zdCB2IG9mIG1lc3NhZ2UucGFydHlJZHMpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIodik7XG4gICAgICAgIH1cbiAgICAgICAgd3JpdGVyLmxkZWxpbSgpO1xuICAgICAgICBmb3IgKGNvbnN0IHYgb2YgbWVzc2FnZS53aGl0ZWxpc3QpIHtcbiAgICAgICAgICAgIGV4cG9ydHMuSXBBZGRyZXNzTWFzay5lbmNvZGUodiwgd3JpdGVyLnVpbnQzMig3NCkuZm9yaygpKS5sZGVsaW0oKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAoIW1lc3NhZ2UudHZNYXN0ZXJTdGVhbWlkLmlzWmVybygpKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDgwKS51aW50NjQobWVzc2FnZS50dk1hc3RlclN0ZWFtaWQpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnRvdXJuYW1lbnRFdmVudCAhPT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgICBleHBvcnRzLlRvdXJuYW1lbnRFdmVudC5lbmNvZGUobWVzc2FnZS50b3VybmFtZW50RXZlbnQsIHdyaXRlci51aW50MzIoOTApLmZvcmsoKSkubGRlbGltKCk7XG4gICAgICAgIH1cbiAgICAgICAgZm9yIChjb25zdCB2IG9mIG1lc3NhZ2UudG91cm5hbWVudFRlYW1zKSB7XG4gICAgICAgICAgICBleHBvcnRzLlRvdXJuYW1lbnRUZWFtLmVuY29kZSh2LCB3cml0ZXIudWludDMyKDk4KS5mb3JrKCkpLmxkZWxpbSgpO1xuICAgICAgICB9XG4gICAgICAgIHdyaXRlci51aW50MzIoMTA2KS5mb3JrKCk7XG4gICAgICAgIGZvciAoY29uc3QgdiBvZiBtZXNzYWdlLnRvdXJuYW1lbnRDYXN0ZXJzQWNjb3VudElkcykge1xuICAgICAgICAgICAg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GNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMk1hdGNobWFraW5nR0MyU2VydmVyUmVzZXJ2ZSgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIGlmICgodGFnICYgNykgPT09IDIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGVuZDIgPSByZWFkZXIudWludDMyKCkgKyByZWFkZXIucG9zO1xuICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5hY2NvdW50SWRzLnB1c2gocmVhZGVyLnVpbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuYWNjb3VudElkcy5wdXNoKHJlYWRlci51aW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmdhbWVUeXBlID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubWF0Y2hJZCA9IHJlYWRlci51aW50NjQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnNlcnZlclZlcnNpb24gPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTg6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZmxhZ3MgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5yYW5raW5ncy5wdXNoKGV4cG9ydHMuUGxheWVyUmFua2luZ0luZm8uZGVjb2RlKHJlYWRlciwgcmVhZGVyLnVpbnQzMigpKSk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5lbmNyeXB0aW9uS2V5ID0gcmVhZGVyLnVpbnQ2NCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDc6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZW5jcnlwdGlvbktleVB1YiA9IHJlYWRlci51aW50NjQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA4OlxuICAgICAgICAgICAgICAgICAgICBpZiAoKHRhZyAmIDcpID09PSAyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBlbmQyID0gcmVhZGVyLnVpbnQzMigpICsgcmVhZGVyLnBvcztcbiAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucGFydHlJZHMucHVzaChyZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5wYXJ0eUlkcy5wdXNoKHJlYWRlci51aW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA5OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLndoaXRlbGlzdC5wdXNoKGV4cG9ydHMuSXBBZGRyZXNzTWFzay5kZWNvZGUocmVhZGVyLCByZWFkZXIudWludDMyKCkpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxMDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50dk1hc3RlclN0ZWFtaWQgPSByZWFkZXIudWludDY0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudG91cm5hbWVudEV2ZW50ID0gZXhwb3J0cy5Ub3VybmFtZW50RXZlbnQuZGVjb2RlKHJlYWRlciwgcmVhZGVyLnVpbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50b3VybmFtZW50VGVhbXMucHVzaChleHBvcnRzLlRvdXJuYW1lbnRUZWFtLmRlY29kZShyZWFkZXIsIHJlYWRlci51aW50MzIoKSkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDEzOlxuICAgICAgICAgICAgICAgICAgICBpZiAoKHRhZyAmIDcpID09PSAyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBlbmQyID0gcmVhZGVyLnVpbnQzMigpICsgcmVhZGVyLnBvcztcbiAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudG91cm5hbWVudENhc3RlcnNBY2NvdW50SWRzLnB1c2gocmVhZGVyLnVpbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudG91cm5hbWVudENhc3RlcnNBY2NvdW50SWRzLnB1c2gocmVhZGVyLnVpbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDE0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnR2UmVsYXlTdGVhbWlkID0gcmVhZGVyLnVpbnQ2NCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDE1OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnByZU1hdGNoRGF0YSA9IGV4cG9ydHMuQ1ByZU1hdGNoSW5mb0RhdGEuZGVjb2RlKHJlYWRlciwgcmVhZGVyLnVpbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxNjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5ydGltZTMyRXZlbnRTdGFydCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxNzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50dkNvbnRyb2wgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZ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ICAgICBtZXNzYWdlLnJhbmtpbmdzID1cbiAgICAgICAgICAgICgoX2UgPSBvYmplY3QucmFua2luZ3MpID09PSBudWxsIHx8IF9lID09PSB2b2lkIDAgPyB2b2lkIDAgOiBfZS5tYXAoZSA9PiBleHBvcnRzLlBsYXllclJhbmtpbmdJbmZvLmZyb21QYXJ0aWFsKGUpKSkgfHwgW107XG4gICAgICAgIG1lc3NhZ2UuZW5jcnlwdGlvbktleSA9XG4gICAgICAgICAgICBvYmplY3QuZW5jcnlwdGlvbktleSAhPT0gdW5kZWZpbmVkICYmIG9iamVjdC5lbmNyeXB0aW9uS2V5ICE9PSBudWxsXG4gICAgICAgICAgICAgICAgPyBMb25nLmZyb21WYWx1ZShvYmplY3QuZW5jcnlwdGlvbktleSlcbiAgICAgICAgICAgICAgICA6IExvbmcuVVpFUk87XG4gICAgICAgIG1lc3NhZ2UuZW5jcnlwdGlvbktleVB1YiA9XG4gICAgICAgICAgICBvYmplY3QuZW5jcnlwdGlvbktleVB1YiAhPT0gdW5kZWZpbmVkICYmIG9iamVjdC5lbmNyeXB0aW9uS2V5UHViICE9PSBudWxsXG4gICAgICAgICAgICAgICAgPyBMb25nLmZyb21WYWx1ZShvYmplY3QuZW5jcnlwdGlvbktleVB1YilcbiAgICAgICAgICAgICAgICA6IExvbmcuVVpFUk87XG4gICAgICAgIG1lc3NhZ2UucGFydHlJZHMgPSAoKF9mID0gb2JqZWN0LnBhcnR5SWRzKSA9PT0gbnVsbCB8fCBfZiA9PT0gdm9pZCAwID8gdm9pZCAwIDogX2YubWFwKGUgPT4gZSkpIHx8IFtdO1xuICAgICAgICBtZXNzYWdlLndoaXRlbGlzdCA9XG4gICAgICAgICAgICAoKF9nID0gb2JqZWN0LndoaXRlbGlzdCkgPT09IG51bGwgfHwgX2cgPT09IHZvaWQgMCA/IHZvaWQgMCA6IF9nLm1hcChlID0+IGV4cG9ydHMuSXBBZGRyZXNzTWFzay5mcm9tUGFydGlhbChlKSkpIHx8IFtdO1xuICAgICAgICBtZXNzYWdlLnR2TWFzdGVyU3RlYW1pZCA9XG4gICAgICAgICAgICBvYmplY3QudHZNYXN0ZXJTdGVhbWlkICE9PSB1bmRlZmluZWQgJiYgb2JqZWN0LnR2TWFzdGVyU3RlYW1pZCAhPT0gbnVsbFxuICAgICAgICAgICAgICAgID8gTG9uZy5mcm9tVmFsdWUob2JqZWN0LnR2TWFzdGVyU3RlYW1pZClcbiAgICAgICAgICAgICAgICA6IExvbmcuVVpFUk87XG4gICAgICAgIG1lc3NhZ2UudG91cm5hbWVudEV2ZW50ID1cbiAgICAgICAgICAgIG9iamVjdC50b3VybmFtZW50RXZlbnQgIT09IHVuZGVmaW5lZCAmJiBvYmplY3QudG91cm5hbWVudEV2ZW50ICE9PSBudWxsXG4gICAgICAgICAgICAgICAgPyBleHBvcnRzLlRvdXJuYW1lbnRFdmVudC5mcm9tUGFydGlhbChvYmplY3QudG91cm5hbWVudEV2ZW50KVxuICAgICAgICAgICAgICAgIDogdW5kZWZpbmVkO1xuICAgICAgICBtZXNzYWdlLnRvdXJuYW1lbnRUZWFtcyA9XG4gICAgICAgICAgICAoKF9oID0gb2JqZWN0LnRvdXJuYW1lbnRUZWFtcykgPT09IG51bGwgfHwgX2ggPT09IHZvaWQgMCA/IHZvaWQgMCA6IF9oLm1hcChlID0+IGV4cG9ydHMuVG91cm5hbWVudFRlYW0uZnJvbVBhcnRpYWwoZSkpKSB8fCBbXTtcbiAgICAgICAgbWVzc2FnZS50b3VybmFtZW50Q2FzdGVyc0FjY291bnRJZHMgPVxuICAgICAgICAgICAgKChfaiA9IG9iamVjdC50b3VybmFtZW50Q2FzdGVyc0FjY291bnRJZHMpID09PSBudWxsIHx8IF9qID09PSB2b2lkIDAgPyB2b2lkIDAgOiBfai5tYXAoZSA9PiBlKSkgfHwgW107XG4gICAgICAgIG1lc3NhZ2UudHZSZWxheVN0ZWFtaWQgPVxuICAgICAgICAgICAgb2JqZWN0LnR2UmVsYXlTdGVhbWlkICE9PSB1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AgICBpZiAobWVzc2FnZS5tYXAgIT09IFwiXCIpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMjYpLnN0cmluZyhtZXNzYWdlLm1hcCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKCFtZXNzYWdlLmdjUmVzZXJ2YXRpb25TZW50LmlzWmVybygpKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDMyKS51aW50NjQobWVzc2FnZS5nY1Jlc2VydmF0aW9uU2VudCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2Uuc2VydmVyVmVyc2lvbiAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig0MCkudWludDMyKG1lc3NhZ2Uuc2VydmVyVmVyc2lvbik7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UudHZJbmZvICE9PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgIGV4cG9ydHMuU2VydmVySGx0dkluZm8uZW5jb2RlKG1lc3NhZ2UudHZJbmZvLCB3cml0ZXIudWludDMyKDUwKS5mb3JrKCkpLmxkZWxpbSgpO1xuICAgICAgICB9XG4gICAgICAgIHdyaXRlci51aW50MzIoNTgpLmZvcmsoKTtcbiAgICAgICAgZm9yIChjb25zdCB2IG9mIG1lc3NhZ2UucmV3YXJkUGxheWVyQWNjb3VudHMpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIodik7XG4gICAgICAgIH1cbiAgICAgICAgd3JpdGVyLmxkZWxpbSgpO1xuICAgICAgICB3cml0ZXIudWludDMyKDY2KS5mb3JrKCk7XG4gICAgICAgIGZvciAoY29uc3QgdiBvZiBtZXNzYWdlLmlkbGVQbGF5ZXJBY2NvdW50cykge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMih2KTtcbiAgICAgICAgfVxuICAgICAgICB3cml0ZXIubGRlbGltKCk7XG4gICAgICAgIGlmIChtZXNzYWdlLnJld2FyZEl0ZW1BdHRyRGVmSW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YWdyYW1Sb3V0aW5nKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS50ZXN0VG9rZW4gIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTI1KS5maXhlZDMyKG1lc3NhZ2UudGVzdFRva2VuKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5mbGFncyAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigxMjgpLnVpbnQzMihtZXNzYWdlLmZsYWdzKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNNc2dHQ0NTdHJpa2UxNVYyTWF0Y2htYWtpbmdTZXJ2ZXJSZXNlcnZhdGlvblJlc3BvbnNlKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5yZXNlcnZhdGlvbmlkID0gcmVhZGVyLnVpbnQ2NCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucmVzZXJ2YXRpb24gPSBleHBvcnRzLkNNc2dHQ0NTdHJpa2UxNVYyTWF0Y2htYWtpbmdHQzJTZXJ2ZXJSZXNlcnZlLmRlY29kZShyZWFkZXIsIHJlYWRlci51aW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5tYXAgPSByZWFkZXIuc3RyaW5nKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5nY1Jlc2VydmF0aW9uU2VudCA9IHJlYWRlci51aW50NjQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA1OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnNlcnZlclZlcnNpb24gPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50dkluZm8gPSBleHBvcnRzLlNlcnZlckhsdHZJbmZvLmRlY29kZShyZWFkZXIsIHJlYWRlci51aW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNzpcbiAgICAgICAgICAgICAgICAgICAgaWYgKCh0YWcgJiA3KSA9PT0gMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZW5kMiA9IHJlYWRlci51aW50MzIoKSArIHJlYWRlci5wb3M7XG4gICAgICAgICAgICAgICAgICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZDIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnJld2FyZFBsYXllckFjY291bnRzLnB1c2gocmVhZGVyLnVpbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucmV3YXJkUGxheWVyQWNjb3VudHMucHVzaChyZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgODpcbiAgICAgICAgICAgICAgICAgICAgaWYgKCh0YWcgJiA3KSA9PT0gMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZW5kMiA9IHJlYWRlci51aW50MzIoKSArIHJlYWRlci5wb3M7XG4gICAgICAgICAgICAgICAgICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZDIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmlkbGVQbGF5ZXJBY2NvdW50cy5wdXNoKHJlYWRlci51aW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmlkbGVQbGF5ZXJBY2NvdW50cy5wdXNoKHJlYWRlci51aW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA5OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnJld2FyZEl0ZW1BdHRyRGVmSWR4ID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDEwOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnJld2FyZEl0ZW1BdHRyVmFsdWUgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucmV3YXJkSXRlbUF0dHJSZXdhcmRJZHggPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucmV3YXJkRHJvcExpc3QgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudG91cm5hbWVudFRhZyA9IHJlYWRlci5zdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5sZWdhY3lTdGVhbWRhdGFncmFtUG9ydCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxNzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zdGVhbWRhdGFncmFtUm91dGluZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxNTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50ZXN0VG9rZW4gPSByZWFkZXIuZml4ZWQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDE2OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmZsYWdzID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICA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XNlQ01zZ0dDQ1N0cmlrZTE1VjJNYXRjaG1ha2luZ0dDMkNsaWVudFJlc2VydmUoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnNlcnZlcmlkID0gcmVhZGVyLnVpbnQ2NCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZGlyZWN0VWRwSXAgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5kaXJlY3RVZHBQb3J0ID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucmVzZXJ2YXRpb25pZCA9IHJlYWRlci51aW50NjQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA1OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnJlc2VydmF0aW9uID0gZXhwb3J0cy5DTXNnR0NDU3RyaWtlMTVWMk1hdGNobWFraW5nR0MyU2VydmVyUmVzZXJ2ZS5kZWNvZGUocmVhZGVyLCByZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDY6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubWFwID0gcmVhZGVyLnN0cmluZygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDc6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc2VydmVyQWRkcmVzcyA9IHJlYWRlci5zdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iLCBfYywgX2Q7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ01zZ0dDQ1N0cmlrZTE1VjJNYXRjaG1ha2luZ0dDMkNsaWVudFJlc2VydmUoKTtcbiAgICAgICAgbWVzc2FnZS5zZXJ2ZXJpZCA9XG4gICAgICAgICAgICBvYmplY3Quc2VydmVyaWQgIT09IHVuZGVmaW5lZCAmJiBvYmplY3Quc2VydmVyaWQgIT09IG51bGxcbiAgICAgICAgICAgICAgICA/IExvbmcuZnJvbVZhbHVlKG9iamVjdC5zZXJ2ZXJpZClcbiAgICAgICAgICAgICAgICA6IExvbmcuVVpFUk87XG4gICAgICAgIG1lc3NhZ2UuZGlyZWN0VWRwSXAgPSAoX2EgPSBvYmplY3QuZGlyZWN0VWRwSXApICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6IDA7XG4gICAgICAgIG1lc3NhZ2UuZGlyZWN0VWRwUG9ydCA9IChfYiA9IG9iamVjdC5kaXJlY3RVZHBQb3J0KSAhPT0gbnVsbCAmJiBfYiAhPT0gdm9pZCAwID8gX2IgOiAwO1xuICAgICAgICBtZXNzYWdlLnJlc2VydmF0aW9uaW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9uaWQuaXNaZXJvKCkpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoOCkudWludDY0KG1lc3NhZ2UucmVzZXJ2YXRpb25pZCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UucmVzZXJ2YXRpb24gIT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgZXhwb3J0cy5DTXNnR0NDU3RyaWtlMTVWMk1hdGNobWFraW5nR0MyU2VydmVyUmVzZXJ2ZS5lbmNvZGUobWVzc2FnZS5yZXNlcnZhdGlvbiwgd3JpdGVyLnVpbnQzMigxOCkuZm9yaygpKS5sZGVsaW0oKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5tYXAgIT09IFwiXCIpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMjYpLnN0cmluZyhtZXNzYWdlLm1hcCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2Uucm91bmQgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMzIpLmludDMyKG1lc3NhZ2Uucm91bmQpO1xuICAgICAgICB9XG4gICAgICAgIHdyaXRlci51aW50MzIoNDIpLmZvcmsoKTtcbiAgICAgICAgZm9yIChjb25zdCB2IG9mIG1lc3NhZ2Uua2lsbHMpIHtcbiAgICAgICAgICAgIHdyaXRlci5pbnQzMih2KTtcbiAgICAgICAgfVxuICAgICAgICB3cml0ZXIubGRlbGltKCk7XG4gICAgICAgIHdyaXRlci51aW50MzIoNTApLmZvcmsoKTtcbiAgICAgICAgZm9yIChjb25zdCB2IG9mIG1lc3NhZ2UuYXNzaXN0cykge1xuICAgICAgICAgICAgd3JpdGVyLmludDMyKHYpO1xuICAgICAgICB9XG4gICAgICAgIHdyaXRlci5sZGVsaW0oKTtcbiAgICAgICAgd3JpdGVyLnVpbnQzMig1OCkuZm9yaygpO1xuICAgICAgICBmb3IgKGNvbnN0IHYgb2YgbWVzc2FnZS5kZWF0aHMpIHtcbiAgICAgICAgICAgIHdyaXRlci5pbnQzMih2KTtcbiAgICAgICAgfVxuICAgICAgICB3cml0ZXIubGRlbGltKCk7XG4gICAgICAgIHdyaXRlci51aW50MzIoNjYpLmZvcmsoKTtcbiAgICAgICAgZm9yIChjb25zdCB2IG9mIG1lc3NhZ2Uuc2NvcmVzKSB7XG4gICAgICAgICAgICB3cml0ZXIuaW50MzIodik7XG4gICAgICAgIH1cbiAgICAgICAgd3JpdGVyLmxkZWxpbSgpO1xuICAgICAgICB3cml0ZXIudWludDMyKDc0KS5mb3JrKCk7XG4gICAgICAgIGZvciAoY29uc3QgdiBvZiBtZXNzYWdlLnBpbmdzKSB7XG4gICAgICAgICAgICB3cml0ZXIuaW50MzIodik7XG4gICAgICAgIH1cbiAgICAgICAgd3JpdGVyLmxkZWxpbSgpO1xuICAgICAgICBpZiAobWVzc2FnZS5yb3VuZFJlc3VsdCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig4MCkuaW50MzIobWVzc2FnZS5yb3VuZFJlc3VsdCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UubWF0Y2hSZXN1bHQgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoODgpLmludDMyKG1lc3NhZ2UubWF0Y2hSZXN1bHQpO1xuICAgICAgICB9XG4gICAgICAgIHdyaXRlci51aW50MzIoOTgpLmZvcmsoKTtcbiAgICAgICAgZm9yIChjb25zdCB2IG9mIG1lc3NhZ2UudGVhbVNjb3Jlcykge1xuICAgICAgICAgICAgd3JpdGVyLmludDMyKHYpO1xuICAgICAgICB9XG4gICAgICAgIHdyaXRlci5sZGVsaW0oKTtcbiAgICAgICAgaWYgKG1lc3NhZ2UuY29uZmlybSAhPT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgICBleHBvcnRzLkNNc2dHQ0NTdHJpa2UxNVYyTWF0Y2htYWtpbmdHQzJTZXJ2ZXJDb25maXJtLmVuY29kZShtZXNzYWdlLmNvbmZpcm0sIHdyaXRlci51aW50MzIoMTA2KS5mb3JrKCkpLmxkZWxpbSgpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnJlc2VydmF0aW9uU3RhZ2UgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTEyKS5pbnQzMihtZXNzYWdlLnJlc2VydmF0aW9uU3RhZ2UpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLm1hdGNoRHVyYXRpb24gIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTIwKS5pbnQzMihtZXNzYWdlLm1hdGNoRHVyYXRpb24pO1xuICAgICAgICB9XG4gICAgICAgIHdyaXRlci51aW50MzIoMTMwKS5mb3JrKCk7XG4gICAgICAgIGZvciAoY29uc3QgdiBvZiBtZXNzYWdlLmVuZW15S2lsbHMpIHtcbiAgICAgICAgICAgIHdyaXRlci5pbnQzMih2KTtcbiAgICAgICAgfVxuICAgICAgICB3cml0ZXIubGRlbGltKCk7XG4gICAgICAgIHdyaXRlci51aW50MzIoMTM4KS5mb3JrKCk7XG4gICAgICAgIGZvciAoY29uc3QgdiBvZiBtZXNzYWdlLmVuZW15SGVhZHNob3RzKSB7XG4gICAgICAgICAgICB3cml0ZXIuaW50MzIodik7XG4gICAgICAgIH1cbiAgICAgICAgd3JpdGVyLmxkZWxpbSgpO1xuICAgICAgICB3cml0ZXIudWludDMyKDE0NikuZm9yaygpO1xuICAgICAgICBmb3IgKGNvbnN0IHYgb2YgbWVzc2FnZS5lbmVteTNrcykge1xuICAgICAgICAgICAgd3JpdGVyLmludDMyKHYpO1xuICAgICAgICB9XG4gICAgICAgIHdyaXRlci5sZGVsaW0oKTtcbiAgICAgICAgd3JpdGVyLnVpbnQzMigxNTQpLmZvcmsoKTtcbiAgICAgICAgZm9yIChjb25zdCB2IG9mIG1lc3NhZ2UuZW5lbXk0a3MpIHtcbiAgICAgICAgICAgIHdyaXRlci5pbnQzMih2KTtcbiAgICAgICAgfVxuICAgICAgICB3cml0ZXIubGRlbGltKCk7XG4gICAgICAgIHdyaXRlci51aW50MzIoMTYyKS5mb3JrKCk7XG4gICAgICAgIGZvciAoY29uc3QgdiBvZiBtZXNzYWdlLmVuZW15NWtzKSB7XG4gICAgICAgICAgICB3cml0ZXIuaW50MzIodik7XG4gICAgICAgIH1cbiAgICAgICAgd3JpdGVyLmxkZWxpbSgpO1xuICAgICAgICB3cml0ZXIudWludDMyKDE3MCkuZm9yaygpO1xuICAgICAgICBmb3IgKGNvbnN0IHYgb2YgbWVzc2FnZS5tdnBzKSB7XG4gICAgICAgICAgICB3cml0ZXIuaW50MzIodik7XG4gICAgICAgIH1cbiAgICAgICAgd3JpdGVyLmxkZWxpbSgpO1xuICAgICAgICBpZiAobWVzc2FnZS5zcGVjdGF0b3JzQ291bnQgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTc2KS51aW50MzIobWVzc2FnZS5zcGVjdGF0b3JzQ291bnQpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnNwZWN0YXRvcnNDb3VudFR2ICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDE4NCkudWludDMyKG1lc3NhZ2Uuc3BlY3RhdG9yc0NvdW50VHYpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnNwZWN0YXRvcnNDb3VudExuayAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigxOTIpLnVpbnQzMihtZXNzYWdlLnNwZWN0YXRvcnNDb3VudExuayk7XG4gICAgICAgIH1cbiAgICAgICAgd3JpdGVyLnVpbnQzMigyMDIpLmZvcmsoKTtcbiAgICAgICAgZm9yIChjb25zdCB2IG9mIG1lc3NhZ2UuZW5lbXlLaWxsc0FnZykge1xuICAgICAgICAgICAgd3JpdGVyLmludDMyKHYpO1xuICAgICAgICB9XG4gICAgICAgIHdyaXRlci5sZGVsaW0oKTtcbiAgICAgICAgaWYgKG1lc3NhZ2UuZHJvcEluZm8gIT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgZXhwb3J0cy5DTXNnR0NDU3RyaWtlMTVWMk1hdGNobWFraW5nU2VydmVyUm91bmRTdGF0c19Ecm9wSW5mby5lbmNvZGUobWVzc2FnZS5kcm9wSW5mbywgd3JpdGVyLnVpbnQzMigyMTApLmZvcmsoKSkubGRlbGltKCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuYlN3aXRjaGVkVGVhbXMgPT09IHRydWUpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMjE2KS5ib29sKG1lc3NhZ2UuYlN3aXRjaGVkVGVhbXMpO1xuICAgICAgICB9XG4gICAgICAgIHdyaXRlci51aW50MzIoMjI2KS5mb3JrKCk7XG4gICAgICAgIGZvciAoY29uc3QgdiBvZiBtZXNzYWdlLmVuZW15MmtzKSB7XG4gICAgICAgICAgICB3cml0ZXIuaW50MzIodik7XG4gICAgICAgIH1cbiAgICAgICAgd3JpdGVyLmxkZWxpbSgpO1xuICAgICAgICB3cml0ZXIudWludDMyKDIzNCkuZm9yaygpO1xuICAgICAgICBmb3IgKGNvbnN0IHYgb2YgbWVzc2FnZS5wbGF5ZXJTcGF3bmVkKSB7XG4gICAgICAgICAgICB3cml0ZXIuaW50MzIodik7XG4gICAgICAgIH1cbiAgICAgICAgd3JpdGVyLmxkZWxpbSgpO1xuICAgICAgICB3cml0ZXIudWludDMyKDI0MikuZm9yaygpO1xuICAgICAgICBmb3IgKGNvbnN0IHYgb2YgbWVzc2FnZS50ZWFtU3Bhd25Db3VudCkge1xuICAgICAgICAgICAgd3JpdGVyLmludDMyKHYpO1xuICAgICAgICB9XG4gICAgICAgIHdyaXRlci5sZGVsaW0oKTtcbiAgICAgICAgaWYgKG1lc3NhZ2UubWF4Um91bmRzICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDI0OCkud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gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5yb3VuZCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICAgICAgICAgIGlmICgodGFnICYgNykgPT09IDIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGVuZDIgPSByZWFkZXIudWludDMyKCkgKyByZWFkZXIucG9zO1xuICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5raWxscy5wdXNoKHJlYWRlci5pbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uua2lsbHMucHVzaChyZWFkZXIuaW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA2OlxuICAgICAgICAgICAgICAgICAgICBpZiAoKHRhZyAmIDcpID09PSAyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBlbmQyID0gcmVhZGVyLnVpbnQzMigpICsgcmVhZGVyLnBvcztcbiAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuYXNzaXN0cy5wdXNoKHJlYWRlci5pbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuYXNzaXN0cy5wdXNoKHJlYWRlci5pbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDc6XG4gICAgICAgICAgICAgICAgICAgIGlmICgodGFnICYgNykgPT09IDIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGVuZDIgPSByZWFkZXIudWludDMyKCkgKyByZWFkZXIucG9zO1xuICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5kZWF0aHMucHVzaChyZWFkZXIuaW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmRlYXRocy5wdXNoKHJlYWRlci5pbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDg6XG4gICAgICAgICAgICAgICAgICAgIGlmICgodGFnICYgNykgPT09IDIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGVuZDIgPSByZWFkZXIudWludDMyKCkgKyByZWFkZXIucG9zO1xuICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zY29yZXMucHVzaChyZWFkZXIuaW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnNjb3Jlcy5wdXNoKHJlYWRlci5pbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDk6XG4gICAgICAgICAgICAgICAgICAgIGlmICgodGFnICYgNykgPT09IDIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGVuZDIgPSByZWFkZXIudWludDMyKCkgKyByZWFkZXIucG9zO1xuICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5waW5ncy5wdXNoKHJlYWRlci5pbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucGluZ3MucHVzaChyZWFkZXIuaW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxMDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5yb3VuZFJlc3VsdCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDExOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm1hdGNoUmVzdWx0ID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTI6XG4gICAgICAgICAgICAgICAgICAgIGlmICgodGFnICYgNykgPT09IDIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGVuZDIgPSByZWFkZXIudWludDMyKCkgKyByZWFkZXIucG9zO1xuICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50ZWFtU2NvcmVzLnB1c2gocmVhZGVyLmludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50ZWFtU2NvcmVzLnB1c2gocmVhZGVyLmludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuY29uZmlybSA9IGV4cG9ydHMuQ01zZ0dDQ1N0cmlrZTE1VjJNYXRjaG1ha2luZ0dDMlNlcnZlckNvbmZpcm0uZGVjb2RlKHJlYWRlciwgcmVhZGVyLnVpbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5yZXNlcnZhdGlvblN0YWdlID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTU6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubWF0Y2hEdXJhdGlvbiA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDE2OlxuICAgICAgICAgICAgICAgICAgICBpZiAoKHRhZyAmIDcpID09PSAyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBlbmQyID0gcmVhZGVyLnVpbnQzMigpICsgcmVhZGVyLnBvcztcbiAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZW5lbXlLaWxscy5wdXNoKHJlYWRlci5pbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZW5lbXlLaWxscy5wdXNoKHJlYWRlci5pbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDE3OlxuICAgICAgICAgICAgICAgICAgICBpZiAoKHRhZyAmIDcpID09PSAyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBlbmQyID0gcmVhZGVyLnVpbnQzMigpICsgcmVhZGVyLnBvcztcbiAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZW5lbXlIZWFkc2hvdHMucHVzaChyZWFkZXIuaW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmVuZW15SGVhZHNob3RzLnB1c2gocmVhZGVyLmludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTg6XG4gICAgICAgICAgICAgICAgICAgIGlmICgodGFnICYgNykgPT09IDIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGVuZDIgPSByZWFkZXIudWludDMyKCkgKyByZWFkZXIucG9zO1xuICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5lbmVteTNrcy5wdXNoKHJlYWRlci5pbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZW5lbXkza3MucHVzaChyZWFkZXIuaW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxOTpcbiAgICAgICAgICAgICAgICAgICAgaWYgKCh0YWcgJiA3KSA9PT0gMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZW5kMiA9IHJlYWRlci51aW50MzIoKSArIHJlYWRlci5wb3M7XG4gICAgICAgICAgICAgICAgICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZDIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmVuZW15NGtzLnB1c2gocmVhZGVyLmludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5lbmVteTRrcy5wdXNoKHJlYWRlci5pbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDIwOlxuICAgICAgICAgICAgICAgICAgICBpZiAoKHRhZyAmIDcpID09PSAyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBlbmQyID0gcmVhZGVyLnVpbnQzMigpICsgcmVhZGVyLnBvcztcbiAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZW5lbXk1a3MucHVzaChyZWFkZXIuaW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmVuZW15NWtzLnB1c2gocmVhZGVyLmludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjE6XG4gICAgICAgICAgICAgICAgICAgIGlmICgodGFnICYgNykgPT09IDIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGVuZDIgPSByZWFkZXIudWludDMyKCkgKyByZWFkZXIucG9zO1xuICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5tdnBzLnB1c2gocmVhZGVyLmludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5tdnBzLnB1c2gocmVhZGVyLmludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc3BlY3RhdG9yc0NvdW50ID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDIzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnNwZWN0YXRvcnNDb3VudFR2ID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnNwZWN0YXRvcnNDb3VudExuayA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyNTpcbiAgICAgICAgICAgICAgICAgICAgaWYgKCh0YWcgJiA3KSA9PT0gMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZW5kMiA9IHJlYWRlci51aW50MzIoKSArIHJlYWRlci5wb3M7XG4gICAgICAgICAgICAgICAgICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZDIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmVuZW15S2lsbHNBZ2cucHVzaChyZWFkZXIuaW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmVuZW15S2lsbHNBZ2cucHVzaChyZWFkZXIuaW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyNjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5kcm9wSW5mbyA9IGV4cG9ydHMuQ01zZ0dDQ1N0cmlrZTE1VjJNYXRjaG1ha2luZ1NlcnZlclJvdW5kU3RhdHNfRHJvcEluZm8uZGVjb2RlKHJlYWRlciwgcmVhZGVyLnVpbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyNzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5iU3dpdGNoZWRUZWFtcyA9IHJlYWRlci5ib29sKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjg6XG4gICAgICAgICAgICAgICAgICAgIGlmICgodGFnICYgNykgPT09IDIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGVuZDIgPSByZWFkZXIudWludDMyKCkgKyByZWFkZXIucG9zO1xuICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5lbmVteTJrcy5wdXNoKHJlYWRlci5pbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZW5lbXkya3MucHVzaChyZWFkZXIuaW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOTpcbiAgICAgICAgICAgICAgICAgICAgaWYgKCh0YWcgJiA3KSA9PT0gMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZW5kMiA9IHJlYWRlci51aW50MzIoKSArIHJlYWRlci5wb3M7XG4gICAgICAgICAgICAgICAgICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZDIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnBsYXllclNwYXduZWQucHVzaChyZWFkZXIuaW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnBsYXllclNwYXduZWQucHVzaChyZWFkZXIuaW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzMDpcbiAgICAgICAgICAgICAgICAgICAgaWYgKCh0YWcgJiA3KSA9PT0gMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZW5kMiA9IHJlYWRlci51aW50MzIoKSArIHJlYWRlci5wb3M7XG4gICAgICAgICAgICAgICAgICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZDIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnRlYW1TcGF3bkNvdW50LnB1c2gocmVhZGVyLmludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50ZWFtU3Bhd25Db3VudC5wdXNoKHJlYWRlci5pbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDMxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm1heFJvdW5kcyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iLCBfYywgX2QsIF9lLCBfZiwgX2csIF9oLCBfaiw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dHNfRHJvcEluZm8gPSB7XG4gICAgZW5jb2RlKG1lc3NhZ2UsIHdyaXRlciA9IG1pbmltYWxfMS5Xcml0ZXIuY3JlYXRlKCkpIHtcbiAgICAgICAgaWYgKG1lc3NhZ2UuYWNjb3VudE12cCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig4KS51aW50MzIobWVzc2FnZS5hY2NvdW50TXZwKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNNc2dHQ0NTdHJpa2UxNVYyTWF0Y2htYWtpbmdTZXJ2ZXJSb3VuZFN0YXRzX0Ryb3BJbmZvKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5hY2NvdW50TXZwID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAg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Rlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmFjY291bnRJZCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm9uZ29pbmdtYXRjaCA9IGV4cG9ydHMuQ01zZ0dDQ1N0cmlrZTE1VjJNYXRjaG1ha2luZ0dDMkNsaWVudFJlc2VydmUuZGVjb2RlKHJlYWRlciwgcmVhZGVyLnVpbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmdsb2JhbFN0YXRzID0gZXhwb3J0cy5HbG9iYWxTdGF0aXN0aWNzLmRlY29kZShyZWFkZXIsIHJlYWRlci51aW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5wZW5hbHR5U2Vjb25kcyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA1OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnBlbmFsdHlSZWFzb24gPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS52YWNCYW5uZWQgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA3OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnJhbmtpbmcgPSBleHBvcnRzLlBsYXllclJhbmtpbmdJbmZvLmRlY29kZShyZWFkZXIsIHJlYWRlci51aW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgODpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5jb21tZW5kYXRpb24gPSBleHBvcnRzLlBsYXllckNvbW1lbmRhdGlvbkluZm8uZGVjb2RlKHJlYWRlciwgcmVhZGVyLnVpbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA5OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm1lZGFscyA9IGV4cG9ydHMuUGxheWVyTWVkYWxzSW5mby5kZWNvZGUocmVhZGVyLCByZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDEwOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm15Q3VycmVudEV2ZW50ID0gZXhwb3J0cy5Ub3VybmFtZW50RXZlbnQuZGVjb2RlKHJlYWRlciwgcmVhZGVyLnVpbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5teUN1cnJlbnRFdmVudFRlYW1zLnB1c2goZXhwb3J0cy5Ub3VybmFtZW50VGVhbS5kZWNvZGUocmVhZGVyLCByZWFkZXIudWludDMyKCkpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5teUN1cnJlbnRUZWFtID0gZXhwb3J0cy5Ub3VybmFtZW50VGVhbS5kZWNvZGUocmVhZGVyLCByZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDEzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm15Q3VycmVudEV2ZW50U3RhZ2VzLnB1c2goZXhwb3J0cy5Ub3VybmFtZW50RXZlbnQuZGVjb2RlKHJlYWRlciwgcmVhZGVyLnVpbnQzMigpKSk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTQ6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc3VydmV5Vm90ZSA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxNTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5hY3Rpdml0eSA9IGV4cG9ydHMuQWNjb3VudEFjdGl2aXR5LmRlY29kZShyZWFkZXIsIHJlYWRlci51aW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTc6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucGxheWVyTGV2ZWwgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxODpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5wbGF5ZXJDdXJYcCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDE5OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnBsYXllclhwQm9udXNGbGFncyA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDIwOlxuICAgICAgICAgIC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lTZXR0aW5ncygpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc2V0dGluZ3MucHVzaChleHBvcnRzLkNNc2dHQ0NTdHJpa2UxNVYyQWNjb3VudFByaXZhY3lTZXR0aW5nc19TZXR0aW5nLmRlY29kZShyZWFkZXIsIHJlYWRlci51aW50MzIoKSkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYTtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMkFjY291bnRQcml2YWN5U2V0dGluZ3MoKTtcbiAgICAgICAgbWVzc2FnZS5zZXR0aW5ncyA9XG4gICAgICAgICAgICAoKF9hID0gb2JqZWN0LnNldHRpbmdzKSA9PT0gbnVsbCB8fCBfYSA9PT0gdm9pZCAwID8gdm9pZCAwIDogX2EubWFwKGUgPT4gZXhwb3J0cy5DTXNnR0NDU3RyaWtlMTVWMkFjY291bnRQcml2YWN5U2V0dGluZ3NfU2V0dGluZy5mcm9tUGFydGlhbChlKSkpIHx8IFtdO1xuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9XG59O1xuZnVuY3Rpb24gY3JlYXRlQmFzZUNNc2dHQ0NTd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SByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zZXR0aW5nVHlwZSA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnNldHRpbmdWYWx1ZSA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNNc2dHQ0NTdHJpa2UxNVYyQWNjb3VudFByaXZhY3lTZXR0aW5nc19TZXR0aW5nKCk7XG4gICAgICAgIG1lc3NhZ2Uuc2V0dGluZ1R5cGUgPSAoX2EgPSBvYmplY3Quc2V0dGluZ1R5cGUpICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6IDA7XG4gICAgICAgIG1lc3NhZ2Uuc2V0dGluZ1ZhbHVlID0gKF9iID0gb2JqZWN0LnNldHRpbmdWYWx1ZSkgIT09IG51bGwgJiYgX2IgIT09IHZvaWQgMCA/IF9iIDogMDtcbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfVxufTtcbmZ1bmN0aW9uIGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMk1hdGNobWFraW5nR0M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B3cml0ZXI7XG4gICAgfSxcbiAgICBkZWNvZGUoaW5wdXQsIGxlbmd0aCkge1xuICAgICAgICBjb25zdCByZWFkZXIgPSBpbnB1dCBpbnN0YW5jZW9mIG1pbmltYWxfMS5SZWFkZXIgPyBpbnB1dCA6IG5ldyBtaW5pbWFsXzEuUmVhZGVyKGlucHV0KTtcbiAgICAgICAgbGV0IGVuZCA9IGxlbmd0aCA9PT0gdW5kZWZpbmVkID8gcmVhZGVyLmxlbiA6IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ01zZ0dDQ1N0cmlrZTE1VjJNYXRjaG1ha2luZ0dDMkNsaWVudEFiYW5kb24oKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmFjY291bnRJZCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmFiYW5kb25lZE1hdGNoID0gZXhwb3J0cy5DTXNnR0NDU3RyaWtlMTVWMk1hdGNobWFraW5nR0MyQ2xpZW50UmVzZXJ2ZS5kZWNvZGUocmVhZGVyLCByZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucGVuYWx0eVNlY29uZHMgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5wZW5hbHR5UmVhc29uID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2IsIF9jO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNNc2dHQ0NTdHJpa2UxNVYyTWF0Y2htYWtpbmdHQzJDbGllbnRBYmFuZG9uKCk7XG4gICAgICAgIG1lc3NhZ2UuYWNjb3VudElkID0gKF9hID0gb2JqZWN0LmFjY291bnRJZCkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogMDtcbiAgICAgICAgbWVzc2FnZS5hYmFuZG9uZWRNYXRjaCA9XG4gICAgICAgICAgICBvYmplY3QuYWJhbmRvbmVkTWF0Y2ggIT09IHVuZGVmaW5lZCAmJiBvYmplY3QuYWJhbmRvbmVkTWF0Y2ggIT09IG51bGxcbiAgICAgICAgICAgICAgICA/IGV4cG9ydHMuQ01zZ0dDQ1N0cmlrZTE1VjJNYXRjaG1ha2luZ0dDMkNsaWVudFJlc2VydmUuZnJvbVBhcnRpYWwob2JqZWN0LmFiYW5kb25lZE1hdGNoKVxuICAgICAgICAgICAgICAgIDogdW5kZWZpbmVkO1xuICAgICAgICBtZXNzYWdlLnBlbmFsdHlTZWNvbmRzID0gKF9iID0gb2JqZWN0LnBlbmFsdHlTZWNvbmRzKSAhPT0gbnVsbCAmJiBfYiAhPT0gdm9pZCAwID8gX2IgOiAwO1xuICAgICAgICBtZXNzYWdl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FnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucmFua2luZ3MucHVzaChleHBvcnRzLlBsYXllclJhbmtpbmdJbmZvLmRlY29kZShyZWFkZXIsIHJlYWRlci51aW50MzIoKSkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYTtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMkNsaWVudEdDUmFua1VwZGF0ZSgpO1xuICAgICAgICBtZXNzYWdlLnJhbmtpbmdzID1cbiAgICAgICAgICAgICgoX2EgPSBvYmplY3QucmFua2luZ3MpID09PSBudWxsIHx8IF9hID09PSB2b2lkIDAgPyB2b2lkIDAgOiBfYS5tYXAoZSA9PiBleHBvcnRzLlBsYXllclJhbmtpbmdJbmZvLmZyb21QYXJ0aWFsKGUpKSkgfHwgW107XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH1cbn07XG5mdW5jdGlvbiBjcmVhdGVCYXNlQ01zZ0dDQ1N0cmlrZTE1VjJNYXRjaG1ha2luZ09wZXJhdG9yMkdDQmxvZ1VwZGF0ZSgpIHtcbiAgICByZXR1cm4geyBtYWluUG9zdFVybDogXCJcIiB9O1xufVxuZXhwb3J0cy5DTXNnR0NDU3RyaWtlMTVWMk1hdGNobWFraW5nT3BlcmF0b3IyR0NCbG9nVXBkYXRlID0ge1xuICAgIGVuY29kZShtZXNzYWdlLCB3cml0ZXIgPSBtaW5pbWFsXzEuV3JpdGVyLmNyZWF0ZSgpKSB7XG4gICAgICAgIGlmIChtZXNzYWdlLm1haW5Qb3N0VXJsICE9PSBcIlwiKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDEwKS5zdHJpbmcobWVzc2FnZS5tYWluUG9zdFVybCk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMk1hdGNobWFraW5nT3BlcmF0b3IyR0NCbG9nVXBkYXRlKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5tYWluUG9zdFVybCA9IHJlYWRlci5zdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1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jb25kcyAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigyNCkudWludDMyKG1lc3NhZ2Uuc2Vjb25kcyk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuY29tbXVuaWNhdGlvbkNvb2xkb3duID09PSB0cnVlKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDMyKS5ib29sKG1lc3NhZ2UuY29tbXVuaWNhdGlvbkNvb2xkb3duKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNNc2dHQ0NTdHJpa2UxNVYyU2VydmVyTm90aWZpY2F0aW9uRm9yVXNlclBlbmFsdHkoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmFjY291bnRJZCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnJlYXNvbiA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnNlY29uZHMgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5jb21tdW5pY2F0aW9uQ29vbGRvd24gPSByZWFkZXIuYm9vbCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2IsIF9jLCBfZDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMlNlcnZlck5vdGlmaWNhdGlvbkZvclVzZXJQZW5hbHR5KCk7XG4gICAgICAgIG1lc3NhZ2UuYWNjb3VudElkID0gKF9hID0gb2JqZWN0LmFjY291bnRJZCkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogMDtcbiAgICAgICAgbWVzc2FnZS5yZWFzb24gPSAoX2IgPSBvYmplY3QucmVhc29uKSAhPT0gbnVsbCAmJiBfYiAhPT0gdm9pZCAwID8gX2IgOiAwO1xuICAgICAgICBtZXNzYWdlLnNlY29uZHMgPSAoX2MgPSBvYmplY3Quc2Vjb25kcykgIT09IG51bGwgJiYgX2MgIT09IHZvaWQgMCA/IF9jIDogMDtcbiAgICAgICAgbWVzc2FnZS5jb21tdW5pY2F0aW9uQ29vbGRvd24gPSAoX2QgPSBvYmplY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c2FnZS5ycHRXYWxsaGFjayk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UucnB0U3BlZWRoYWNrICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDMyKS51aW50MzIobWVzc2FnZS5ycHRTcGVlZGhhY2spO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnJwdFRlYW1oYXJtICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDQwKS51aW50MzIobWVzc2FnZS5ycHRUZWFtaGFybSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UucnB0VGV4dGFidXNlICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDQ4KS51aW50MzIobWVzc2FnZS5ycHRUZXh0YWJ1c2UpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnJwdFZvaWNlYWJ1c2UgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNTYpLnVpbnQzMihtZXNzYWdlLnJwdFZvaWNlYWJ1c2UpO1xuICAgICAgICB9XG4gICAgICAgIGlmICghbWVzc2FnZS5tYXRjaElkLmlzWmVybygpKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDY0KS51aW50NjQobWVzc2FnZS5tYXRjaElkKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5yZXBvcnRGcm9tRGVtbyA9PT0gdHJ1ZSkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig3MikuYm9vbChtZXNzYWdlLnJlcG9ydEZyb21EZW1vKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNNc2dHQ0NTdHJpa2UxNVYyQ2xpZW50UmVwb3J0UGxheWVyKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5hY2NvdW50SWQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5ycHRBaW1ib3QgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5ycHRXYWxsaGFjayA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnJwdFNwZWVkaGFjayA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA1OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnJwdFRlYW1oYXJtID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDY6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucnB0VGV4dGFidXNlID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDc6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucnB0Vm9pY2VhYnVzZSA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA4OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm1hdGNoSWQgPSByZWFkZXIudWludDY0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgOTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5yZXBvcnRGcm9tRGVtbyA9IHJlYWRlci5ib29sKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCBfYiwgX2MsIF9kLCBfZSwgX2YsIF9nLCBfaDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMkNsaWVudFJlcG9ydFBsYXllcigpO1xuICAgICAgICBtZXNzYWdlLmFjY291bnRJZCA9IChfYSA9IG9iamVjdC5hY2NvdW50SWQpICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6IDA7XG4gICAgICAgIG1lc3NhZ2UucnB0QWltYm90ID0gKF9iID0gb2JqZWN0LnJwdEFp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XG4gICAgfVxufTtcbmZ1bmN0aW9uIGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMkNsaWVudENvbW1lbmRQbGF5ZXIoKSB7XG4gICAgcmV0dXJuIHtcbiAgICAgICAgYWNjb3VudElkOiAwLFxuICAgICAgICBtYXRjaElkOiBMb25nLlVaRVJPLFxuICAgICAgICBjb21tZW5kYXRpb246IHVuZGVmaW5lZCxcbiAgICAgICAgdG9rZW5zOiAwXG4gICAgfTtcbn1cbmV4cG9ydHMuQ01zZ0dDQ1N0cmlrZTE1VjJDbGllbnRDb21tZW5kUGxheWVyID0ge1xuICAgIGVuY29kZShtZXNzYWdlLCB3cml0ZXIgPSBtaW5pbWFsXzEuV3JpdGVyLmNyZWF0ZSgpKSB7XG4gICAgICAgIGlmIChtZXNzYWdlLmFjY291bnRJZCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig4KS51aW50MzIobWVzc2FnZS5hY2NvdW50SWQpO1xuICAgICAgICB9XG4gICAgICAgIGlmICghbWVzc2FnZS5tYXRjaElkLmlzWmVybygpKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDY0KS51aW50NjQobWVzc2FnZS5tYXRjaElkKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5jb21tZW5kYXRpb24gIT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgZXhwb3J0cy5QbGF5ZXJDb21tZW5kYXRpb25JbmZvLmVuY29kZShtZXNzYWdlLmNvbW1lbmRhdGlvbiwgd3JpdGVyLnVpbnQzMig3NCkuZm9yaygpKS5sZGVsaW0oKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS50b2tlbnMgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoODApLnVpbnQzMihtZXNzYWdlLnRva2Vucyk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMkNsaWVudENvbW1lbmRQbGF5ZXIoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmFjY291bnRJZCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA4OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm1hdGNoSWQgPSByZWFkZXIudWludDY0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgOTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5jb21tZW5kYXRpb24gPSBleHBvcnRzLlBsYXllckNvbW1lbmRhdGlvbkluZm8uZGVjb2RlKHJlYWRlciwgcmVhZGVyLnVpbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxMDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50b2tlbnMgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZW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VpbnQzMihtZXNzYWdlLnJwdExpc3RpbmdhYnVzZSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UucnB0SW52ZW50b3J5YWJ1c2UgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNDApLnVpbnQzMihtZXNzYWdlLnJwdEludmVudG9yeWFidXNlKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAoIW1lc3NhZ2UubWF0Y2hJZC5pc1plcm8oKSkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig2NCkudWludDY0KG1lc3NhZ2UubWF0Y2hJZCk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMkNsaWVudFJlcG9ydFNlcnZlcigpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucnB0UG9vcnBlcmYgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5ycHRBYnVzaXZlbW9kZWxzID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucnB0QmFkbW90ZCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnJwdExpc3RpbmdhYnVzZSA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA1OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnJwdEludmVudG9yeWFidXNlID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDg6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubWF0Y2hJZCA9IHJlYWRlci51aW50NjQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iLCBfYywgX2QsIF9lO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNNc2dHQ0NTdHJpa2UxNVYyQ2xpZW50UmVwb3J0U2VydmVyKCk7XG4gICAgICAgIG1lc3NhZ2UucnB0UG9vcnBlcmYgPSAoX2EgPSBvYmplY3QucnB0UG9vc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BvbnNlVHlwZTogMCxcbiAgICAgICAgcmVzcG9uc2VSZXN1bHQ6IDAsXG4gICAgICAgIHRva2VuczogMFxuICAgIH07XG59XG5leHBvcnRzLkNNc2dHQ0NTdHJpa2UxNVYyQ2xpZW50UmVwb3J0UmVzcG9uc2UgPSB7XG4gICAgZW5jb2RlKG1lc3NhZ2UsIHdyaXRlciA9IG1pbmltYWxfMS5Xcml0ZXIuY3JlYXRlKCkpIHtcbiAgICAgICAgaWYgKCFtZXNzYWdlLmNvbmZpcm1hdGlvbklkLmlzWmVybygpKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDgpLnVpbnQ2NChtZXNzYWdlLmNvbmZpcm1hdGlvbklkKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5hY2NvdW50SWQgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTYpLnVpbnQzMihtZXNzYWdlLmFjY291bnRJZCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2Uuc2VydmVySXAgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMjQpLnVpbnQzMihtZXNzYWdlLnNlcnZlcklwKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5yZXNwb25zZVR5cGUgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMzIpLnVpbnQzMihtZXNzYWdlLnJlc3BvbnNlVHlwZSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UucmVzcG9uc2VSZXN1bHQgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNDApLnVpbnQzMihtZXNzYWdlLnJlc3BvbnNlUmVzdWx0KTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS50b2tlbnMgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNDgpLnVpbnQzMihtZXNzYWdlLnRva2Vucyk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMkNsaWVudFJlcG9ydFJlc3BvbnNlKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5jb25maXJtYXRpb25JZCA9IHJlYWRlci51aW50NjQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmFjY291bnRJZCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnNlcnZlcklwID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucmVzcG9uc2VUeXBlID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucmVzcG9uc2VSZXN1bHQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50b2tlbnMgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCBfYiwgX2MsIF9kLCBfZTtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMkNsaWVudFJlcG9ydFJlc3BvbnNlKCk7XG4gICAgICAgIG1lc3NhZ2UuY29uZmlybWF0aW9uSWQgPVxuICAgICAgICAgICAgb2JqZWN0LmNvbmZpcm1hdGlvbklkICE9PSB1bmRlZmluZWQgJiYgb2JqZWN0LmNvbmZpcm1hdGlvbklkICE9PSBudWxsXG4gICAgICAgICAgICAgICAgPyBMb25nLmZyb21WYWx1ZShvYmplY3QuY29uZmlybWF0aW9uSWQpXG4gICAgICAgICAgICAgICAgOiBMb25nLlVaRVJPO1xuICAgICAgICBtZXNzYWdlLmFjY291bnRJZCA9IChfYSA9IG9iamVjdC5hY2NvdW50SWQpICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6IDA7XG4gICAgICAgIG1lc3NhZ2Uuc2VydmVySXAgPSAoX2Ig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bGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMkNsaWVudFJlcXVlc3RXYXRjaEluZm9GcmllbmRzKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5yZXF1ZXN0SWQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgaWYgKCh0YWcgJiA3KSA9PT0gMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZW5kMiA9IHJlYWRlci51aW50MzIoKSArIHJlYWRlci5wb3M7XG4gICAgICAgICAgICAgICAgICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZDIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmFjY291bnRJZHMucHVzaChyZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5hY2NvdW50SWRzLnB1c2gocmVhZGVyLnVpbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc2VydmVyaWQgPSByZWFkZXIudWludDY0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5tYXRjaGlkID0gcmVhZGVyLnVpbnQ2NCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuY2xpZW50TGF1bmNoZXIgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5kYXRhQ2VudGVyUGluZ3MucHVzaChleHBvcnRzLkRhdGFDZW50ZXJQaW5nLmRlY29kZShyZWFkZXIsIHJlYWRlci51aW50MzIoKSkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2IsIF9jLCBfZDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMkNsaWVudFJlcXVlc3RXYXRjaEluZm9GcmllbmRzKCk7XG4gICAgICAgIG1lc3NhZ2UucmVxdWVzdElkID0gKF9hID0gb2JqZWN0LnJlcXVlc3RJZCkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogMDtcbiAgICAgICAgbWVzc2FnZS5hY2NvdW50SWRzID0gKChfYiA9IG9iamVjdC5hY2NvdW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gICAgICAgIHR2U3BlY3RhdG9yczogMCxcbiAgICAgICAgdHZUaW1lOiAwLFxuICAgICAgICB0dldhdGNoUGFzc3dvcmQ6IG5ldyBVaW50OEFycmF5KCksXG4gICAgICAgIGNsRGVjcnlwdGRhdGFLZXk6IExvbmcuVVpFUk8sXG4gICAgICAgIGNsRGVjcnlwdGRhdGFLZXlQdWI6IExvbmcuVVpFUk8sXG4gICAgICAgIGdhbWVUeXBlOiAwLFxuICAgICAgICBnYW1lTWFwZ3JvdXA6IFwiXCIsXG4gICAgICAgIGdhbWVNYXA6IFwiXCIsXG4gICAgICAgIHNlcnZlcklkOiBMb25nLlVaRVJPLFxuICAgICAgICBtYXRjaElkOiBMb25nLlVaRVJPLFxuICAgICAgICByZXNlcnZhdGlvbklkOiBMb25nLlVaRVJPXG4gICAgfTtcbn1cbmV4cG9ydHMuV2F0Y2hhYmxlTWF0Y2hJbmZvID0ge1xuICAgIGVuY29kZShtZXNzYWdlLCB3cml0ZXIgPSBtaW5pbWFsXzEuV3JpdGVyLmNyZWF0ZSgpKSB7XG4gICAgICAgIGlmIChtZXNzYWdlLnNlcnZlcklwICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDgpLnVpbnQzMihtZXNzYWdlLnNlcnZlcklwKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS50dlBvcnQgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTYpLnVpbnQzMihtZXNzYWdlLnR2UG9ydCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UudHZTcGVjdGF0b3JzICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDI0KS51aW50MzIobWVzc2FnZS50dlNwZWN0YXRvcnMpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnR2VGltZSAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigzMikudWludDMyKG1lc3NhZ2UudHZUaW1lKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS50dldhdGNoUGFzc3dvcmQubGVuZ3RoICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDQyKS5ieXRlcyhtZXNzYWdlLnR2V2F0Y2hQYXNzd29yZCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKCFtZXNzYWdlLmNsRGVjcnlwdGRhdGFLZXkuaXNaZXJvKCkpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNDgpLnVpbnQ2NChtZXNzYWdlLmNsRGVjcnlwdGRhdGFLZXkpO1xuICAgICAgICB9XG4gICAgICAgIGlmICghbWVzc2FnZS5jbERlY3J5cHRkYXRhS2V5UHViLmlzWmVybygpKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDU2KS51aW50NjQobWVzc2FnZS5jbERlY3J5cHRkYXRhS2V5UHViKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5nYW1lVHlwZSAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig2NCkudWludDMyKG1lc3NhZ2UuZ2FtZVR5cGUpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmdhbWVNYXBncm91cCAhPT0gXCJcIikge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig3NCkuc3RyaW5nKG1lc3NhZ2UuZ2FtZU1hcGdyb3VwKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5nYW1lTWFwICE9PSBcIlwiKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDgyKS5zdHJpbmcobWVzc2FnZS5nYW1lTWFwKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAoIW1lc3NhZ2Uuc2VydmVySWQuaXNaZXJvKCkpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoODgpLnVpbnQ2NChtZXNzYWdlLnNlcnZlcklkKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAoIW1lc3NhZ2UubWF0Y2hJZC5pc1plcm8oKSkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig5NikudWludDY0KG1lc3NhZ2UubWF0Y2hJZCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKCFtZXNzYWdlLnJlc2VydmF0aW9uSWQuaXNaZXJvKCkpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTA0KS51aW50NjQobWVzc2FnZS5yZXNlcnZhdGlvbklkKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZVdhdGNoYWJsZU1hdGNoSW5mbygpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc2VydmVySXAgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50dlBvcnQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50dlNwZWN0YXRvcnMgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50dlRpbWUgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50dldhdGNoUGFzc3dvcmQgPSByZWFkZXIuYnl0ZXMoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA2OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmNsRGVjcnlwdGRhdGFLZXkgPSByZWFkZXIudWludDY0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5jbERlY3J5cHRkYXRhS2V5UHViID0gcmVhZGVyLnVpbnQ2NCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDg6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZ2FtZVR5cGUgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgOTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5nYW1lTWFwZ3JvdXAgPSByZWFkZXIuc3RyaW5nKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTA6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZ2FtZU1hcCA9IHJlYWRlci5zdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zZXJ2ZXJJZCA9IHJlYWRlci51aW50NjQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5tYXRjaElkID0gcmVhZGVyLnVpbnQ2NCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDEzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnJlc2VydmF0aW9uSWQgPSByZWFkZXIudWludDY0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCBfYiwgX2MsIF9kLCBfZSwgX2YsIF9nLCBfaDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VXYXRjaGFibGVNYXRjaEluZm8oKTtcbiAgICAgICAgbWVzc2FnZS5zZXJ2ZXJJcCA9IChfYSA9IG9iamVjdC5zZXJ2ZXJJcCkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogMDtcbiAgICAgICAgbWVzc2FnZS50dlBvcnQgPSAoX2IgPSBvYmplY3QudHZQb3J0KSAhPT0gbnVsbCAmJiBfYiAhPT0gdm9pZCAwID8gX2IgOiAwO1xuICAgICAgICBtZXNzYWdlLnR2U3BlY3RhdG9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Gdyb3VwID0gKF9nID0gb2JqZWN0LmdhbWVNYXBncm91cCkgIT09IG51bGwgJiYgX2cgIT09IHZvaWQgMCA/IF9nIDogXCJcIjtcbiAgICAgICAgbWVzc2FnZS5nYW1lTWFwID0gKF9oID0gb2JqZWN0LmdhbWVNYXApICE9PSBudWxsICYmIF9oICE9PSB2b2lkIDAgPyBfaCA6IFwiXCI7XG4gICAgICAgIG1lc3NhZ2Uuc2VydmVySWQgPVxuICAgICAgICAgICAgb2JqZWN0LnNlcnZlcklkICE9PSB1bmRlZmluZWQgJiYgb2JqZWN0LnNlcnZlcklkICE9PSBudWxsXG4gICAgICAgICAgICAgICAgPyBMb25nLmZyb21WYWx1ZShvYmplY3Quc2VydmVySWQpXG4gICAgICAgICAgICAgICAgOiBMb25nLlVaRVJPO1xuICAgICAgICBtZXNzYWdlLm1hdGNoSWQgPVxuICAgICAgICAgICAgb2JqZWN0Lm1hdGNoSWQgIT09IHVuZGVmaW5lZCAmJiBvYmplY3QubWF0Y2hJZCAhPT0gbnVsbFxuICAgICAgICAgICAgICAgID8gTG9uZy5mcm9tVmFsdWUob2JqZWN0Lm1hdGNoSWQpXG4gICAgICAgICAgICAgICAgOiBMb25nLlVaRVJPO1xuICAgICAgICBtZXNzYWdlLnJlc2VydmF0aW9uSWQgPVxuICAgICAgICAgICAgb2JqZWN0LnJlc2VydmF0aW9uSWQgIT09IHVuZGVmaW5lZCAmJiBvYmplY3QucmVzZXJ2YXRpb25JZCAhPT0gbnVsbFxuICAgICAgICAgICAgICAgID8gTG9uZy5mcm9tVmFsdWUob2JqZWN0LnJlc2VydmF0aW9uSWQpXG4gICAgICAgICAgICAgICAgOiBMb25nLlVaRVJPO1xuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9XG59O1xuZnVuY3Rpb24gY3JlYXRlQmFzZUNNc2dHQ0NTdHJpa2UxNVYyQ2xpZW50UmVxdWVzdEpvaW5GcmllbmREYXRhKCkge1xuICAgIHJldHVybiB7XG4gICAgICAgIHZlcnNpb246IDAsXG4gICAgICAgIGFjY291bnRJZDogMCxcbiAgICAgICAgam9pblRva2VuOiAwLFxuICAgICAgICBqb2luSXBwOiAwLFxuICAgICAgICByZXM6IHVuZGVmaW5lZCxcbiAgICAgICAgZXJyb3Jtc2c6IFwiXCJcbiAgICB9O1xufVxuZXhwb3J0cy5DTXNnR0NDU3RyaWtlMTVWMkNsaWVudFJlcXVlc3RKb2luRnJpZW5kRGF0YSA9IHtcbiAgICBlbmNvZGUobWVzc2FnZSwgd3JpdGVyID0gbWluaW1hbF8xLldyaXRlci5jcmVhdGUoKSkge1xuICAgICAgICBpZiAobWVzc2FnZS52ZXJzaW9uICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDgpLnVpbnQzMihtZXNzYWdlLnZlcnNpb24pO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmFjY291bnRJZCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigxNikudWludDMyKG1lc3NhZ2UuYWNjb3VudElkKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5qb2luVG9rZW4gIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMjQpLnVpbnQzMihtZXNzYWdlLmpvaW5Ub2tlbik7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2Uuam9pbklwcCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigzMikudWludDMyKG1lc3NhZ2Uuam9pbklwcCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UucmVzICE9PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgIGV4cG9ydHMuQ01zZ0dDQ1N0cmlrZTE1VjJNYXRjaG1ha2luZ0dDMkNsaWVudFJlc2VydmUuZW5jb2RlKG1lc3NhZ2UucmVzLCB3cml0ZXIudWludDMyKDQyKS5mb3JrKCkpLmxkZWxpbSgpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmVycm9ybXNnICE9PSBcIlwiKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDUwKS5zdHJpbmcobWVzc2FnZS5lcnJvcm1zZyk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMkNsaWVudFJlcXVlc3RKb2luRnJpZW5kRGF0YSgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudmVyc2lvbiA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmFjY291bnRJZCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmpvaW5Ub2tlbiA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmpvaW5JcHAgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5yZXMgPSBleHBvcnRzLkNNc2dHQ0NTdHJpa2UxNVYyTWF0Y2htYWtpbmdHQzJDbGllbnRSZXNlcnZlLmRlY29kZShyZWFkZXIsIHJlYWRlci51aW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5lcnJvcm1zZyA9IHJlYWRlci5zdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iLCBfYywgX2QsIF9lO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNNc2dHQ0NTdHJpa2UxNVYyQ2xpZW50UmVxdWVzdEpvaW5GcmllbmREYXRhKCk7XG4gICAgICAgIG1lc3NhZ2UudmVyc2lvbiA9IChfYSA9IG9iamVjdC52ZXJzaW9uKSAhPT0gbnVsbCAmJiBfYSAhPT0gdm9pZCAwID8gX2EgOiAwO1xuICAgICAgICBtZXNzYWdlLmFjY291bnRJZCA9IChfYiA9IG9iamVjdC5hY2NvdW50SWQpICE9PSBud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ICE9PSBcIlwiKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDU4KS5zdHJpbmcobWVzc2FnZS5lcnJvcm1zZyk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMkNsaWVudFJlcXVlc3RKb2luU2VydmVyRGF0YSgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudmVyc2lvbiA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmFjY291bnRJZCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnNlcnZlcmlkID0gcmVhZGVyLnVpbnQ2NCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc2VydmVySXAgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zZXJ2ZXJQb3J0ID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDY6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucmVzID0gZXhwb3J0cy5DTXNnR0NDU3RyaWtlMTVWMk1hdGNobWFraW5nR0MyQ2xpZW50UmVzZXJ2ZS5kZWNvZGUocmVhZGVyLCByZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDc6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZXJyb3Jtc2cgPSByZWFkZXIuc3RyaW5nKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCBfYiwgX2MsIF9kLCBfZTtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMkNsaWVudFJlcXVlc3RKb2luU2VydmVyRGF0YSgpO1xuICAgICAgICBtZXNzYWdlLnZlcnNpb24gPSAoX2EgPSBvYmplY3QudmVyc2lvbikgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMC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y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5taXNzaW9uSWQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5jYW1wYWlnbklkID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2I7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ01zZ0dDQ3N0cmlrZTE1VjJDbGllbnRSZXF1ZXN0TmV3TWlzc2lvbigpO1xuICAgICAgICBtZXNzYWdlLm1pc3Npb25JZCA9IChfYSA9IG9iamVjdC5taXNzaW9uSWQpICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6IDA7XG4gICAgICAgIG1lc3NhZ2UuY2FtcGFpZ25JZCA9IChfYiA9IG9iamVjdC5jYW1wYWlnbklkKSAhPT0gbnVsbCAmJiBfYiAhPT0gdm9pZCAwID8gX2IgOiAwO1xuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9XG59O1xuZnVuY3Rpb24gY3JlYXRlQmFzZUNNc2dHQ0NzdHJpa2UxNVYyQ2xpZW50UmVkZWVtTWlzc2lvblJld2FyZCgpIHtcbiAgICByZXR1cm4geyBjYW1wYWlnbklkOiAwLCByZWRlZW1JZDogMCwgc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WRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ01zZ0dDQ3N0cmlrZTE1VjJDbGllbnRSZWRlZW1NaXNzaW9uUmV3YXJkKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5jYW1wYWlnbklkID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucmVkZWVtSWQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5yZWRlZW1hYmxlQmFsYW5jZSA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmV4cGVjdGVkQ29zdCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iL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gPSB7XG4gICAgZW5jb2RlKG1lc3NhZ2UsIHdyaXRlciA9IG1pbmltYWxfMS5Xcml0ZXIuY3JlYXRlKCkpIHtcbiAgICAgICAgZm9yIChjb25zdCB2IG9mIG1lc3NhZ2UueHBQcm9ncmVzc0RhdGEpIHtcbiAgICAgICAgICAgIGV4cG9ydHMuWHBQcm9ncmVzc0RhdGEuZW5jb2RlKHYsIHdyaXRlci51aW50MzIoMTApLmZvcmsoKSkubGRlbGltKCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuYWNjb3VudElkICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDE2KS51aW50MzIobWVzc2FnZS5hY2NvdW50SWQpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmN1cnJlbnRYcCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigyNCkudWludDMyKG1lc3NhZ2UuY3VycmVudFhwKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5jdXJyZW50TGV2ZWwgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMzIpLnVpbnQzMihtZXNzYWdlLmN1cnJlbnRMZXZlbCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UudXBncmFkZWREZWZpZHggIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNDApLnVpbnQzMihtZXNzYWdlLnVwZ3JhZGVkRGVmaWR4KTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5vcGVyYXRpb25Qb2ludHNBd2FyZGVkICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDQ4KS51aW50MzIobWVzc2FnZS5vcGVyYXRpb25Qb2ludHNBd2FyZGVkKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNNc2dHQ0NzdHJpa2UxNVYyR0MyU2VydmVyTm90aWZ5WFBSZXdhcmRlZCgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UueHBQcm9ncmVzc0RhdGEucHVzaChleHBvcnRzLlhwUHJvZ3Jlc3NEYXRhLmRlY29kZShyZWFkZXIsIHJlYWRlci51aW50MzIoKSkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuYWNjb3VudElkID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuY3VycmVudFhwID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuY3VycmVudExldmVsID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudXBncmFkZWREZWZpZHggPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5vcGVyYXRpb25Qb2ludHNBd2FyZGVkID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2IsIF9jLCBfZCwgX2UsIF9mO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNNc2dHQ0NzdHJpa2UxNVYyR0MyU2VydmVyTm90aWZ5WFBSZXdhcmRlZCgpO1xuICAgICAgICBtZXNzYWdlLnhwUHJvZ3Jlc3NEYXRhID1cbiAgICAgICAgICAgICgoX2EgPSBvYmplY3QueHBQcm9ncmVzc0RhdGEpID09PSBudWxsIHx8IF9hID09PSB2b2lkIDAgPyB2b2lkIDAgOiBfYS5tYXAoZSA9PiBleHBvcnRzLlhwUHJvZ3Jlc3NEYXRhLmZyb21QYXJ0aWFsKGUpKSkgfHwgW107XG4gICAgICAgIG1lc3NhZ2UuYWNjb3VudElkID0gKF9iID0gb2JqZWN0LmFjY291bnRJZCkgIT09IG51bGwgJiYgX2IgIT09IHZvaWQgMCA/IF9iIDogMDtcbiAgICAgICAgbWVzc2FnZS5jdXJyZW50WHAgPSAoX2MgPSBvYmplY3QuY3VycmVudF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xNUNsaWVudERlZXBTdGF0c19EZWVwU3RhdHNSYW5nZS5kZWNvZGUocmVhZGVyLCByZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubWF0Y2hlcy5wdXNoKGV4cG9ydHMuQ01zZ0dDQ1N0cmlrZTE1Q2xpZW50RGVlcFN0YXRzX0RlZXBTdGF0c01hdGNoLmRlY29kZShyZWFkZXIsIHJlYWRlci51aW50MzIoKSkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2I7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ01zZ0dDQ1N0cmlrZTE1Q2xpZW50RGVlcFN0YXRzKCk7XG4gICAgICAgIG1lc3NhZ2UuYWNjb3VudElkID0gKF9hID0gb2JqZWN0LmFjY291bnRJZCkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogMDtcbiAgICAgICAgbWVzc2FnZS5yYW5nZSA9XG4gICAgICAgICAgICBvYmplY3QucmFuZ2UgIT09IHVuZGVmaW5lZCAmJiBvYmplY3QucmFuZ2UgIT09IG51bGxcbiAgICAgICAgICAgICAgICA/IGV4cG9ydHMuQ01zZ0dDQ1N0cmlrZTE1Q2xpZW50RGVlcFN0YXRzX0RlZXBTdGF0c1JhbmdlLmZyb21QYXJ0aWFsKG9iamVjdC5yYW5nZSlcbiAgICAgICAgICAgICAgICA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GlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNNc2dHQ0NTdHJpa2UxNUNsaWVudERlZXBTdGF0c19EZWVwU3RhdHNSYW5nZSgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuYmVnaW4gPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5lbmQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5mcm96ZW4gPSByZWFkZXIuYm9vbCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZ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AgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYTtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVDbGllbnREZWVwU3RhdHNfRGVlcFN0YXRzTWF0Y2goKTtcbiAgICAgICAgbWVzc2FnZS5wbGF5ZXIgPVxuICAgICAgICAgICAgb2JqZWN0LnBsYXllciAhPT0gdW5kZWZpbmVkICYmIG9iamVjdC5wbGF5ZXIgIT09IG51bGxcbiAgICAgICAgICAgICAgICA/IGV4cG9ydHMuRGVlcFBsYXllclN0YXRzRW50cnkuZnJvbVBhcnRpYWwob2JqZWN0LnBsYXllcilcbiAgICAgICAgICAgICAgICA6IHVuZGVmaW5lZDtcbiAgICAgICAgbWVzc2FnZS5ldmVudHMgPVxuICAgICAgICAgICAgKChfYSA9IG9iamVjdC5ldmVudHMpID09PSBudWxsIHx8IF9hID09PSB2b2lkIDAgPyB2b2lkIDAgOiBfYS5tYXAoZSA9PiBleHBvcnRzLkRlZXBQbGF5ZXJNYXRjaEV2ZW50LmZyb21QYXJ0aWFsKGUpKSkgfHwgW107XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH1cbn07XG5mdW5jdGlvbiBjcmVhdGVCYXNlQ01zZ0dDQ1N0cmlrZTE1VjJXYXRjaEluZm9Vc2VycygpIHtcbiAgICByZXR1cm4ge1xuICAgICAgICByZXF1ZXN0SWQ6IDAsXG4gICAgICAgIGFjY291bnRJZHM6IFtdLFxuICAgICAgICB3YXRjaGFibGVNYXRjaEluZm9zOiBbXSxcbiAgICAgICAgZXh0ZW5kZWRUaW1lb3V0OiAwXG4gICAgfTtcbn1cbmV4cG9ydHMuQ01zZ0dDQ1N0cmlrZTE1VjJXYXRjaEluZm9Vc2VycyA9IHtcbiAgICBlbmNvZGUobWVzc2FnZSwgd3JpdGVyID0gbWluaW1hbF8xLldyaXRlci5jcmVhdGUoKSkge1xuICAgICAgICBpZiAobWVzc2FnZS5yZXF1ZXN0SWQgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoOCkudWludDMyKG1lc3NhZ2UucmVxdWVzdElkKTtcbiAgICAgICAgfVxuICAgICAgICB3cml0ZXIudWludDMyKDE4KS5mb3JrKCk7XG4gICAgICAgIGZvciAoY29uc3QgdiBvZiBtZXNzYWdlLmFjY291bnRJZHMpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIodik7XG4gICAgICAgIH1cbiAgICAgICAgd3JpdGVyLmxkZWxpbSgpO1xuICAgICAgICBmb3IgKGNvbnN0IHYgb2YgbWVzc2FnZS53YXRjaGFibGVNYXRjaEluZm9zKSB7XG4gICAgICAgICAgICBleHBvcnRzLldhdGNoYWJsZU1hdGNoSW5mby5lbmNvZGUodiwgd3JpdGVyLnVpbnQzMigyNikuZm9yaygpKS5sZGVsaW0oKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5leHRlbmRlZFRpbWVvdXQgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNDApLnVpbnQzMihtZXNzYWdlLmV4dGVuZGVkVGltZW91dCk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMldhdGNoSW5mb1VzZXJzKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5yZXF1ZXN0SWQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgaWYgKCh0YWcgJiA3KSA9PT0gMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZW5kMiA9IHJlYWRlci51aW50MzIoKSArIHJlYWRlci5wb3M7XG4gICAgICAgICAgICAgICAgICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZDIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmFjY291bnRJZHMucHVzaChyZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5hY2NvdW50SWRzLnB1c2gocmVhZGVyLnVpbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uud2F0Y2hhYmxlTWF0Y2hJbmZvcy5wdXNoKGV4cG9ydHMuV2F0Y2hhYmxlTWF0Y2hJbmZvLmRlY29kZShyZWFkZXIsIHJlYWRlci51aW50MzIoKSkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZXh0ZW5kZWRUaW1lb3V0ID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2IsIF9jLCBfZDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMldhdGNoSW5mb1VzZXJzKCk7XG4gICAgICAgIG1lc3NhZ2UucmVxdWVzdElkID0gKF9hID0gb2JqZWN0LnJlcXVlc3RJZCkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogMDtcbiAgICAgICAgbWVzc2FnZS5hY2NvdW50SWRzID0gKChfYiA9IG9iamVjdC5hY2NvdW50SWRzKSA9PT0gbnVsbCB8fCBfYiA9PT0gdm9pZCAwID8gdm9pZCAwIDogX2IubWFwKGUgPT4gZSkpIHx8IFtdO1xuICAgICAgICBtZXNzYWdlLndhdGNoYWJsZU1hdGNoSW5mb3MgPVxuICAgICAgICAgICAgKChfYyA9IG9iamVjdC53YXRjaGFibGVNYXRjaEluZm9zKSA9PT0gbnVsbCB8fCBfYyA9PT0gdm9pZCAwID8gdm9pZCAwIDogX2MubWFwKGUg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IGlmIChtZXNzYWdlLmFjY291bnRJZCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigyNCkudWludDMyKG1lc3NhZ2UuYWNjb3VudElkKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5yZXF1ZXN0TGV2ZWwgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMzIpLnVpbnQzMihtZXNzYWdlLnJlcXVlc3RMZXZlbCk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMkNsaWVudFJlcXVlc3RQbGF5ZXJzUHJvZmlsZSgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucmVxdWVzdElkRGVwcmVjYXRlZCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBpZiAoKHRhZyAmIDcpID09PSAyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBlbmQyID0gcmVhZGVyLnVpbnQzMigpICsgcmVhZGVyLnBvcztcbiAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuYWNjb3VudElkc0RlcHJlY2F0ZWQucHVzaChyZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5hY2NvdW50SWRzRGVwcmVjYXRlZC5wdXNoKHJlYWRlci51aW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmFjY291bnRJZCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnJlcXVlc3RMZXZlbCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iLCBfYywgX2Q7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ01zZ0dDQ1N0cmlrZTE1VjJDbG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3cml0ZXIudWludDMyKDU2KS51aW50MzIobWVzc2FnZS5ycHRTcGVlZGhhY2spO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnJwdFRlYW1oYXJtICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDY0KS51aW50MzIobWVzc2FnZS5ycHRUZWFtaGFybSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UucmVhc29uICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDcyKS51aW50MzIobWVzc2FnZS5yZWFzb24pO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiB3cml0ZXI7XG4gICAgfSxcbiAgICBkZWNvZGUoaW5wdXQsIGxlbmd0aCkge1xuICAgICAgICBjb25zdCByZWFkZXIgPSBpbnB1dCBpbnN0YW5jZW9mIG1pbmltYWxfMS5SZWFkZXIgPyBpbnB1dCA6IG5ldyBtaW5pbWFsXzEuUmVhZGVyKGlucHV0KTtcbiAgICAgICAgbGV0IGVuZCA9IGxlbmd0aCA9PT0gdW5kZWZpbmVkID8gcmVhZGVyLmxlbiA6IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ01zZ0dDQ1N0cmlrZTE1VjJQbGF5ZXJPdmVyd2F0Y2hDYXNlVXBkYXRlKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5jYXNlaWQgPSByZWFkZXIudWludDY0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zdXNwZWN0aWQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5mcmFjdGlvbmlkID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucnB0QWltYm90ID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDY6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucnB0V2FsbGhhY2sgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5ycHRTcGVlZGhhY2sgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgODpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5ycHRUZWFtaGFybSA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA5OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnJlYXNvbiA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbi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MzIoMTgpLnN0cmluZyhtZXNzYWdlLmNhc2V1cmwpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnZlcmRpY3QgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMjQpLnVpbnQzMihtZXNzYWdlLnZlcmRpY3QpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnRpbWVzdGFtcCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigzMikudWludDMyKG1lc3NhZ2UudGltZXN0YW1wKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS50aHJvdHRsZXNlY29uZHMgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNDApLnVpbnQzMihtZXNzYWdlLnRocm90dGxlc2Vjb25kcyk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2Uuc3VzcGVjdGlkICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDQ4KS51aW50MzIobWVzc2FnZS5zdXNwZWN0aWQpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmZyYWN0aW9uaWQgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNTYpLnVpbnQzMihtZXNzYWdlLmZyYWN0aW9uaWQpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLm51bXJvdW5kcyAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig2NCkudWludDMyKG1lc3NhZ2UubnVtcm91bmRzKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5mcmFjdGlvbnJvdW5kcyAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig3MikudWludDMyKG1lc3NhZ2UuZnJhY3Rpb25yb3VuZHMpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnN0cmVha2NvbnZpY3Rpb25zICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDgwKS5pbnQzMihtZXNzYWdlLnN0cmVha2NvbnZpY3Rpb25zKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5yZWFzb24gIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoODgpLnVpbnQzMihtZXNzYWdlLnJlYXNvbik7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMlBsYXllck92ZXJ3YXRjaENhc2VBc3NpZ25tZW50KCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5jYXNlaWQgPSByZWFkZXIudWludDY0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5jYXNldXJsID0gcmVhZGVyLnN0cmluZygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudmVyZGljdCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnRpbWVzdGFtcCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA1OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnRocm90dGxlc2Vjb25kcyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA2OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnN1c3BlY3RpZCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA3OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmZyYWN0aW9uaWQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgODpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5udW1yb3VuZHMgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgOTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5mcmFjdGlvbnJvdW5kcyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxMDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zdHJlYWtjb252aWN0aW9ucyA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDExOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnJlYXNvbiA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iLCBfYywgX2QsIF9lLCBfZiwgX2csIF9oLCBfaiwgX2s7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ01zZ0dDQ1N0cmlrZTE1VjJQbGF5ZXJPdmVyd2F0Y2hDYXNlQXNzaWdubWVudCgpO1xuICAgICAgICBtZXNzYWdlLmNhc2VpZCA9XG4gICAgICAgICAgICBvYmplY3QuY2FzZWlkICE9PSB1bmRlZmluZWQgJiYgb2JqZWN0LmNhc2VpZCAhPT0gbnVsbFxuICAgICAgICAgICAgICAgID8gTG9uZy5mcm9tVmFsdWUob2JqZWN0LmNhc2VpZClcbiAgICAgICAgICAgICAgICA6IExvbmcuVVpFUk87XG4gICAgICAgIG1lc3NhZ2UuY2FzZXVybCA9IChfYSA9IG9iamVjdC5jYXNldXJsKSAhPT0gbnVsbCAmJiBfYSAhPT0gdm9pZCAwID8gX2EgOiBcIlwiO1xuICAgICAgICBtZXNzYWdlLnZlcmRpY3QgPSAoX2IgPSBvYmplY3QudmVyZGljdCkgIT09IG51bGwgJiYgX2IgIT09IHZvaWQgMCA/IF9iIDogMDtcbiAgICAgICAgbWVzc2FnZS50aW1lc3RhbXAgPSAoX2MgPSBvYmplY3QudGltZXN0YW1wKSAhPT0gbnVsbCAmJiBfYyAhPT0gdm9pZCA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uICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc3RhdHVzaWQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNNc2dHQ0NTdHJpa2UxNVYyUGxheWVyT3ZlcndhdGNoQ2FzZVN0YXR1cygpO1xuICAgICAgICBtZXNzYWdlLmNhc2VpZCA9XG4gICAgICAgICAgICBvYmplY3QuY2FzZWlkICE9PSB1bmRlZmluZWQgJiYgb2JqZWN0LmNhc2VpZCAhPT0gbnVsbFxuICAgICAgICAgICAgICAgID8gTG9uZy5mcm9tVmFsdWUob2JqZWN0LmNhc2VpZClcbiAgICAgICAgICAgICAgICA6IExvbmcuVVpFUk87XG4gICAgICAgIG1lc3NhZ2Uuc3RhdHVzaWQgPSAoX2EgPSBvYmplY3Quc3RhdHVzaWQpICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6IDA7XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH1cbn07XG5mdW5jdGlvbiBjcmVhdGVCYXNlQ0NsaWVudEhlYWRlck92ZXJ3YXRjaEV2aWRlbmNlKCkge1xuICAgIHJldHVybiB7IGFjY291bnRpZDogMCwgY2FzZWlkOiBMb25nLlVaRVJPIH07XG59XG5leHBvcnRzLkNDbGllbnRIZWFkZXJPdmVyd2F0Y2hFdmlkZW5jZSA9IHtcbiAgICBlbmNvZGUobWVzc2FnZSwgd3JpdGVyID0gbWluaW1hbF8xLldyaXRlci5jcmVhdGUoKSkge1xuICAgICAgICBpZiAobWVzc2FnZS5hY2NvdW50aWQgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoOCkudWludDMyKG1lc3NhZ2UuYWNjb3VudGlkKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAoIW1lc3NhZ2UuY2FzZWlkLmlzWmVybygpKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDE2KS51aW50NjQobWVzc2FnZS5jYXNlaWQpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiB3cml0ZXI7XG4gICAgfSxcbiAgICBkZWNvZGUoaW5wdXQsIGxlbmd0aCkge1xuICAgICAgICBjb25zdCByZWFkZXIgPSBpbnB1dCBpbnN0YW5jZW9mIG1pbmltYWxfMS5SZWFkZXIgPyBpbnB1dCA6IG5ldyBtaW5pbWFsXzEuUmVhZGVyKGlucHV0KTtcbiAgICAgICAgbGV0IGVuZCA9IGxlbmd0aCA9PT0gdW5kZWZpbmVkID8gcmVhZGVyLmxlbiA6IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ0NsaWVudEhlYWRlck92ZXJ3YXRjaEV2aWRlbmNlKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5hY2NvdW50aWQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAg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ZXIgPSBtaW5pbWFsXzEuV3JpdGVyLmNyZWF0ZSgpKSB7XG4gICAgICAgIGlmIChtZXNzYWdlLmlkICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDgpLnVpbnQzMihtZXNzYWdlLmlkKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS50eXBlICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDE2KS51aW50MzIobWVzc2FnZS50eXBlKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5wYXlsb2FkLmxlbmd0aCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigyNikuYnl0ZXMobWVzc2FnZS5wYXlsb2FkKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNNc2dHQ0NTdHJpa2UxNVYyR0MyQ2xpZW50VGV4dE1zZygpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuaWQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50eXBlID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucGF5bG9hZCA9IHJlYWRlci5ieXRlcygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2IsIF9jO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNNc2dHQ0NTdHJpa2UxNVYyR0MyQ2xpZW50VGV4dE1zZygpO1xuICAgICAgICBtZXNzYWdlLmlkID0gKF9hID0gb2JqZWN0LmlkKSAhPT0gbnVsbCAmJiBfYSAhPT0gdm9pZCAwID8gX2EgOiAwO1xuICAgICAgICBtZXNzYWdlLnR5cGUgPSAoX2IgPSBvYmplY3QudHlwZSkgIT09IG51bGwgJiYgX2IgIT09IHZvaWQgMCA/IF9iIDogMDtcbiAgICAgICAgbWVzc2FnZS5wYXlsb2FkID0gKF9jID0gb2JqZWN0LnBheWxvYWQpICE9PSBudWxsICYmIF9jICE9PSB2b2lkIDAgPyBfYyA6IG5ldyBVaW50OEFycmF5KCk7XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH1cbn07XG5mdW5jdGlvbiBjcmVhdGVCYXNlQ01zZ0dDQ1N0cmlrZTE1VjJDbGllbnQyR0NUZXh0TXNnKCkge1xu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ICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zZXJ2ZXJpbmZvID0gZXhwb3J0cy5DTXNnR0NDU3RyaWtlMTVWMk1hdGNobWFraW5nU2VydmVyUmVzZXJ2YXRpb25SZXNwb25zZS5kZWNvZGUocmVhZGVyLCByZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubWF0Y2hFbmRRdWVzdERhdGEgPSBleHBvcnRzLkNNc2dHQ1NlcnZlclF1ZXN0VXBkYXRlRGF0YS5kZWNvZGUocmVhZGVyLCByZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ01zZ0dDQ1N0cmlrZTE1VjJNYXRjaEVuZFJ1blJld2FyZERyb3BzKCk7XG4gICAgICAgIG1lc3NhZ2Uuc2VydmVyaW5mbyA9XG4gICAgICAgICAgICBvYmplY3Quc2VydmVyaW5mbyAhPT0gdW5kZWZpbmVkICYmIG9iamVjdC5zZXJ2ZXJpbmZvICE9PSBudWxsXG4gICAgICAgICAgICAgICAgPyBleHBvcnRzLkNNc2dHQ0NTdHJpa2UxNVYyTWF0Y2htYWtpbmdTZXJ2ZXJSZXNlcnZhdGlvblJlc3BvbnNlLmZyb21QYXJ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ZGV4OiAwXG4gICAgfTtcbn1cbmV4cG9ydHMuQ0Vjb25JdGVtUHJldmlld0RhdGFCbG9jayA9IHtcbiAgICBlbmNvZGUobWVzc2FnZSwgd3JpdGVyID0gbWluaW1hbF8xLldyaXRlci5jcmVhdGUoKSkge1xuICAgICAgICBpZiAobWVzc2FnZS5hY2NvdW50aWQgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoOCkudWludDMyKG1lc3NhZ2UuYWNjb3VudGlkKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAoIW1lc3NhZ2UuaXRlbWlkLmlzWmVybygpKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDE2KS51aW50NjQobWVzc2FnZS5pdGVtaWQpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmRlZmluZGV4ICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDI0KS51aW50MzIobWVzc2FnZS5kZWZpbmRleCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UucGFpbnRpbmRleCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigzMikudWludDMyKG1lc3NhZ2UucGFpbnRpbmRleCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UucmFyaXR5ICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDQwKS51aW50MzIobWVzc2FnZS5yYXJpdHkpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnF1YWxpdHkgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNDgpLnVpbnQzMihtZXNzYWdlLnF1YWxpdHkpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnBhaW50d2VhciAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig1NikudWludDMyKG1lc3NhZ2UucGFpbnR3ZWFyKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5wYWludHNlZWQgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNjQpLnVpbnQzMihtZXNzYWdlLnBhaW50c2VlZCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2Uua2lsbGVhdGVyc2NvcmV0eXBlICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDcyKS51aW50MzIobWVzc2FnZS5raWxsZWF0ZXJzY29yZXR5cGUpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmtpbGxlYXRlcnZhbHVlICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDgwKS51aW50MzIobWVzc2FnZS5raWxsZWF0ZXJ2YWx1ZSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuY3VzdG9tbmFtZSAhPT0gXCJcIikge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig5MCkuc3RyaW5nKG1lc3NhZ2UuY3VzdG9tbmFtZSk7XG4gICAgICAgIH1cbiAgICAgICAgZm9yIChjb25zdCB2IG9mIG1lc3NhZ2Uuc3RpY2tlcnMpIHtcbiAgICAgICAgICAgIGV4cG9ydHMuQ0Vjb25JdGVtUHJldmlld0RhdGFCbG9ja19TdGlja2VyLmVuY29kZSh2LCB3cml0ZXIudWludDMyKDk4KS5mb3JrKCkpLmxkZWxpbSgpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmludmVudG9yeSAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigxMDQpLnVpbnQzMihtZXNzYWdlLmludmVudG9yeSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2Uub3JpZ2luICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDExMikudWludDMyKG1lc3NhZ2Uub3JpZ2luKTtcbiAgICAgICAgfVxuIC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cbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuYWNjb3VudGlkID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuaXRlbWlkID0gcmVhZGVyLnVpbnQ2NCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZGVmaW5kZXggPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5wYWludGluZGV4ID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucmFyaXR5ID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDY6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucXVhbGl0eSA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA3OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnBhaW50d2VhciA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA4OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnBhaW50c2VlZCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA5OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmtpbGxlYXRlcnNjb3JldHlwZSA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxMDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5raWxsZWF0ZXJ2YWx1ZSA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5jdXN0b21uYW1lID0gcmVhZGVyLnN0cmluZygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDEyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnN0aWNrZXJzLnB1c2goZXhwb3J0cy5DRWNvbkl0ZW1QcmV2aWV3RGF0YUJsb2NrX1N0aWNrZXIuZGVjb2RlKHJlYWRlciwgcmVhZGVyLnVpbnQzMigpKSk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuaW52ZW50b3J5ID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDE0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm9yaWdpbiA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxNTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5xdWVzdGlkID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDE2OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmRyb3ByZWFzb24gPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTc6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubXVzaWNpbmRleCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxODpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5lbnRpbmRleCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2IsIF9jLCBfZCwgX2UsIF9mLCBfZywgX2gsIF9qLCBfaywgX2wsIF9tLCBfbywgX3AsIF9xLCBfciwgX3M7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ0Vjb25JdGVtUHJldmlld0RhdGFCbG9jaygpO1xuICAgICAgICBtZXNzYWdlLmFjY291bnRpZCA9IChfYSA9IG9iamVjdC5hY2NvdW50aWQpICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6IDA7XG4gICAgICAgIG1lc3NhZ2UuaXRlbWlkID1cbiAgICAgICAgICAgIG9iamVjdC5pdGVtaWQgIT09IHVuZGVmaW5lZCAmJiBvYmplY3QuaXRlbWlkICE9PSBudWxsXG4gICAgICAgICAgICAgICAgPyBMb25nLmZyb21WYWx1ZShvYmplY3QuaXRlbWlkKVxuICAgICAgICAgICAgICAgIDogTG9u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gpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNFY29uSXRlbVByZXZpZXdEYXRhQmxvY2tfU3RpY2tlcigpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc2xvdCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnN0aWNrZXJJZCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLndlYXIgPSByZWFkZXIuZmxvYXQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnNjYWxlID0gcmVhZGVyLmZsb2F0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5yb3RhdGlvbiA9IHJlYWRlci5mbG9hdCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDY6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudGludElkID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2IsIF9jLCBfZCwgX2UsIF9mO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNFY29uSXRlbVByZXZpZXdEYXRhQmxvY2tfU3RpY2tlcigpO1xuICAgICAgICBtZXNzYWdlLnNsb3QgPSAoX2EgPSBvYmplY3Quc2xvdCkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogMDtcbiAgICAgICAgbWVzc2FnZS5zdGlja2VySWQgPSAoX2IgPSBvYmplY3Quc3RpY2tlcklkKSAhPT0gbnVsbCAmJiBfYiAhPT0gdm9pZCAwID8gX2IgOiAwO1xuICAgICAgICBtZXNzYWdlLndlYXIgPSAoX2MgPSBvYmplY3Qud2VhcikgIT09IG51bGwgJiYgX2MgIT09IHZvaWQgMCA/IF9jIDogMDtcbiAgICAgICAgbWVzc2FnZS5zY2FsZSA9IChfZCA9IG9iamVjdC5zY2FsZSkgIT09IG51bGwgJiYgX2QgIT09IHZvaWQgMCA/IF9kIDogMDtcbiAgICAgICAgbWVzc2FnZS5yb3RhdGlvbiA9IChfZSA9IG9iamVjdC5yb3RhdGlvbikgIT09IG51bGwgJiYgX2UgIT09IHZvaWQgMCA/IF9lIDogMDtcbiAgICAgICAg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24oKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSA2OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLml0ZW1pbmZvID0gZXhwb3J0cy5DRWNvbkl0ZW1QcmV2aWV3RGF0YUJsb2NrLmRlY29kZShyZWFkZXIsIHJlYWRlci51aW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMk1hdGNoRW5kUmV3YXJkRHJvcHNOb3RpZmljYXRpb24oKTtcbiAgICAgICAgbWVzc2FnZS5pdGVtaW5mbyA9XG4gICAgICAgICAgICBvYmplY3QuaXRlbWluZm8gIT09IHVuZGVmaW5lZCAmJiBvYmplY3QuaXRlbWluZm8gIT09IG51bGxcbiAgICAgICAgICAgICAgICA/IGV4cG9ydHMuQ0Vjb25JdGVtUHJldmlld0RhdGFCbG9jay5mcm9tUGFydGlhbChvYmplY3QuaXRlbWluZm8pXG4gICAgICAgICAgICAgICAgOiB1bmRlZmluZWQ7XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH1cbn07XG5mdW5jdGlvbiBjcmVhdGVCYXNlQ01zZ0l0ZW1BY2tub3dsZWRnZWQoKSB7XG4gICAg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KCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5wYXJhbVMgPSByZWFkZXIudWludDY0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5wYXJhbUEgPSByZWFkZXIudWludDY0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5wYXJhbUQgPSByZWFkZXIudWludDY0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5wYXJhbU0gPSByZWFkZXIudWludDY0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMkNsaWVudDJHQ0Vjb25QcmV2aWV3RGF0YUJsb2NrUmVxdWVzdCgpO1xuICAgICAgICBtZXNzYWdlLnBhcmFtUyA9XG4gICAgICAgICAgICBvYmplY3QucGFyYW1TICE9PSB1bmRlZmluZWQgJiYgb2JqZWN0LnBhcmFtUyAhPT0gbnVsbFxuICAgICAgICAgICAgICAgID8gTG9uZy5mcm9tV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G1lc3NhZ2UuYWNjb3VudGlkICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDgpLnVpbnQzMihtZXNzYWdlLmFjY291bnRpZCk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMk1hdGNoTGlzdFJlcXVlc3RMaXZlR2FtZUZvclVzZXIoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmFjY291bnRpZCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2E7XG4gICAgICAgIGNvbn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yA9IHtcbiAgICBlbmNvZGUobWVzc2FnZSwgd3JpdGVyID0gbWluaW1hbF8xLldyaXRlci5jcmVhdGUoKSkge1xuICAgICAgICBpZiAobWVzc2FnZS5ldmVudGlkICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDgpLmludDMyKG1lc3NhZ2UuZXZlbnRpZCk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMk1hdGNoTGlzdFJlcXVlc3RUb3VybmFtZW50R2FtZXMoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmV2ZW50aWQgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc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ZS50b2tlbik7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMk1hdGNoTGlzdFJlcXVlc3RGdWxsR2FtZUluZm8oKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm1hdGNoaWQgPSByZWFkZXIudWludDY0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5vdXRjb21laWQgPSByZWFkZXIudWludDY0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50b2tlbiA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAg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cy5XYXRjaGFibGVNYXRjaEluZm8uZGVjb2RlKHJlYWRlciwgcmVhZGVyLnVpbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnJvdW5kc3RhdHNMZWdhY3kgPSBleHBvcnRzLkNNc2dHQ0NTdHJpa2UxNVYyTWF0Y2htYWtpbmdTZXJ2ZXJSb3VuZFN0YXRzLmRlY29kZShyZWFkZXIsIHJlYWRlci51aW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5yb3VuZHN0YXRzYWxsLnB1c2goZXhwb3J0cy5DTXNnR0NDU3RyaWtlMTVWMk1hdGNobWFraW5nU2VydmVyUm91bmRTdGF0cy5kZWNvZGUocmVhZGVyLCByZWFkZXIudWludDMyKCkpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNEYXRhR0NDU3RyaWtlMTVWMk1hdGNoSW5mbygpO1xuICAgICAgICBtZXNzYWdlLm1hdGNoaWQgPVxuICAgICAgICAgICAgb2JqZWN0Lm1hdGNoaWQgIT09IHVuZGVmaW5lZCAmJiBvYmplY3QubWF0Y2hpZCAhPT0gbnVsbFxuICAgICAgICAgICAgICAgID8gTG9uZy5mcm9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VhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDRGF0YUdDQ1N0cmlrZTE1VjJUb3VybmFtZW50R3JvdXBUZWFtKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50ZWFtSWQgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnNjb3JlID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5jb3JyZWN0cGljayA9IHJlYWRlci5ib29sKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCBfYiwgX2M7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ0RhdGFHQ0NTdHJpa2UxNVYyVG91cm5hbWVudEdyb3VwVGVhbSgpO1xuICAgICAgICBtZXNzYWdlLnRlYW1JZCA9IChfYSA9IG9iamVjdC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AgICAgICAgICAgd3JpdGVyLnVpbnQzMigxOCkuc3RyaW5nKG1lc3NhZ2UubmFtZSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuZGVzYyAhPT0gXCJcIikge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigyNikuc3RyaW5nKG1lc3NhZ2UuZGVzYyk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UucGlja3NEZXByZWNhdGVkICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDMyKS51aW50MzIobWVzc2FnZS5waWNrc0RlcHJlY2F0ZWQpO1xuICAgICAgICB9XG4gICAgICAgIGZvciAoY29uc3QgdiBvZiBtZXNzYWdlLnRlYW1zKSB7XG4gICAgICAgICAgICBleHBvcnRzLkNEYXRhR0NDU3RyaWtlMTVWMlRvdXJuYW1lbnRHcm91cFRlYW0uZW5jb2RlKHYsIHdyaXRlci51aW50MzIoNDIpLmZvcmsoKSkubGRlbGltKCk7XG4gICAgICAgIH1cbiAgICAgICAgd3JpdGVyLnVpbnQzMig1MCkuZm9yaygpO1xuICAgICAgICBmb3IgKGNvbnN0IHYgb2YgbWVzc2FnZS5zdGFnZUlkcykge1xuICAgICAgICAgICAgd3JpdGVyLmludDMyKHYpO1xuICAgICAgICB9XG4gICAgICAgIHdyaXRlci5sZGVsaW0oKTtcbiAgICAgICAgaWYgKG1lc3NhZ2UucGlja2xvY2t1bnRpbHRpbWUgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNTYpLnVpbnQzMihtZXNzYWdlLnBpY2tsb2NrdW50aWx0aW1lKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5waWNrYWJsZXRlYW1zICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDY0KS51aW50MzIobWVzc2FnZS5waWNrYWJsZXRlYW1zKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5wb2ludHNQZXJQaWNrICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDcyKS51aW50MzIobWVzc2FnZS5wb2ludHNQZXJQaWNrKTtcbiAgICAgICAgfVxuICAgICAgICBmb3IgKGNvbnN0IHYgb2YgbWVzc2FnZS5waWNrcykge1xuICAgICAgICAgICAgZXhwb3J0cy5DRGF0YUdDQ1N0cmlrZTE1VjJUb3VybmFtZW50R3JvdXBfUGlja3MuZW5jb2RlKHYsIHdyaXRlci51aW50MzIoODIpLmZvcmsoKSkubGRlbGltKCk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDRGF0YUdDQ1N0cmlrZTE1VjJUb3VybmFtZW50R3JvdXAoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmdyb3VwaWQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5uYW1lID0gcmVhZGVyLnN0cmluZygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZGVzYyA9IHJlYWRlci5zdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnBpY2tzRGVwcmVjYXRlZCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA1OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnRlYW1zLnB1c2goZXhwb3J0cy5DRGF0YUdDQ1N0cmlrZTE1VjJUb3VybmFtZW50R3JvdXBUZWFtLmRlY29kZShyZWFkZXIsIHJlYWRlci51aW50MzIoKSkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDY6XG4gICAgICAgICAgICAgICAgICAgIGlmICgodGFnICYgNykgPT09IDIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGVuZDIgPSByZWFkZXIudWludDMyKCkgKyByZWFkZXIucG9zO1xuICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zdGFnZUlkcy5wdXNoKHJlYWRlci5pbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc3RhZ2VJZHMucHVzaChyZWFkZXIuaW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA3OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnBpY2tsb2NrdW50aWx0aW1lID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDg6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucGlja2FibGV0ZWFtcyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA5OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnBvaW50c1BlclBpY2sgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTA6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucGlja3MucHVzaChleHBvcnRzLkNEYXRhR0NDU3RyaWtlMTVWMlRvdXJuYW1lbnRHcm91cF9QaWNrcy5kZWNvZGUocmVhZGVyLCByZWFkZXIudWludDMyKCkpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iLCBfYywgX2QsIF9lLCBfZiwgX2csIF9oLCBfaiwgX2s7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ0RhdGFHQ0NTdHJpa2UxNVYyVG91cm5hbWVudEdyb3VwKCk7XG4gICAgICAgIG1lc3NhZ2UuZ3JvdXBpZCA9IChfYSA9IG9iamVjdC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A9PT0gdW5kZWZpbmVkID8gcmVhZGVyLmxlbiA6IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ0RhdGFHQ0NTdHJpa2UxNVYyVG91cm5hbWVudEdyb3VwX1BpY2tzKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgaWYgKCh0YWcgJiA3KSA9PT0gMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZW5kMiA9IHJlYWRlci51aW50MzIoKSArIHJlYWRlci5wb3M7XG4gICAgICAgICAgICAgICAgICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZDIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnBpY2tpZHMucHVzaChyZWFkZXIuaW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnBpY2tpZHMucHVzaChyZWFkZXIuaW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1x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IG1lc3NhZ2UuZ3JvdXBzKSB7XG4gICAgICAgICAgICBleHBvcnRzLkNEYXRhR0NDU3RyaWtlMTVWMlRvdXJuYW1lbnRHcm91cC5lbmNvZGUodiwgd3JpdGVyLnVpbnQzMigzNCkuZm9yaygpKS5sZGVsaW0oKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNEYXRhR0NDU3RyaWtlMTVWMlRvdXJuYW1lbnRTZWN0aW9uKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zZWN0aW9uaWQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5uYW1lID0gcmVhZGVyLnN0cmluZygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZGVzYyA9IHJlYWRlci5zdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmdyb3Vwcy5wdXNoKGV4cG9ydHMuQ0RhdGFHQ0NTdHJpa2UxNVYyVG91cm5hbWVudEdyb3VwLmRlY29kZShyZWFkZXIsIHJlYWRlci51aW50MzIoKSkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2IsIF9jLCBfZDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDRGF0YUdDQ1N0cmlrZTE1VjJUb3VybmFtZW50U2VjdGlvbigpO1xuICAgICAgICBtZXNzYWdlLnNlY3Rpb25pZCA9IChfYSA9IG9iamVjdC5zZWN0aW9uaWQpICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6IDA7XG4gICAgICAgIG1lc3NhZ2UubmFtZSA9IChfYiA9IG9iamVjdC5uYW1lKSAhPT0gbnVsbCAmJiBfYiAhPT0gdm9pZCAwID8gX2IgOiBcIlwiO1xuICAgICAgICBtZXNzYWdlLmRlc2MgPSAoX2MgPSBvYmplY3QuZGVzYykgIT09IG51bGwgJiYgX2MgIT09IHZvaWQgMCA/IF9jIDogXCJcIjtcbiAgICAgICAgbWVzc2FnZS5ncm91cHMgPVxuICAgICAgICAgICAgKChfZCA9IG9iamVjdC5ncm91cHMpID09PSBudWxsIHx8IF9kID09PSB2b2lkIDAgPyB2b2lkIDAgOiBfZC5tYXAoZSA9PiBleHBv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AgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDRGF0YUdDQ1N0cmlrZTE1VjJUb3VybmFtZW50SW5mbygpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc2VjdGlvbnMucHVzaChleHBvcnRzLkNEYXRhR0NDU3RyaWtlMTVWMlRvdXJuYW1lbnRTZWN0aW9uLmRlY29kZShyZWFkZXIsIHJlYWRlci51aW50MzIoKSkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudG91cm5hbWVudEV2ZW50ID0gZXhwb3J0cy5Ub3VybmFtZW50RXZlbnQuZGVjb2RlKHJlYWRlciwgcmVhZGVyLnVpbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnRvdXJuYW1lbnRUZWFtcy5wdXNoKGV4cG9ydHMuVG91cm5hbWVudFRlYW0uZGVjb2RlKHJlYWRlciwgcmVhZGVyLnVpbnQzMigpKSk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCBfYjtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDRGF0YUdDQ1N0cmlrZTE1VjJUb3VybmFtZW50SW5mbygpO1xuICAgICAgICBtZXNzYWdlLnNlY3Rpb25zID1cbiAgICAgICAgICAgICgoX2EgPSBvYmplY3Quc2VjdGlvbnMpID09PSBudWxsIHx8IF9hID09PSB2b2lkIDAgPyB2b2lkIDAgOiBfYS5tYXAoZSA9PiBleHBvcnRzLkNEYXRhR0NDU3RyaWtlMTVWMlRvdXJuYW1lbnRTZWN0aW9uLmZyb21QYXJ0aWFsKGUpKSkgfHwgW107XG4gICAgICAgIG1lc3NhZ2UudG91cm5hbWVudEV2ZW50ID1cbiAgICAgICAgICAgIG9iamVjdC50b3VybmFtZW50RXZlbnQgIT09IHVuZGVmaW5lZCAmJiBvYmplY3QudG91cm5hbWVudEV2ZW50ICE9PSBudWxsXG4gICAgICAgICAgICAgICAgPyBleHBvcnRzLlRvdXJuYW1lbnRFdmVudC5mcm9tUGFydGlhbChvYmplY3QudG91cm5hbWVudEV2ZW50KVxuICAgICAgICAgICAgICAgIDogdW5kZWZpbmVkO1xuICAgICAgICBtZXNzYWdlLnRvdXJuYW1lbnRUZWFtcyA9XG4gICAgICAgICAgICAoKF9iID0gb2JqZWN0LnRvdXJuYW1lbnRUZWFtcykgPT09IG51bGwgfHwgX2IgPT09IHZvaWQgMC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gIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5tc2dyZXF1ZXN0aWQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5hY2NvdW50aWQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zZXJ2ZXJ0aW1lID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubWF0Y2hlcy5wdXNoKGV4cG9ydHMuQ0RhdGFHQ0NTdHJpa2UxNVYyTWF0Y2hJbmZvLmRlY29kZShyZWFkZXIsIHJlYWRlci51aW50MzIoKSkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc3RyZWFtcy5wdXNoKGV4cG9ydHMuVG91cm5hbWVudFRlYW0uZGVjb2RlKHJlYWRlciwgcmVhZGVyLnVpbnQzMigpKSk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50b3VybmFtZW50aW5mbyA9IGV4cG9ydHMuQ0RhdGFHQ0NTdHJpa2UxNVYyVG91cm5hbWVudEluZm8uZGVjb2RlKHJlYWRlciwgcmVhZGVyLnVpbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVy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zZ0dDQ1N0cmlrZTE1VjJQcmVkaWN0aW9uc19Hcm91cE1hdGNoVGVhbVBpY2soKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnNlY3Rpb25pZCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZ3JvdXBpZCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuaW5kZXggPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnRlYW1pZCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuaXRlbWlkID0gcmVhZGVyLnVpbnQ2NCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0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VyID0gbWluaW1hbF8xLldyaXRlci5jcmVhdGUoKSkge1xuICAgICAgICBpZiAobWVzc2FnZS5ldmVudElkICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDgpLnVpbnQzMihtZXNzYWdlLmV2ZW50SWQpO1xuICAgICAgICB9XG4gICAgICAgIGZvciAoY29uc3QgdiBvZiBtZXNzYWdlLnRlYW1zKSB7XG4gICAgICAgICAgICBleHBvcnRzLkNNc2dHQ0NTdHJpa2UxNVYyRmFudGFzeV9GYW50YXN5VGVhbS5lbmNvZGUodiwgd3JpdGVyLnVpbnQzMigxOCkuZm9yaygpKS5sZGVsaW0oKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNNc2dHQ0NTdHJpa2UxNVYyRmFudGFzeSgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZXZlbnRJZCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAg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gICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudHlwZSA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucGljayA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuaXRlbWlkID0gcmVhZGVyLnVpbnQ2NCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2I7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ01zZ0dDQ1N0cmlrZTE1VjJGYW50YXN5X0ZhbnRhc3lTbG90KCk7XG4gICAgICAgIG1lc3NhZ2UudHlwZSA9IChfYSA9IG9iamVjdC50eXBlKSAhPT0gbnVsbCAmJiBfYSAhPT0gdm9pZCAwID8gX2EgOiAwO1xuICAgICAgICBtZXNzYWdlLnBpY2sgPSAoX2IgPSBvYmplY3QucGljaykgIT09IG51bGwgJiYgX2IgIT09IHZvaWQgMCA/IF9iIDogMDtcbiAgICAgICAgbWVzc2FnZS5pdGVtaWQgPVxuICAgICAgICAgICAgb2JqZWN0Lml0ZW1pZCAhPT0gdW5kZWZpbmVkICYmIG9iamVjdC5pdGVtaWQgIT09IG51bGxcbiAgICAgICAgICAgICAgICA/IExvbmcuZnJvbV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GNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMkZhbnRhc3lfRmFudGFzeVRlYW0oKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnNlY3Rpb25pZCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc2xvdHMucHVzaChleHBvcnRzLkNNc2dHQ0NTdHJpa2UxNVYyRmFudGFzeV9GYW50YXN5U2xvdC5kZWNvZGUocmVhZGVyLCByZWFkZXIudWludDMyKCkpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNNc2dHQ0NTdHJpa2UxNVYyRmFudGFzeV9GYW50YXN5VGVhbSgpO1xuICAgICAgICBtZXNzYWdlLnNlY3Rpb25pZCA9IChfYSA9IG9iamVjdC5zZWN0aW9uaWQpICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6IDA7XG4gICAgICAgIG1lc3NhZ2Uuc2xvdHMgPVxuICAgICAgICAgICAgKCh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W5pbWFsXzEuV3JpdGVyLmNyZWF0ZSgpKSB7XG4gICAgICAgIGlmIChtZXNzYWdlLnN0b3JlSXRlbUhhc2ggIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNDApLnVpbnQzMihtZXNzYWdlLnN0b3JlSXRlbUhhc2gpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnRpbWVwbGF5ZWRjb25zZWN1dGl2ZWx5ICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDQ4KS51aW50MzIobWVzc2FnZS50aW1lcGxheWVkY29uc2VjdXRpdmVseSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UudGltZUZpcnN0UGxheWVkICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDgwKS51aW50MzIobWVzc2FnZS50aW1lRmlyc3RQbGF5ZWQpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmxhc3RUaW1lUGxheWVkICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDk2KS51aW50MzIobWVzc2FnZS5sYXN0VGltZVBsYXllZCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UubGFzdElwQWRkcmVzcyAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigxMDQpLnVpbnQzMihtZXNzYWdlLmxhc3RJcEFkZHJlc3MpO1xuICAgICAgICB9XG4gICAgICAgIGlmICghbWVzc2FnZS5nc2Nvb2tpZWlkLmlzWmVybygpKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDE0NCkudWludDY0KG1lc3NhZ2UuZ3Njb29raWVpZCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKCFtZXNzYWdlLnVuaXF1ZWlkLmlzWmVybygpKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDE1MikudWludDY0KG1lc3NhZ2UudW5pcXVlaWQpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiB3cml0ZXI7XG4gICAgfSxcbiAgICBkZWNvZGUoaW5wdXQsIGxlbmd0aCkge1xuICAgICAgICBjb25zdCByZWFkZXIgPSBpbnB1dCBpbnN0YW5jZW9mIG1pbmltYWxfMS5SZWFkZXIgPyBpbnB1dCA6IG5ldyBtaW5pbWFsXzEuUmVhZGVyKGlucHV0KTtcbiAgICAgICAgbGV0IGVuZCA9IGxlbmd0aCA9PT0gdW5kZWZpbmVkID8gcmVhZGVyLmxlbiA6IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ01zZ0NTdHJpa2UxNVdlbGNvbWUoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSA1OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnN0b3JlSXRlbUhhc2ggPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50aW1lcGxheWVkY29uc2VjdXRpdmVseSA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxMDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50aW1lRmlyc3RQbGF5ZWQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubGFzdFRpbWVQbGF5ZWQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubGFzdElwQWRkcmVzcyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxODpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5nc2Nvb2tpZWlkID0gcmVhZGVyLnVpbnQ2NCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDE5OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnVuaXF1ZWlkID0gcmVhZGVyLnVpbnQ2NCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2IsIF9jLCBfZCwgX2U7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ01zZ0NTdHJpa2UxNVdlbGNvbWUoKTtcbiAgICAgICAgbWVzc2FnZS5zdG9yZUl0ZW1IYXNoID0gKF9hID0gb2JqZWN0LnN0b3JlSXRlbUhhc2gpICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6IDA7XG4gICAgICAgIG1lc3NhZ2UudGltZXBsYXllZGNvbnNlY3V0aXZlbHkgPSAoX2IgPSBvYmplY3QudGltZXBsYXllZGNvbnNlY3V0aXZlbHkpICE9PSBudWxsICYmIF9iICE9PSB2b2lkID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bnQ6IDAsXG4gICAgICAgIHNlcnZlckFkZHI6IDAsXG4gICAgICAgIHNlcnZlclBvcnQ6IDAsXG4gICAgICAgIGNob2tlZEJsb2NrczogW11cbiAgICB9O1xufVxuZXhwb3J0cy5DTXNnR0NDU3RyaWtlMTVWMkNsaWVudFZhclZhbHVlTm90aWZpY2F0aW9uSW5mbyA9IHtcbiAgICBlbmNvZGUobWVzc2FnZSwgd3JpdGVyID0gbWluaW1hbF8xLldyaXRlci5jcmVhdGUoKSkge1xuICAgICAgICBpZiAobWVzc2FnZS52YWx1ZU5hbWUgIT09IFwiXCIpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTApLnN0cmluZyhtZXNzYWdlLnZhbHVlTmFtZSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UudmFsdWVJbnQgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTYpLmludDMyKG1lc3NhZ2UudmFsdWVJbnQpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnNlcnZlckFkZHIgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMjQpLnVpbnQzMihtZXNzYWdlLnNlcnZlckFkZHIpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnNlcnZlclBvcnQgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMzIpLnVpbnQzMihtZXNzYWdlLnNlcnZlclBvcnQpO1xuICAgICAgICB9XG4gICAgICAgIGZvciAoY29uc3QgdiBvZiBtZXNzYWdlLmNob2tlZEJsb2Nrcykge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig0Mikuc3RyaW5nKHYpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiB3cml0ZXI7XG4gICAgfSxcbiAgICBkZWNvZGUoaW5wdXQsIGxlbmd0aCkge1xuICAgICAgICBjb25zdCByZWFkZXIgPSBpbnB1dCBpbnN0YW5jZW9mIG1pbmltYWxfMS5SZWFkZXIgPyBpbnB1dCA6IG5ldyBtaW5pbWFsXzEuUmVhZGVyKGlucHV0KTtcbiAgICAgICAgbGV0IGVuZCA9IGxlbmd0aCA9PT0gdW5kZWZpbmVkID8gcmVhZGVyLmxlbiA6IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ01zZ0dDQ1N0cmlrZTE1VjJDbGllbnRWYXJWYWx1ZU5vdGlmaWNhdGlvbkluZm8oKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnZhbHVlTmFtZSA9IHJlYWRlci5zdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnZhbHVlSW50ID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zZXJ2ZXJBZGRyID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc2VydmVyUG9ydCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA1OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmNob2tlZEJsb2Nrcy5wdXNoKH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XG4gICAgfSxcbiAgICBkZWNvZGUoaW5wdXQsIGxlbmd0aCkge1xuICAgICAgICBjb25zdCByZWFkZXIgPSBpbnB1dCBpbnN0YW5jZW9mIG1pbmltYWxfMS5SZWFkZXIgPyBpbnB1dCA6IG5ldyBtaW5pbWFsXzEuUmVhZGVyKGlucHV0KTtcbiAgICAgICAgbGV0IGVuZCA9IGxlbmd0aCA9PT0gdW5kZWZpbmVkID8gcmVhZGVyLmxlbiA6IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ01zZ0dDQ1N0cmlrZTE1VjJTZXJ2ZXJWYXJWYWx1ZU5vdGlmaWNhdGlvbkluZm8oKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmFjY291bnRpZCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBpZiAoKHRhZyAmIDcpID09PSAyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBlbmQyID0gcmVhZGVyLnVpbnQzMigpICsgcmVhZGVyLnBvcztcbiAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uudmlld2FuZ2xlcy5wdXNoKHJlYWRlci51aW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnZpZXdhbmdsZXMucHVzaChyZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50eXBlID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgICAgICAgICAgIGlmICgodGFnICYgNykgPT09IDIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGVuZDIgPSByZWFkZXIudWludDMyKCkgKyByZWFkZXIucG9zO1xuICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS51c2VyZGF0YS5wdXNoKHJlYWRlci51aW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnVzZXJkYXRhLnB1c2gocmVhZGVyLnVpbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2IsIF9jLCBfZDtcbiAgICAgICAgY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VhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNNc2dHQ0NTdHJpa2UxNVYyR2lmdHNMZWFkZXJib2FyZFJlc3BvbnNlKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zZXJ2ZXJ0aW1lID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudGltZVBlcmlvZFNlY29uZHMgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50b3RhbEdpZnRzR2l2ZW4gPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50b3RhbEdpdmVycyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA1OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmVudH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F8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMkdpZnRzTGVhZGVyYm9hcmRSZXNwb25zZV9HaWZ0TGVhZGVyYm9hcmRFbnRyeSgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuYWNjb3VudGlkID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZ2lmdHMgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCBfYjtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMkdpZnRzTGVhZGVyYm9hcmRSZXNwb25zZV9HaWZ0TGVhZ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3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMkNsaWVudFN1Ym1pdFN1cnZleVZvdGUoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnN1cnZleUlkID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uudm90ZSA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNNc2dHQ0NTdHJpa2UxNVYyQ2xpZW50U3VibWl0U3VydmV5Vm90ZSgpO1xuICAgICAgICBtZXNzYWdlLnN1cnZleUlkID0gKF9hID0gb2JqZWN0LnN1cnZleUlkKSAhPT0gbnVsbCAmJiBfYSAhPT0gdm9pZCAwID8gX2EgOiAwO1xuICAgICAgICBtZXNzYWdlLnZvdGUgPSAo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4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmV2ZW50aWQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zdGFnZWlkID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZ2FtZVR5cGUgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgaWYgKCh0YWcgJiA3KSA9PT0gMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZW5kMiA9IHJlYWRlci51aW50MzIoKSArIHJlYWRlci5wb3M7XG4gICAgICAgICAgICAgICAgICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZDIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnRlYW1pZHMucHVzaChyZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50ZWFtaWRzLnB1c2gocmVhZGVyLnVpbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gIC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kudWludDMyKG1lc3NhZ2UuZW50cnlpZCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuZGVmaWR4ICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDE2KS51aW50MzIobWVzc2FnZS5kZWZpZHgpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmV4cGlyYXRpb25EYXRlICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDI5KS5maXhlZDMyKG1lc3NhZ2UuZXhwaXJhdGlvbkRhdGUpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiB3cml0ZXI7XG4gICAgfSxcbiAgICBkZWNvZGUoaW5wdXQsIGxlbmd0aCkge1xuICAgICAgICBjb25zdCByZWFkZXIgPSBpbnB1dCBpbnN0YW5jZW9mIG1pbmltYWxfMS5SZWFkZXIgPyBpbnB1dCA6IG5ldyBtaW5pbWFsXzEuUmVhZGVyKGlucHV0KTtcbiAgICAgICAgbGV0IGVuZCA9IGxlbmd0aCA9PT0gdW5kZWZpbmVkID8gcmVhZGVyLmxlbiA6IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ1NPRWNvbkNvdXBvbigpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZW50cnlpZCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmRlZmlkeCA9IHJlYWRlci51aW50MzIoKTt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gICAgICAgICAgICAgICBtZXNzYWdlLnF1ZXN0aWQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5wb2ludHNSZW1haW5pbmcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5ib251c1BvaW50cyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iLCBfYztcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDU09RdWVzdFByb2dyZXNzKCk7XG4gICAgICAgIG1lc3NhZ2UucXVlc3RpZCA9IChfYSA9IG9iamVjdC5xdWVzdGlkKSAhPT0gbnVsbCAmJiBfYSAhPT0gdm9pZCAwID8gX2EgOiAwO1xuICAgICAgICBtZXNzYWdlLnBvaW50c1JlbWFpbmluZyA9IChfYiA9IG9iamVjdC5wb2ludHNSZW1haW5pbmcpICE9PSBudWxsICYmIF9iICE9PSB2b2lkIDAgPyBfYiA6IDA7XG4gICAgICAgIG1lc3NhZ2UuYm9udXNQb2ludHMgPSAoX2MgPSBvYmplY3QuYm9udXNQb2ludHMpICE9PSBudWxsICYmIF9jICE9PSB2b2lkIDAgPyBfYyA6IDA7XG4gICAgICAgIHJldHVyb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SByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50aWVyVW5sb2NrZWQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5wcmVtaXVtVGllcnMgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5taXNzaW9uSWQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5taXNzaW9uc0NvbXBsZXRlZCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA2OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnJlZGVlbWFibGVCYWxhbmNlID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDc6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc2Vhc29uUGFzc1RpbWUgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG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B0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50aW1lTmV4dEN5Y2xlID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudGltZUluaXRpYXRlZCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNTT0FjY291bnRSZWN1cnJpbmdTdWJzY3JpcHRpb24oKTtcbiAgICAgICAgbWVzc2FnZS50aW1lTmV4dEN5Y2xlID0gKF9hID0gb2JqZWN0LnRpbWVOZXh0Q3ljbGUpICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6IDA7XG4gICAgICAgIG1lc3NhZ2UudGltZUluaXRpYXRlZCA9IChfYiA9IG9iamVjdC50aW1lSW5pdGlhdGVkKSAhPT0gbnVsbCAmJiBfYiAhPT0gdm9pZCAwID8gX2IgOiAwO1xuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9XG59O1xuZnVuY3Rpb24gY3JlYXRlQmFzZUNTT1BlcnNvbmFEYXRhUHVibGljKCkge1xuICAgIHJldHVybiB7IHBsYXllckxld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GVCYXNlQ1NPUGVyc29uYURhdGFQdWJsaWMoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnBsYXllckxldmVsID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5jb21tZW5kYXRpb24gPSBleHBvcnRzLlBsYXllckNvbW1lbmRhdGlvbkluZm8uZGVjb2RlKHJlYWRlciwgcmVhZGVyLnVpbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmVsZXZhdGVkU3RhdGUgPSByZWFkZXIuYm9vbCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2I7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ1NPUGVyc29uYURhdGFQdWJsaWMoKTtcbiAgICAgICAgbWVzc2FnZS5wbGF5ZXJMZXZlbCA9IChfYSA9IG9iamVjdC5wbGF5ZXJMZXZlbCkgIT09IG51bGwgJiYgX2E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xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NHbG9iYWxHYW1lU3Vic2NyaWJlKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50aWNrZXQgPSByZWFkZXIudWludDY0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NHbG9iYWxHYW1lU3Vic2NyaWJlKCk7XG4gICAgICAgIG1lc3NhZ2UudGlja2V0ID1cbiAgICAgICAgICAgIG9iamVjdC50aWNrZXQgIT09IHVuZGVmaW5lZCAmJiBvYmplY3QudGlja2V0ICE9PSBudWxsXG4gICAgICAgICAgICAgICAgPyBMb25nLmZyb21WYWx1ZShvYmplY3QudGlja2V0KVxuICAgICAgICAgICAgICAgIDogTG9uZy5VWkVSTztcbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfVxufTtcbmZ1bmN0aW9uIGNyZWF0ZUJhc2VDTXNnR0NHbG9iYWxH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pbnQzMihtZXNzYWdlLm1zcGVycG9pbnQpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiB3cml0ZXI7XG4gICAgfSxcbiAgICBkZWNvZGUoaW5wdXQsIGxlbmd0aCkge1xuICAgICAgICBjb25zdCByZWFkZXIgPSBpbnB1dCBpbnN0YW5jZW9mIG1pbmltYWxfMS5SZWFkZXIgPyBpbnB1dCA6IG5ldyBtaW5pbWFsXzEuUmVhZGVyKGlucHV0KTtcbiAgICAgICAgbGV0IGVuZCA9IGxlbmd0aCA9PT0gdW5kZWZpbmVkID8gcmVhZGVyLmxlbiA6IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ01zZ0dDR2xvYmFsR2FtZVBsYXkoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnRpY2tldCA9IHJlYWRlci51aW50NjQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmdhbWV0aW1lbXMgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5tc3BlcnBvaW50ID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAg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AgICAgd3JpdGVyLnVpbnQzMig4KS5pbnQzMihtZXNzYWdlLmFja25vd2xlZGdlZCk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMkFja25vd2xlZGdlUGVuYWx0eSgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuYWNrbm93bGVkZ2VkID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNNc2dHQ0NTdHJpa2UxNV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nQzMihtZXNzYWdlLnByZXN0aWdldGltZSk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMkNsaWVudDJHQ1JlcXVlc3RQcmVzdGlnZUNvaW4oKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmRlZmluZGV4ID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudXBncmFkZWlkID0gcmVhZGVyLnVpbnQ2NCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuaG91cnMgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5wcmVzdGlnZXRp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1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50aWNrZXQgPSByZWFkZXIudWludDY0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5vcyA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYTtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMkNsaWVudDJHQ1N0cmVhbVVubG9jaygpO1xuICAgICAgICBtZXNzYWdlLnRpY2tldCA9XG4gICAgICAgICAgICBvYmplY3QudGlja2V0ICE9PSB1bmRlZmluZWQgJiYgb2JqZWN0LnRpY2tldCAhPT0gbnVsbFxuICAgICAgICAgICAgICAgID8gTG9uZy5mcm9tVmFsdWUob2JqZWN0LnRpY2tldClcbiAgICAgICAgICAgICAgICA6IExvbmcuVVpFUk87XG4gICAgICAgIG1lc3NhZ2Uub3MgPSAoX2EgPSBvYmplY3Qub3MpICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6IDA7XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH1cbn07XG5mdW5jdGlvbiBjcmVhdGVCYXNlQ01zZ0dDQ1N0cmlrZTE1VjJDbGllbnRUb0dDUmVxdWVzdEVsZXZhdGUoKSB7XG4gICAgcmV0dXJuIHsgc3RhZ2U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xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNNc2dHQ0NTdHJpa2UxNVYyR0NUb0NsaWVudENoYXQoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmFjY291bnRJZCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnRleHQgPSByZWFkZXIuc3RyaW5nKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCBfYjtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMkdDVG9DbGllbnRDaGF0KCk7XG4gICAgICAgIG1lc3NhZ2UuYWNjb3VudElkID0gKF9hID0gb2JqZWN0LmFjY291bnRJZCkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogM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ZW50QXV0aEtleUNvZGUoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmV2ZW50aWQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5jb2RlID0gcmVhZGVyLnN0cmluZygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2I7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ01zZ0dDQ1N0cmlrZTE1VjJDbGllbnRBdXRoS2V5Q29kZSgpO1xuICAgICAgICBtZXNzYWdlLmV2ZW50aWQgPSAoX2EgPSBvYmplY3QuZXZlbnRpZCkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogMDtcbiAgICAgICAgbWVzc2FnZS5jb2RlID0gKF9iID0gb2JqZWN0LmNvZGUpICE9PSBudWxsICYmIF9iICE9PSB2b2lkIDAgPyBfYiA6IFwiXCI7XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH1cbn07XG5mdW5jdGlvbiBjcmVhdGVCYXNlQ01zZ0dDQ1N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R290dlN5bmNQYWNrZXQuZGVjb2RlKHJlYWRlciwgcmVhZGVyLnVpbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNNc2dHQ0NTdHJpa2UxNUdvdHZTeW5jUGFja2V0KCk7XG4gICAgICAgIG1lc3NhZ2UuZGF0YSA9XG4gICAgICAgICAgICBvYmplY3QuZGF0YSAhPT0gdW5kZWZpbmVkICYmIG9iamVjdC5kYXRhICE9PSBudWxsXG4gICAgICAgICAgICAgICAgPyBlbmdpbmVfZ2NtZXNzYWdlc18xLkNFbmdpbmVHb3R2U3luY1BhY2tldC5mcm9tUGFydGlhbChvYmplY3QuZGF0YSlcbiAgICAgICAgICAgICAgICA6IHVuZGVmaW5lZDtcbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfVxufTtcbmZ1bmN0aW9uIGNyZWF0ZUJhc2VQbGF5ZXJEZWNhbERpZ2l0YWxTaWduYXR1cmUoKSB7XG4gICAgcmV0dXJuIHtcbiAgICAgICAgc2lnbmF0dXJlOiBuZXcgVWludDhBcnJheSgpLFxuICAgICAgICBhY2NvdW50aWQ6IDAsXG4gICAgICAgIHJ0aW1lOiAwLFxuICAgICAgICBlbmRwb3M6IFtdLFxuICAgICAgICBzdGFydHBvczogW10sXG4gICAgICAgIHJpZ2h0OiBbXSxcbiAgICAgICAgdHhEZWZpZHg6IDAsXG4gICAgICAgIGVudGluZGV4OiAwLFxuICAgICAgICBoaXRib3g6IDAsXG4gICAgICAgIGNyZWF0aW9udGltZTogMCxcbiAgICAgICAgZXF1aXBzbG90OiAwLFxuICAgICAgICB0cmFjZUlkOiAwLFxuICAgICAgICBub3JtYWw6IFtdLFxuICAgICAgICB0aW50SWQ6IDBcbiAgICB9O1xufVxuZXhwb3J0cy5QbGF5ZXJEZWNhbERpZ2l0YWxTaWduYXR1cmUgPSB7XG4gICAgZW5jb2RlKG1lc3NhZ2UsIHdyaXRlciA9IG1pbmltYWxfMS5Xcml0ZXIuY3JlYXRlKCkpIHtcbiAgICAgICAgaWYgKG1lc3NhZ2Uuc2lnbmF0dXJlLmxlbmd0aCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigxMCkuYnl0ZXMobWVzc2FnZS5zaWduYXR1cmUpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmFjY291bnRpZCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigxNikudWludDMyKG1lc3NhZ2UuYWNjb3VudGlkKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5ydGltZSAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigyNCkudWludDMyKG1lc3NhZ2UucnRpbWUpO1xuICAgICAgICB9XG4gICAgICAgIHdyaXRlci51aW50MzIoMzQpLmZvcmsoKTtcbiAgICAgICAgZm9yIChjb25zdCB2IG9mIG1lc3NhZ2UuZW5kcG9zKSB7XG4gICAgICAgICAgICB3cml0ZXIuZmxvYXQodik7XG4gICAgICAgIH1cbiAgICAgICAgd3JpdGVyLmxkZWxpbSgpO1xuICAgICAgICB3cml0ZXIudWludDMyKDQyKS5mb3JrKCk7XG4gICAgICAgIGZvciAoY29uc3QgdiBvZiBtZXNzYWdlLnN0YXJ0cG9zKSB7XG4gICAgICAgICAgICB3cml0ZXIuZmxvYXQodik7XG4gICAgICAgIH1cbiAgICAgICAgd3JpdGVyLmxkZWxpbSgpO1xuICAgICAgICB3cml0ZXIudWludDMyKDUwKS5mb3JrKCk7XG4gICAgICAgIGZvciAoY29uc3QgdiBvZiBtZXNzYWdlLnJpZ2h0KSB7XG4gICAgICAgICAgICB3cml0ZXIuZmxvYXQodik7XG4gICAgICAgIH1cbiAgICAgICAgd3JpdGVyLmxkZWxpbSgpO1xuICAgICAgICBpZiAobWVzc2FnZS50eERlZmlkeCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig1NikudWludDMyKG1lc3NhZ2UudHhEZWZpZHgpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmVudGluZGV4ICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDY0KS5pbnQzMihtZXNzYWdlLmVudGluZGV4KTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5oaXRib3ggIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNzIpLnVpbnQzMihtZXNzYWdlLmhpdGJveCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuY3JlYXRpb250aW1lICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDg1KS5mbG9hdChtZXNzYWdlLmNyZWF0aW9udGltZSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuZXF1aXBzbG90ICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDg4KS51aW50MzIobWVzc2FnZS5lcXVpcHNsb3QpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnRyYWNlSWQgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoOTYpLnVpbnQzMihtZXNzYWdlLnRyYWNlSWQpO1xuICAgICAgICB9XG4gICAgICAgIHdyaXRlci51aW50MzIoMTA2KS5mb3JrKCk7XG4gICAgICAgIGZvciAoY29uc3QgdiBvZiBtZXNzYWdlLm5vcm1hbCkge1xuICAgICAgICAgICAgd3JpdGVyLmZsb2F0KHYpO1xuICAgICAgICB9XG4gICAgICAgIHdyaXRlci5sZGVsaW0oKTtcbiAgICAgICAgaWYgKG1lc3NhZ2UudGludElkICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDExMikudWludDMyKG1lc3NhZ2UudGludElkKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZVBsYXllckRlY2FsRGlnaXRhbFNpZ25hdHVyZSgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc2lnbmF0dXJlID0gcmVhZGVyLmJ5dGVzKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5hY2NvdW50aWQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5ydGltZSA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBpZiAoKHRhZyAmIDcpID09PSAyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBlbmQyID0gcmVhZGVyLnVpbnQzMigpICsgcmVhZGVyLnBvcztcbiAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZW5kcG9zLnB1c2gocmVhZGVyLmZsb2F0KCkpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5lbmRwb3MucHVzaChyZWFkZXIuZmxvYXQoKSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA1OlxuICAgICAgICAgICAgICAgICAgICBpZiAoKHRhZyAmIDcpID09PSAyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBlbmQyID0gcmVhZGVyLnVpbnQzMigpICsgcmVhZGVyLnBvcztcbiAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc3RhcnRwb3MucHVzaChyZWFkZXIuZmxvYXQoKSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnN0YXJ0cG9zLnB1c2gocmVhZGVyLmZsb2F0KCkpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNjpcbiAgICAgICAgICAgICAgICAgICAgaWYgKCh0YWcgJiA3KSA9PT0gMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZW5kMiA9IHJlYWRlci51aW50MzIoKSArIHJlYWRlci5wb3M7XG4gICAgICAgICAgICAgICAgICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZDIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnJpZ2h0LnB1c2gocmVhZGVyLmZsb2F0KCkpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5yaWdodC5wdXNoKHJlYWRlci5mbG9hdCgpKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDc6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudHhEZWZpZHggPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgODpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5lbnRpbmRleCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDk6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuaGl0Ym94ID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDEwOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmNyZWF0aW9udGltZSA9IHJlYWRlci5mbG9hdCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDExOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmVxdWlwc2xvdCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50cmFjZUlkID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDEzOlxuICAgICAgICAgICAgICAgICAgICBpZiAoKHRhZyAmIDcpID09PSAyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBlbmQyID0gcmVhZGVyLnVpbnQzMigpICsgcmVhZGVyLnBvcztcbiAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uubm9ybWFsLnB1c2gocmVhZGVyLmZsb2F0KCkpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5ub3JtYWwucHVzaChyZWFkZXIuZmxvYXQoKSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50aW50SWQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICA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AgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5kYXRhID0gZXhwb3J0cy5QbGF5ZXJEZWNhbERpZ2l0YWxTaWduYXR1cmUuZGVjb2RlKHJlYWRlciwgcmVhZGVyLnVpbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLml0ZW1pZCA9IHJlYWRlci51aW50NjQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNNc2dHQ0NTdHJpa2UxNVYyQ2xpZW50UGxheWVyRGVjYWxTaWduKCk7XG4gICAgICAgIG1lc3NhZ2UuZGF0YSA9XG4gICAgICAgICAgICBvYmplY3QuZGF0YSAhPT0gdW5kZWZpbmVkICYmIG9iamVjdC5kYXRhICE9PSBudWxsXG4gICAgICAgICAgICAgICAgPyBleHBvcnRzLlBsYXllckRlY2FsRGlnaXRhbFNpZ25hdHVyZS5mcm9tUGFydGlhbChvYmplY3QuZGF0YSlcbiAgICAgICAgICAgICAgICA6IHVuZGVmaW5lZDtcbiAgICAgICAgbWVzc2FnZS5pdGVtaWQgPVxuICAgICAgICAgICAgb2JqZWN0Lml0ZW1pZCAhPT0gdW5kZWZpbmVkICYmIG9iamVjdC5pdGVtaWQgIT09IG51bGxcbiAgICAgICAgICAgICAgICA/IExvbmcuZnJvbVZhbHVlKG9iamVjdC5pdGV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4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNNc2dHQ0NTdHJpa2UxNVYyQ2xpZW50TG9nb25GYXRhbEVycm9yKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5lcnJvcmNvZGUgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5tZXNzYWdlID0gcmVhZGVyLnN0cmluZygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuY291bnRyeSA9IHJlYWRlci5zdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iLCBfYztcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMkNsaWVudExvZ29uRmF0YWxFcnJvcigpO1xuICAgICAgICBtZXNzYWdlLmVycm9yY29kZSA9IChfYSA9IG9iamVj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m4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNNc2dHQ0NTdHJpa2UxNVYyQ2xpZW50UG9sbFN0YXRlKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5wb2xsaWQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5uYW1lcy5wdXNoKHJlYWRlci5zdHJpbmcoKSk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgaWYgKCh0YWcgJiA3KSA9PT0gMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZW5kMiA9IHJlYWRlci51aW50MzIoKSArIHJlYWRlci5wb3M7XG4gICAgICAgICAgICAgICAgICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZDIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnZhbHVlcy5wdXNoKHJlYWRlci5pbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudmFsdWVzLnB1c2gocmVhZGVyLmludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCBfYiwgX2M7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ01zZ0dDQ1N0cmlrZTE1VjJDbGllbnRQb2xsU3RhdGUoKTtcbiAgICAgICAgbWVzc2FnZS5wb2xsaWQgPSAoX2EgPSBvYmplY3QucG9sbGlkKSAhPT0gbnVsbCAmJiBfYSAhPT0gdm9pZCAwID8gX2EgOiAwO1xuICAgICAgICBtZXNzYWdlLm5hbWVzID0gKChfYiA9IG9iamVjdC5uYW1lcykgPT09IG51bGwgfHwgX2IgPT09IHZvaWQgMCA/IHZvaWQgMCA6IF9iLm1hcChlID0+IGUpKSB8fCBbXTtcbiAgICAgICAgbWVzc2FnZS52YWx1ZXMgPSAoKF9jID0gb2JqZWN0LnZhbHVlcykgPT09IG51bGwgfHwgX2MgPT09IHZvaWQgMCA/IHZvaWQgMCA6IF9jLm1hcChlID0+IGUpKSB8fCBbXTtcbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfVxufTtcbmZ1bmN0aW9uIGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMlBhcnR5UmVnaXN0ZXIoKSB7XG4gICAgcmV0dXJuIHtcbiAgICAgICAgaWQ6IDAsXG4gICAgICAgIHZlcjogMCxcbiAgICAgICAgYXByOiAwLFxuICAgICAgICBhcms6IDAsXG4gICAgICAgIG5ieTogMCxcbiAgICAgICAgZ3JwOiAwLFxuICAgICAgICBzbG90czogMCxcbiAgICAgICAgbGF1bmNoZXI6IDAsXG4gICAgICAgIGdhbWVUeXBlOiAwXG4gICAgfTtcbn1cbmV4cG9ydHMuQ01zZ0dDQ1N0cmlrZTE1VjJQYXJ0eVJlZ2lzdGVyID0ge1xuICAgIGVuY29kZShtZXNzYWdlLCB3cml0ZXIgPSBtaW5pbWFsXzEuV3JpdGVyLmNyZWF0ZSgpKSB7XG4gICAgICAgIGlmIChtZXNzYWdlLmlkICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDgpLnVpbnQzMihtZXNzYWdlLmlkKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS52ZXIgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTYpLnVpbnQzMihtZXNzYWdlLnZlcik7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuYXByICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDI0KS51aW50MzIobWVzc2FnZS5hcHIpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmFyayAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigzMikudWludDMyKG1lc3NhZ2UuYXJrKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5uYnkgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNDApLnVpbnQzMihtZXNzYWdlLm5ieSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuZ3JwICE9PSAwKSB7XG4gICAg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ZCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnZlciA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmFwciA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmFyayA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA1OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm5ieSA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA2OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmdycCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA3OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnNsb3RzID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDg6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubGF1bmNoZXIgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgOTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5nYW1lVHlwZSA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICA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yaXRlci51aW50MzIodik7XG4gICAgICAgIH1cbiAgICAgICAgd3JpdGVyLmxkZWxpbSgpO1xuICAgICAgICBpZiAobWVzc2FnZS5sYXVuY2hlciAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig0MCkudWludDMyKG1lc3NhZ2UubGF1bmNoZXIpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmdhbWVUeXBlICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDQ4KS51aW50MzIobWVzc2FnZS5nYW1lVHlwZSk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMlBhcnR5U2VhcmNoKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS52ZXIgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5hcHIgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5hcmsgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgaWYgKCh0YWcgJiA3KSA9PT0gMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZW5kMiA9IHJlYWRlci51aW50MzIoKSArIHJlYWRlci5wb3M7XG4gICAgICAgICAgICAgICAgICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZDIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmdycHMucHVzaChyZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5ncnBzLnB1c2gocmVhZGVyLnVpbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubGF1bmNoZXIgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5nYW1lVHlwZSA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICA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3NhZ2UuaWQgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoOCkudWludDMyKG1lc3NhZ2UuaWQpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmdycCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigxNikudWludDMyKG1lc3NhZ2UuZ3JwKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5nYW1lVHlwZSAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigyNCkudWludDMyKG1lc3NhZ2UuZ2FtZVR5cGUpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmFwciAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigzMikudWludDMyKG1lc3NhZ2UuYXByKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5hcmsgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNDApLnVpbnQzMihtZXNzYWdlLmFyayk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UubG9jICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDQ4KS51aW50MzIobWVzc2FnZS5sb2MpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmFjY291bnRpZCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig1NikudWludDMyKG1lc3NhZ2UuYWNjb3VudGlkKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNNc2dHQ0NTdHJpa2UxNVYyUGFydHlTZWFyY2hSZXN1bHRzX0VudHJ5KCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5pZCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmdycCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmdhbWVUeXBlID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuYXByID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuYXJrID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDY6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubG9jID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDc6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuYWNjb3VudGlkID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2IsIF9jLCBfZCwgX2UsIF9mLCBfZztcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMlBhcnR5U2VhcmNoUmVzdWx0c19FbnRyeSgpO1xuICAgICAgICBtZXNzYWdlLmlkID0gKF9hID0gb2JqZWN0LmlkKSAhPT0gbnVsbCAmJiBfYSAhPT0gdm9pZCAwID8gX2EgOiAwO1xuICAgICAgICBtZXNzYWdlLmdycCA9IChfYiA9IG9iamVjdC5ncnApICE9PSBudWxsICYmIF9iICE9PSB2b2lkIDAgPyBfYiA6IDA7XG4gICAgICAgIG1lc3NhZ2UuZ2FtZVR5cGUgPSAoX2MgPSBvYmplY3QuZ2FtZVR5cGUpICE9PSBudWxsICYmIF9jICE9PSB2b2lkIDAgPyBfYyA6IDA7XG4gICAgICAgIG1lc3NhZ2UuYXByID0gKF9kID0gb2JqZWN0LmFwcikgIT09IG51bGwgJiYgX2QgIT09IHZvaWQgMCA/IF9kIDogMDtcbiAgICAgICAgbWVzc2FnZS5hcmsgPSAoX2UgPSBvYmplY3QuYXJrKSAhPT0gbnVsbCAmJiBfZSAhPT0gdm9pZCAwID8gX2UgOiAwO1xuICAgICAgICBtZXNzYWdlLmxvYyA9IChfZiA9IG9iamVjdC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1lc3NhZ2UgPSBjcmVhdGVCYXNlQ01zZ0dDQ1N0cmlrZTE1VjJQYXJ0eUludml0ZSgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuYWNjb3VudGlkID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubG9iYnlpZCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNNc2dHQ0NTdHJpa2UxNVYyUGFydHlJbnZpdGUoKTtcbiAgICAgICAgbWVzc2FnZS5hY2NvdW50aWQgPSAoX2EgPSBvYmplY3QuYWNjb3VudGlkKSAhPT0gbnVsbCAmJiBfYSAhPT0gdm9pZCAwID8gX2EgOiAwO1xuICAgICAgICBtZXNzYWdlLmxvYmJ5aWQgPSAoX2IgPSBvYmplY3QubG9iYnlpZCkgIT09IG51bGwgJiYgX2IgIT09IHZvaWQgMCA/IF9iIDogMDtcbiAgICAgICAgcmV0dXJuIG1lc3NhZ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XlzKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5wbGF5ZXJzLnB1c2goZXhwb3J0cy5DTXNnR0NDU3RyaWtlMTVWMkFjY291bnRSZXF1ZXN0Q29QbGF5c19QbGF5ZXIuZGVjb2RlKHJlYWRlciwgcmVhZGVyLnVpbnQzMigpKSk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zZXJ2ZXJ0aW1lID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2I7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ01zZ0dDQ1N0cmlrZTE1VjJBY2NvdW50UmVxdWVzdENvUGxheXMoKTtcbiAgICAgICAgbWVzc2FnZS5wbGF5ZXJzID1cbiAgICAgICAgICAgICgoX2EgPSBvYmplY3QucGxheWVycykgPT09IG51bGwgfHwgX2EgPT09IHZvaWQgMCA/IHZvaWQgMCA6IF9hLm1hcChlID0+IGV4cG9ydHMuQ01zZ0dDQ1N0cmlrZTE1VjJBY2NvdW50UmVxdWVzdENvU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bWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMkFjY291bnRSZXF1ZXN0Q29QbGF5c19QbGF5ZXIoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmFjY291bnRpZCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnJ0Y29wbGF5ID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uub25saW5lID0gcmVhZGVyLmJvb2woKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iLCBfYztcbi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nQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuYXV0aG9yaXplZFN0ZWFtSWQgPSByZWFkZXIuZml4ZWQ2NCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuYXV0aG9yaXplZFB1YmxpY0lwID0gcmVhZGVyLmZpeGVkMzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmdhbWVzZXJ2ZXJTdGVhbUlkID0gcmVhZGVyLmZpeGVkNjQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA1OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmdhbWVzZXJ2ZXJTZHJSb3V0aW5nID0gcmVhZGVyLnN0cmluZygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2I7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ01zZ0dDQ1N0cmlrZTE1VjJDbGllbnRUb0dDUmVxdWVzdFRpY2tldCgpO1xuICAgICAgICBtZXNzYWdlLmF1dGhvcml6ZWRTdGVhbUlkID1cbiAgICAgICAgICAgIG9iam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gICAgIGlmIChtZXNzYWdlLmV2ZW50aWQgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMjQpLmludDMyKG1lc3NhZ2UuZXZlbnRpZCk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMkNsaWVudFJlcXVlc3RTb3V2ZW5pcigpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuaXRlbWlkID0gcmVhZGVyLnVpbnQ2NCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubWF0Y2hpZCA9IHJlYWRlci51aW50NjQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmV2ZW50aWQgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgIC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AgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnVybCA9IHJlYWRlci5zdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2E7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ01zZ0dDQ1N0cmlrZTE1VjJDbGllbnRBY2NvdW50QmFsYW5jZSgpO1xuICAgICAgICBtZXNzYWdlLmFtb3VudCA9XG4gICAgICAgICAgICBvYmplY3QuYW1vdW50ICE9PSB1bmRlZmluZWQgJiYgb2JqZWN0LmFtb3VudCAhPT0gbnVsbFxuICAgICAgICAgICAgICAgID8gTG9uZy5mcm9tVmFsdWUob2JqZWN0LmFtb3VudClcbiAgICAgICAgICAgICAgICA6IExvbmcuVVpFUk87XG4gICAgICAgIG1lc3NhZ2UudXJsID0gKF9hID0gb2JqZWN0LnVybCkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogXCJcIjtcbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfVxufTtcbmZ1bmN0aW9uIGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMkNsaWVudFBhcnR5Sm9pblJlbGF5KCkge1xuICAgIHJldHVybiB7IGFjY291bnRpZDogMCwgbG9iYnlpZDogTG9uZy5VWkVSTyB9O1xufVxuZXhwb3J0cy5DTXNnR0NDU3RyaWtlMTVWMkNsaWVudFBhcnR5Sm9pblJlbGF5ID0ge1xuICAgIGVuY29kZShtZXNzYWdlLCB3cml0ZXIgPSBtaW5pbWFsXzEuV3JpdGVyLmNyZWF0ZSgpKSB7XG4gICAgICAgIGlmIChtZXNzYWdlLmFjY291bnRpZCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig4KS51aW50MzIobWVzc2FnZS5hY2NvdW50aWQpO1xuICAgICAgICB9XG4gICAgICAgIGlmICghbWVzc2FnZS5sb2JieWlkLmlzWmVybygpKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDE2KS51aW50NjQobWVzc2FnZS5sb2JieWlkKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNNc2dHQ0NTdHJpa2UxNVYyQ2xpZW50UGFydHlKb2luUmVsYXkoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmFjY291bnRpZCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgIC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VyLnVpbnQzMigxNikudWludDMyKG1lc3NhZ2Uud2FybnR5cGUpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiB3cml0ZXI7XG4gICAgfSxcbiAgICBkZWNvZGUoaW5wdXQsIGxlbmd0aCkge1xuICAgICAgICBjb25zdCByZWFkZXIgPSBpbnB1dCBpbnN0YW5jZW9mIG1pbmltYWxfMS5SZWFkZXIgPyBpbnB1dCA6IG5ldyBtaW5pbWFsXzEuUmVhZGVyKGlucHV0KTtcbiAgICAgICAgbGV0IGVuZCA9IGxlbmd0aCA9PT0gdW5kZWZpbmVkID8gcmVhZGVyLmxlbiA6IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ01zZ0dDQ1N0cmlrZTE1VjJDbGllbnRQYXJ0eVdhcm5pbmdfRW50cnkoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmFjY291bnRpZCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLndhcm50eXBlID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4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cbiAgICBkZWNvZGUoaW5wdXQsIGxlbmd0aCkge1xuICAgICAgICBjb25zdCByZWFkZXIgPSBpbnB1dCBpbnN0YW5jZW9mIG1pbmltYWxfMS5SZWFkZXIgPyBpbnB1dCA6IG5ldyBtaW5pbWFsXzEuUmVhZGVyKGlucHV0KTtcbiAgICAgICAgbGV0IGVuZCA9IGxlbmd0aCA9PT0gdW5kZWZpbmVkID8gcmVhZGVyLmxlbiA6IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ01zZ0dDQ1N0cmlrZTE1VjJTZXRFdmVudEZhdm9yaXRlKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5ldmVudGlkID0gcmVhZGVyLnVpbnQ2NCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuaXNGYXZvcml0ZSA9IHJlYWRlci5ib29sKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNNc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VCYXNlQ01zZ0dDQ1N0cmlrZTE1VjJHZXRFdmVudEZhdm9yaXRlc1Jlc3BvbnNlKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5hbGxFdmVudHMgPSByZWFkZXIuYm9vbCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuanNvbkZhdm9yaXRlcyA9IHJlYWRlci5zdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmpzb25GZWF0dXJlZCA9IHJlYWRlci5zdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iLCBfYztcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMkdldEV2ZW50RmF2b3JpdGVzUmVzcG9uc2UoKTtcbiAgICAgICAgbWVzc2FnZS5hbGxFdmVudHMgPSAoX2EgPSBvYmplY3QuYWxsRXZlbnRzKSAhPT0gbnVsbCAmJi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JlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnJlZmVyZW5jZSA9IHJlYWRlci5ieXRlcygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuYWN0dWFsID0gcmVhZGVyLmJ5dGVzKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zb3VyY2VpZCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA2OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnN0YXR1cyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iLCBfYywgX2QsIF9lLCBfZjtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMkNsaWVudFBlcmZSZXBvcnRfRW50cnkoKTtcbiAgICAgICAgbWVzc2FnZS5wZXJmY291bnRlciA9IChfYSA9IG9iamVjdC5wZXJmY291bnRlcikgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogMDtcbi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wKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDE2KS51aW50MzIobWVzc2FnZS5leHRlbmRlZCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKCFtZXNzYWdlLnZhbHVlLmlzWmVybygpKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDI0KS51aW50NjQobWVzc2FnZS52YWx1ZSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2Uuc3RyaW5nVmFsdWUgIT09IFwiXCIpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMzQpLnN0cmluZyhtZXNzYWdlLnN0cmluZ1ZhbHVlKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNWRGlhZ25vc3RpYygpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuaWQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5leHRlbmRlZCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnZhbHVlID0gcmVhZGVyLnVpbnQ2NCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc3RyaW5nVmFsdWUgPSByZWFkZXIuc3RyaW5nKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCBfYiwgX2M7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ1ZEaWFnbm9zdGljKCk7XG4gICAgICAgIG1lc3NhZ2UuaWQgPSAoX2EgPSBvYmplY3QuaWQpICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6IDA7XG4gICAgICAgIG1lc3NhZ2UuZXh0ZW5kZWQgPSAoX2IgPSBvYmplY3QuZXh0ZW5kZWQpICE9PSBudWxsICYmIF9iICE9PSB2b2lkIDAgPyBfYiA6IDA7XG4gICAgICAgIG1lc3NhZ2UudmFsdWUgPVxuICAgICAgICAgICAgb2JqZWN0LnZhbHVlICE9PSB1bmRlZmluZWQgJiYgb2JqZWN0LnZhbHVlICE9PSBudWxsXG4gICAgICAgICAgICAgICAgPyBMb25nLmZyb21WYWx1ZShvYmplY3QudmFsdWUpXG4gICAgICAgICAgICAgICAgO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kYXRpb24gPSB7XG4gICAgZW5jb2RlKG1lc3NhZ2UsIHdyaXRlciA9IG1pbmltYWxfMS5Xcml0ZXIuY3JlYXRlKCkpIHtcbiAgICAgICAgaWYgKG1lc3NhZ2UuZmlsZVJlcG9ydCAhPT0gXCJcIikge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigxMCkuc3RyaW5nKG1lc3NhZ2UuZmlsZVJlcG9ydCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuY29tbWFuZExpbmUgIT09IFwiXCIpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTgpLnN0cmluZyhtZXNzYWdlLmNvbW1hbmRMaW5lKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS50b3RhbEZpbGVzICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDI0KS51aW50MzIobWVzc2FnZS50b3RhbEZpbGVzKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5pbnRlcm5hbEVycm9yICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDMyKS51aW50MzIobWVzc2FnZS5pbnRlcm5hbEVycm9yKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS50cnVzdFRpbWUgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNDApLnVpbnQzMihtZXNzYWdlLnRydXN0VGltZSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuY291bnRQZW5kaW5nICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDQ4KS51aW50MzIobWVzc2FnZS5jb3VudFBlbmRpbmcpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmNvdW50Q29tcGxldGVkICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDU2KS51aW50MzIobWVzc2FnZS5jb3VudENvbXBsZXRlZCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UucHJvY2Vzc0lkICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDY0KS51aW50MzIobWVzc2FnZS5wcm9jZXNzSWQpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLm9zdmVyc2lvbiAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig3MikuaW50MzIobWVzc2FnZS5vc3ZlcnNpb24pO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmNsaWVudHJlcG9ydHZlcnNpb24gIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoODApLnVpbnQzMihtZXNzYWdlLmNsaWVudHJlcG9ydHZlcnNpb24pO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnN0YXR1c0lkICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDg4KS51aW50MzIobWVzc2FnZS5zdGF0dXNJZCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuZGlhZ25vc3RpYzEgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoOTYpLnVpbnQzMihtZXNzYWdlLmRpYWdub3N0aWMxKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAoIW1lc3NhZ2UuZGlhZ25vc3RpYzIuaXNaZXJvKCkpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTA0KS51aW50NjQobWVzc2FnZS5kaWFnbm9zdGljMik7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKCFtZXNzYWdlLmRpYWdub3N0aWMzLmlzWmVybygpKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDExMikudWludDY0KG1lc3NhZ2UuZGlhZ25vc3RpYzMpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmxhc3RMYXVuY2hEYXRhICE9PSBcIlwiKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDEyMikuc3RyaW5nKG1lc3NhZ2UubGFzdExhdW5jaERhdGEpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnJlcG9ydENvdW50ICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDEyOCkudWludDMyKG1lc3NhZ2UucmVwb3J0Q291bnQpO1xuICAgICAgICB9XG4gICAgICAgIGlmICghbWVzc2FnZS5jbGllbnRUaW1lLmlzWmVybygpKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDEzNikudWludDY0KG1lc3NhZ2UuY2xpZW50VGltZSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKCFtZXNzYWdlLmRpYWdub3N0aWM0LmlzWmVybygpKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDE0NCkudWludDY0KG1lc3NhZ2UuZGlhZ25vc3RpYzQpO1xuICAgICAgICB9XG4gICAgICAgIGlmICghbWVzc2FnZS5kaWFnbm9zdGljNS5pc1plcm8oKSkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigxNTIpLnVpbnQ2NChtZXNzYWdlLmRpYWdub3N0aWM1KTtcbiAgICAgICAgfVxuICAgICAgICBmb3IgKGNvbnN0IHYgb2YgbWVzc2FnZS5kaWFnbm9zdGljcykge1xuICAgICAgICAgICAgZXhwb3J0cy5DVkRpYWdub3N0aWMuZW5jb2RlKHYsIHdyaXRlci51aW50MzIoMTYyKS5mb3JrKCkpLmxkZWxpbSgpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiB3cml0ZXI7XG4gICAgfSxcbiAgICBkZWNvZGUoaW5wdXQsIGxlbmd0aCkge1xuICAgICAgICBjb25zdCByZWFkZXIgPSBpbnB1dCBpbnN0YW5jZW9mIG1pbmltYWxfMS5SZWFkZXIgPyBpbnB1dCA6IG5ldyBtaW5pbWFsXzEuUmVhZGVyKGlucHV0KTtcbiAgICAgICAgbGV0IGVuZCA9IGxlbmd0aCA9PT0gdW5kZWZpbmVkID8gcmVhZGVyLmxlbiA6IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ01zZ0dDQ1N0cmlrZTE1VjJDbGllbnRSZXBvcnRWYWxpZGF0aW9uKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5maWxlUmVwb3J0ID0gcmVhZGVyLnN0cmluZygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuY29tbWFuZExpbmUgPSByZWFkZXIuc3RyaW5nKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50b3RhbEZpbGVzID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuaW50ZXJuYWxFcnJvciA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA1OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnRydXN0VGltZSA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA2OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmNvdW50UGVuZGluZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA3OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmNvdW50Q29tcGxldGVkID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDg6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucHJvY2Vzc0lkID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDk6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uub3N2ZXJzaW9uID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTA6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuY2xpZW50cmVwb3J0dmVyc2lvbiA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zdGF0dXNJZCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5kaWFnbm9zdGljMSA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5kaWFnbm9zdGljMiA9IHJlYWRlci51aW50NjQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5kaWFnbm9zdGljMyA9IHJlYWRlci51aW50NjQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxNTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5sYXN0TGF1bmNoRGF0YSA9IHJlYWRlci5zdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxNjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5yZXBvcnRDb3VudCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxNzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5jbGllbnRUaW1lID0gcmVhZGVyLnVpbnQ2NCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDE4OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmRpYWdub3N0aWM0ID0gcmVhZGVyLnVpbnQ2NCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDE5OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmRpYWdub3N0aWM1ID0gcmVhZGVyLnVpbnQ2NCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDIwOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmRpYWdub3N0aWNzLnB1c2goZXhwb3J0cy5DVkRpYWdub3N0aWMuZGVjb2RlKHJlYWRlciwgcmVhZGVyLnVpbnQzMigpKSk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KT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T0gdW5kZWZpbmVkICYmIG9iamVjdC5kaWFnbm9zdGljMyAhPT0gbnVsbFxuICAgICAgICAgICAgICAgID8gTG9uZy5mcm9tVmFsdWUob2JqZWN0LmRpYWdub3N0aWMzKVxuICAgICAgICAgICAgICAgIDogTG9uZy5VWkVSTztcbiAgICAgICAgbWVzc2FnZS5sYXN0TGF1bmNoRGF0YSA9IChfbyA9IG9iamVjdC5sYXN0TGF1bmNoRGF0YSkgIT09IG51bGwgJiYgX28gIT09IHZvaWQgMCA/IF9vIDogXCJcIjtcbiAgICAgICAgbWVzc2FnZS5yZXBvcnRDb3VudCA9IChfcCA9IG9iamVjdC5yZXBvcnRDb3VudCkgIT09IG51bGwgJiYgX3AgIT09IHZvaWQgMCA/IF9wIDogMDtcbiAgICAgICAgbWVzc2FnZS5jbGllbnRUaW1lID1cbiAgICAgICAgICAgIG9iamVjdC5jbGllbnRUaW1lICE9PSB1bmRlZmluZWQgJiYgb2JqZWN0LmNsaWVudFRpbWUgIT09IG51bGxcbiAgICAgICAgICAgICAgICA/IExvbmcuZnJvbVZhbHVlKG9iamVjdC5jbGllbnRUaW1lKVxuICAgICAgICAgICAgICAgIDogTG9uZy5VWkVSTztcbiAgICAgICAgbWVzc2FnZS5kaWFnbm9zdGljNCA9XG4gICAgICAgICAgICBvYmplY3QuZGlhZ25vc3RpYzQgIT09IHVuZGVmaW5lZCAmJiBvYmplY3QuZGlhZ25vc3RpYzQgIT09IG51bGxcbiAgICAgICAgICAgICAgICA/IExvbmcuZnJvbVZhbHVlKG9iamVjdC5kaWFnbm9zdGljNClcbiAgICAgICAgICAgICAgICA6IExvbmcuVVpFUk87XG4gICAgICAgIG1lc3NhZ2UuZGlhZ25vc3RpYzUgPVxuICAgICAgICAgICAgb2JqZWN0LmRpYWdub3N0aWM1ICE9PSB1bmRlZmluZWQgJiYgb2JqZWN0LmRpYWdub3N0aWM1ICE9PSBudWxsXG4gICAgICAgICAgICAgICAgPyBMb25nLmZyb21WYWx1ZShvYmpl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dHJpbmcobWVzc2FnZS5maWxlUmVwb3J0KTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5vZmZlckluc2VjdXJlTW9kZSA9PT0gdHJ1ZSkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigxNikuYm9vbChtZXNzYWdlLm9mZmVySW5zZWN1cmVNb2RlKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5vZmZlclNlY3VyZU1vZGUgPT09IHRydWUpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMjQpLmJvb2wobWVzc2FnZS5vZmZlclNlY3VyZU1vZGUpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnNob3dVbnNpZ25lZFVpID09PSB0cnVlKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDMyKS5ib29sKG1lc3NhZ2Uuc2hvd1Vuc2lnbmVkVWkpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmtpY2tVc2VyID09PSB0cnVlKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDQwKS5ib29sKG1lc3NhZ2Uua2lja1VzZXIpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnNob3dUcnVzdGVkVWkgPT09IHRydWUpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNDgpLmJvb2wobWVzc2FnZS5zaG93VHJ1c3RlZFVpKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5zaG93V2FybmluZ05vdFRydXN0ZWQgPT09IHRydWUpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNTYpLmJvb2wobWVzc2FnZS5zaG93V2FybmluZ05vdFRydXN0ZWQpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnNob3dXYXJuaW5nTm90VHJ1c3RlZDIgPT09IHRydWUpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNjQpLmJvb2wobWVzc2FnZS5zaG93V2FybmluZ05vdFRydXN0ZWQyKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5maWxlc1ByZXZlbnRlZFRydXN0ZWQgIT09IFwiXCIpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNzQpLnN0cmluZyhtZXNzYWdlLmZpbGVzUHJldmVudGVkVHJ1c3RlZCk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMkdDMkNsaWVudFJlZnVzZVNlY3VyZU1vZGUoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmZpbGVSZXBvcnQgPSByZWFkZXIuc3RyaW5nKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5vZmZlckluc2VjdXJlTW9kZSA9IHJlYWRlci5ib29sKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5vZmZlclNlY3VyZU1vZGUgPSByZWFkZXIuYm9vbCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc2hvd1Vuc2lnbmVkVWkgPSByZWFkZXIuYm9vbCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uua2lja1VzZXIgPSByZWFkZXIuYm9vbCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDY6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc2hvd1RydXN0ZWRVaSA9IHJlYWRlci5ib29sKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zaG93V2FybmluZ05vdFRydXN0ZWQgPSByZWFkZXIuYm9vbCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDg6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc2hvd1dhcm5pbmdOb3RUcnVzdGVkMiA9IHJlYWRlci5ib29sKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgOTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5maWxlc1ByZXZlbnRlZFRydXN0ZWQgPSByZWFkZXIuc3RyaW5nKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3K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Iikge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigxOCkuc3RyaW5nKG1lc3NhZ2UubW9kdWxlKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNNc2dHQ0NTdHJpa2UxNVYyR0MyQ2xpZW50UmVxdWVzdFZhbGlkYXRpb24oKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmZ1bGxSZXBvcnQgPSByZWFkZXIuYm9vbCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubW9kdWxlID0gcmVhZGVyLnN0cmluZygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZX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XG4gICAgICAgIGlmIChtZXNzYWdlLmxvYWQgPT09IHRydWUpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoOCkuYm9vbChtZXNzYWdlLmxvYWQpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLm5hbWUgIT09IFwiXCIpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTgpLnN0cmluZyhtZXNzYWdlLm5hbWUpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLm91dHB1dG5hbWUgIT09IFwiXCIpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMjYpLnN0cmluZyhtZXNzYWdlLm91dHB1dG5hbWUpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmtleURhdGEubGVuZ3RoICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDM0KS5ieXRlcyhtZXNzYWdlLmtleURhdGEpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnNoYUhhc2gubGVuZ3RoICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDQyKS5ieXRlcyhtZXNzYWdlLnNoYUhhc2gpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmNvb2tpZSAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig0OCkuaW50MzIobWVzc2FnZS5jb29raWUpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLm1hbmlmZXN0ICE9PSBcIlwiKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDU4KS5zdHJpbmcobWVzc2FnZS5tYW5pZmVzdCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2Uuc3lzdGVtUGFja2FnZS5sZW5ndGggIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNjYpLmJ5dGVzKG1lc3NhZ2Uuc3lzdGVtU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ygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uua2V5RGF0YSA9IHJlYWRlci5ieXRlcygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc2hhSGFzaCA9IHJlYWRlci5ieXRlcygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDY6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuY29va2llID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5tYW5pZmVzdCA9IHJlYWRlci5zdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA4OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnN5c3RlbVBhY2thZ2UgPSByZWFkZXIuYnl0ZXMoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA5OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmxvYWRTeXN0ZW0gPSByZWFkZXIuYm9vbCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwg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KTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5zaGFIYXNoLmxlbmd0aCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigyNikuYnl0ZXMobWVzc2FnZS5zaGFIYXNoKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5yZXNwb25zZSAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigzMikuaW50MzIobWVzc2FnZS5yZXNwb25zZSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuZXJyb3JDb2RlMSAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig0MCkuaW50MzIobWVzc2FnZS5lcnJvckNvZGUxKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5lcnJvckNvZGUyICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDQ4KS5pbnQzMihtZXNzYWdlLmVycm9yQ29kZTIpO1xuICAgICAgICB9XG4gICAgICAgIGlmICghbWVzc2FnZS5oYW5kbGUuaXNaZXJvKCkpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNTYpLmludDY0KG1lc3NhZ2UuaGFuZGxlKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5laW5pdFJlc3VsdCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig2NCkuaW50MzIobWVzc2FnZS5laW5pdFJlc3VsdCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuYXV4U3lzdGVtMSAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig3MikuaW50MzIobWVzc2FnZS5hdXhTeXN0ZW0xKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5hdXhTeXN0ZW0yICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDgwKS5pbnQzMihtZXNzYWdlLmF1eFN5c3RlbTIpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiB3cml0ZXI7XG4gICAgfSxcbiAgICBkZWNvZGUoaW5wdXQsIGxlbmd0aCkge1xuICAgICAgICBjb25zdCByZWFkZXIgPSBpbnB1dCBpbnN0YW5jZW9mIG1pbmltYWxfMS5SZWFkZXIgPyBpbnB1dCA6IG5ldyBtaW5pbWFsXzEuUmVhZGVyKGlucHV0KTtcbiAgICAgICAgbGV0IGVuZCA9IGxlbmd0aCA9PT0gdW5kZWZpbmVkID8gcmVhZGVyLmxlbiA6IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ01zZ0dDQ1N0cmlrZTE1VjJHQzJDbGllbnRJbml0U3lzdGVtUmVzcG9uc2UoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnN1Y2Nlc3MgPSByZWFkZXIuYm9vbCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZGlhZ25vc3RpYyA9IHJlYWRlci5zdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnNoYUhhc2ggPSByZWFkZXIuYnl0ZXMoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnJlc3BvbnNlID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5lcnJvckNvZGUxID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5lcnJvckNvZGUyID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5oYW5kbGUgPSByZWFkZXIuaW50NjQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA4OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmVpbml0UmVzdWx0ID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgOTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5hdXhTeXN0ZW0xID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTA6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuYXV4U3lzdGVtMiA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhc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AgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnNob3cgPT09IHRydWUpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTYpLmJvb2wobWVzc2FnZS5zaG93KTtcbiAgICAgICAgfVxuICAgICAgICBmb3IgKGNvbnN0IHYgb2YgbWVzc2FnZS5zdWJrZXlzKSB7XG4gICAgICAgICAgICBleHBvcnRzLkNDU1Vzck1zZ1ZHVUlNZW51X1N1YmtleS5lbmNvZGUodiwgd3JpdGVyLnVpbnQzMigyNikuZm9yaygpKS5sZGVsaW0oKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNDU1Vzck1zZ1ZHVUlNZW51KCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5uYW1lID0gcmVhZGVyLnN0cmluZygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc2hvdyA9IHJlYWRlci5ib29sKCk7XG4gICAgICAgICAgICAgICA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zc2FnZS5uYW1lID0gcmVhZGVyLnN0cmluZygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc3RyID0gcmVhZGVyLnN0cmluZygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2I7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ0NTVXNyTXNnVkdVSU1lbnVfU3Via2V5KCk7XG4gICAgICAgIG1lc3NhZ2UubmFtZSA9IChfYSA9IG9iamVjdC5uYW1lKSAhPT0gbnVsbCAmJiBfYSAhPT0gdm9pZCAwID8gX2EgOiBcIlwiO1xuICAgICAgICBtZXNzYWdlLnN0ciA9IChfYiA9IG9iamVjdC5zdHIpICE9PSBudWxsICYmIF9iICE9PSB2b2lkIDAgPyBfYiA6IFwiXCI7XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH1cbn07XG5mdW5jdGlvbiBjcmVhdGVCYXNlQ0NTVXNyTXNnR2VpZ2VyKCkge1xuICAgIHJldHVybiB7IHJhbmdlOiAwIH07XG59XG5leHBvcnRzLkNDU1Vzck1zZ0dlaWdlciA9IHtcbiAgICBlbmNvZGUobWVzc2FnZSwgd3JpdGVyID0gbWluaW1hbF8xLldyaXRlci5jcmVhdGUoKSkge1xuICAgICAgICBpZiAobWVzc2FnZS5yYW5nZSAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig4KS5pbnQzMihtZXNzYWdlLnJhbmdlKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNDU1Vzck1zZ0dlaWdlcigpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucmFuZ2UgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2E7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ0NTVXNyTXNnR2VpZ2VyKCk7XG4gICAgICAgIG1lc3NhZ2UucmFuZ2UgPSAoX2EgPSBvYmplY3QucmFuZ2UpICE9P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Vzc2FnZSwgd3JpdGVyID0gbWluaW1hbF8xLldyaXRlci5jcmVhdGUoKSkge1xuICAgICAgICBpZiAobWVzc2FnZS5lbnRJZHggIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoOCkuaW50MzIobWVzc2FnZS5lbnRJZHgpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnRleHQgIT09IFwiXCIpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTgpLnN0cmluZyhtZXNzYWdlLnRleHQpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmNoYXQgPT09IHRydWUpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMjQpLmJvb2wobWVzc2FnZS5jaGF0KTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS50ZXh0YWxsY2hhdCA9PT0gdHJ1ZSkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigzMikuYm9vbChtZXNzYWdlLnRleHRhbGxjaGF0KTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNDU1Vzck1zZ1NheVRleHQoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmVudElkeCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudGV4dCA9IHJlYWRlci5zdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmNoYXQgPSByZWFkZXIuYm9vbCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudGV4dGFsbGNoYXQgPSByZWFkZXIuYm9vbCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2IsIF9jLCBfZDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDQ1NVc3JNc2dTYXlUZXh0KCk7XG4gICAgICAgIG1lc3NhZ2UuZW50SWR4ID0gKF9hID0gb2JqZWN0LmVudElkeCkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogMDtcbiAgICAgICAgbWVzc2FnZS50ZXh0ID0gKF9iID0gb2JqZWN0LnRleHQpICE9PSBudWxsICYmIF9iICE9PSB2b2lkIDAgPyBfYiA6IFw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9mIG1lc3NhZ2UucGFyYW1zKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDM0KS5zdHJpbmcodik7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UudGV4dGFsbGNoYXQgPT09IHRydWUpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNDApLmJvb2wobWVzc2FnZS50ZXh0YWxsY2hhdCk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDQ1NVc3JNc2dTYXlUZXh0MigpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZW50SWR4ID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5jaGF0ID0gcmVhZGVyLmJvb2woKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm1zZ05hbWUgPSByZWFkZXIuc3RyaW5nKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5wYXJhbXMucHVzaChyZWFkZXIuc3RyaW5nKCkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudGV4dGFsbGNoYXQgPSByZWFkZXIuYm9vbCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2IsIF9jLCBfZCwgX2U7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ0NTVXNyTXNnU2F5VGV4dDIoKTtcbiAgICAgICAgbWVzc2FnZS5lbnRJZHggPSAoX2EgPSBvYmplY3QuZW50SWR4KSAhPT0gbnVsbCAmJiBfYSAhPT0gdm9pZCAwID8gX2EgOiAwO1xuICAgICAgICBtZXNzYWdlLmNoYXQgPSAoX2IgPSBvYmplY3QuY2hhdCkgIT09IG51bGwgJiYgX2IgIT09IHZvaWQgMCA/IF9iIDogZmFsc2U7XG4gICAgICAgIG1lc3NhZ2UubXNnTmFtZSA9IChfYyA9IG9iamVjdC5tc2dOYW1lKSAhPT0gbnVsbCAmJiBfYyAhPT0gdm9pZCAwID8gX2MgOiBcIlwiO1xuICAgICAgICBtZXNzYWdlLnBhcmFtcyA9ICgoX2QgPSBvYmplY3QucGFyYW1z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uICAgICAgICAgICAgbmV0bWVzc2FnZXNfMS5DTXNnUkdCQS5lbmNvZGUobWVzc2FnZS5jbHIyLCB3cml0ZXIudWludDMyKDM0KS5mb3JrKCkpLmxkZWxpbSgpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmVmZmVjdCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig0MCkuaW50MzIobWVzc2FnZS5lZmZlY3QpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmZhZGVJblRpbWUgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNTMpLmZsb2F0KG1lc3NhZ2UuZmFkZUluVGltZSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuZmFkZU91dFRpbWUgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNjEpLmZsb2F0KG1lc3NhZ2UuZmFkZU91dFRpbWUpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmhvbGRUaW1lICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDc3KS5mbG9hdChtZXNzYWdlLmhvbGRUaW1lKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5meFRpbWUgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoODUpLmZsb2F0KG1lc3NhZ2UuZnhUaW1lKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS50ZXh0ICE9PSBcIlwiKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDkwKS5zdHJpbmcobWVzc2FnZS50ZXh0KTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNDU1Vzck1zZ0h1ZE1zZygpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuY2hhbm5lbCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucG9zID0gbmV0bWVzc2FnZXNfMS5DTXNnVmVjdG9yMkQuZGVjb2RlKHJlYWRlciwgcmVhZGVyLnVpbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmNscjEgPSBuZXRtZXNzYWdlc18xLkNNc2dSR0JBLmRlY29kZShyZWFkZXIsIHJlYWRlci51aW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5jbHIyID0gbmV0bWVzc2FnZXNfMS5DTXNnUkdCQS5kZWNvZGUocmVhZGVyLCByZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZWZmZWN0ID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5mYWRlSW5UaW1lID0gcmVhZGVyLmZsb2F0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5mYWRlT3V0VGltZSA9IHJlYWRlci5mbG9hdCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDk6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuaG9sZFRpbWUgPSByZWFkZXIuZmxvYXQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxMDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5meFRpbWUgPSByZWFkZXIuZmxvYXQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50ZXh0ID0gcmVhZGVyLnN0cmluZygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2IsIF9jLCBfZCwgX2UsIF9mLCBfZztcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0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cmVxdWVuY3kgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMjkpLmZsb2F0KG1lc3NhZ2UuZnJlcXVlbmN5KTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5kdXJhdGlvbiAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigzNykuZmxvYXQobWVzc2FnZS5kdXJhdGlvbik7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDQ1NVc3JNc2dTaGFrZSgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuY29tbWFuZCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubG9jYWxBbXBsaXR1ZGUgPSByZWFkZXIuZmxvYXQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAg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Z3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDQ1NVc3JNc2dGYWRlKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5kdXJhdGlvbiA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuaG9sZFRpbWUgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmZsYWdzID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5jbHIgPSBuZXRtZXNzYWdlc18xLkNNc2dSR0JBLmRlY29kZShyZWFkZXIsIHJlYWRlci51aW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIH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XG4gICAgICAgIGlmIChtZXNzYWdlLmRhdGEgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTYpLmludDMyKG1lc3NhZ2UuZGF0YSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuZmxhZ3MgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMjQpLmludDMyKG1lc3NhZ2UuZmxhZ3MpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiB3cml0ZXI7XG4gICAgfSxcbiAgICBkZWNvZGUoaW5wdXQsIGxlbmd0aCkge1xuICAgICAgICBjb25zdCByZWFkZXIgPSBpbnB1dCBpbnN0YW5jZW9mIG1pbmltYWxfMS5SZWFkZXIgPyBpbnB1dCA6IG5ldyBtaW5pbWFsXzEuUmVhZGVyKGlucHV0KTtcbiAgICAgICAgbGV0IGVuZCA9IGxlbmd0aCA9PT0gdW5kZWZpbmVkID8gcmVhZGVyLmxlbiA6IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ0NTVXNyTXNnUnVtYmxlKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5pbmRleCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZGF0YSA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICA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AgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5oYXNoID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZHVyYXRpb24gPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmZyb21QbGF5ZXIgPSByZWFkZXIuYm9vbCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuY2N0b2tlbiA9IHJlYWRlci5zdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iLCBfYywgX2Q7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ0NTVXNyTXNnQ2xvc2VDYXB0aW9uKCk7XG4gICAgICAgIG1lc3NhZ2UuaGFzaCA9IChfYSA9IG9iamVjdC5oYXNoKSAhPT0gbnVsbCAmJiBfYSAhPT0gdm9pZCAwID8gX2EgOiAwO1xuICAgICAgICBtZXNzYWdlLmR1cmF0aW9uID0gKF9iID0gb2JqZWN0LmR1cmF0aW9uKSAhPT0gbnVsbCAmJiBfYiAhPT0gdm9pZCAwID8gX2IgOi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cmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNDU1Vzck1zZ0Nsb3NlQ2FwdGlvbkRpcmVjdCgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuaGFzaCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmR1cmF0aW9uID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5mcm9tUGxheWVyID0gcmVhZGVyLmJvb2woKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2Es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O1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucGl0Y2ggPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmVudGlkeCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZHVyYXRpb24gPSByZWFkZXIuZmxvYXQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnZvaWNlRmlsZW5hbWUgPSByZWFkZXIuc3RyaW5nKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCBfYiwgX2MsIF9kO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNDU1Vzck1zZ1Jhd0F1ZGlvKCk7XG4gICAgICAgIG1lc3NhZ2UucGl0Y2ggPSAoX2EgPSBvYmplY3QucGl0Y2gp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4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNDU1Vzck1zZ1ZvaWNlTWFzaygpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucGxheWVyTWFza3MucHVzaChleHBvcnRzLkNDU1Vzck1zZ1ZvaWNlTWFza19QbGF5ZXJNYXNrLmRlY29kZShyZWFkZXIsIHJlYWRlci51aW50MzIoKSkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucGxheWVyTW9kRW5hYmxlID0gcmVhZGVyLmJvb2woKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCk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ICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNDU1Vzck1zZ1ZvaWNlTWFza19QbGF5ZXJNYXNrKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5nYW1lUnVsZXNNYXNrID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5iYW5NYXNrcyA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2I7XG4gICAgICAgIGNvbn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KDI0KS5pbnQzMihtZXNzYWdlLnZpY3RpbUVudGluZGV4KTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNDU1Vzck1zZ0RhbWFnZSgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuYW1vdW50ID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5pbmZsaWN0b3JXb3JsZFBvcyA9IG5ldG1lc3NhZ2VzXzEuQ01zZ1ZlY3Rvci5kZWNvZGUocmVhZGVyLCByZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudmljdGltRW50aW5kZXggPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNDU1Vzck1zZ0RhbWFnZSgpO1xuICAgICAgICBtZXNzYWdlLmFtb3VudCA9IChfYSA9IG9iamVjdC5hbW91bnQpICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6IDA7XG4gICAgICAgIG1lc3NhZ2UuaW5mbGljdG9yV29ybGRQb3MgPVxuICAgICAgICAgICAgb2JqZWN0LmluZmxpY3RvcldvcmxkUG9zICE9PSB1bmRlZmluZWQgJiZcbiAgICAgICAgICAgICAgICBvYmplY3QuaW5mbGljdG9yV29ybGRQb3MgIT09IG51bGxcbiAgICAgICAgICAgICAgICA/IG5ldG1lc3NhZ2VzXzEuQ01zZ1ZlY3Rvci5mcm9tUGFydGlhbChvYmplY3QuaW5mbGljdG9yV29ybGRQb3MpXG4gICAgICAgICAgICAgICAgOiB1bmRlZmluZWQ7XG4gICAgICAgIG1lc3NhZ2UudmljdGltRW50aW5kZXggPSAoX2IgPSBvYmplY3QudmljdGltRW50aW5kZXgpICE9PSBudWxsICYmIF9iICE9PSB2b2lkIDAgPyBfYiA6IDA7XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH1cbn07XG5mdW5jdGlvbiBjcmVhdGVCYXNlQ0NTVXNyTXNnUmFkaW9UZXh0KCkge1xuICAgIHJldHVybiB7IG1zZ0RzdDogMCwgY2xpZW50OiAwLCBtc2dOYW1lOiBcIlwiLCBwYXJhbXM6IFtdIH07XG59XG5leHBvcnRzLkNDU1Vzck1zZ1JhZGlvVGV4dCA9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AgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5tc2dEc3QgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmNsaWVudCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubXNnTmFtZSA9IHJlYWRlci5zdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnBhcmFtcy5wdXNoKHJlYWRlci5zdHJpbmcoKSk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCBfYiwgX2MsIF9kO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNDU1Vzck1zZ1JhZGlvVGV4dCgpO1xuICAgICAgICBtZXNzYWdlLm1zZ0RzdCA9IChfYSA9IG9iamVjdC5tc2dEc3QpICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6IDA7XG4gICAgICAgIG1lc3NhZ2UuY2xpZW50ID0gKF9iID0gb2JqZWN0LmNsaWVudCkg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gIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50ZXh0ID0gcmVhZGVyLnN0cmluZygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYTtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDQ1NVc3JNc2dIaW50VGV4dCgpO1xuICAgICAgICBtZXNzYWdlLnRleHQgPSAoX2EgPSBvYmplY3QudGV4dCkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogXCJcIjtcbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfVxufTtcbmZ1bmN0aW9uIGNyZWF0ZUJhc2VDQ1NVc3JNc2dLZXlIaW50VGV4dCgpIHtcbiAgICByZXR1cm4geyBoaW50czogW10gfTtcbn1cbmV4cG9ydHMuQ0NTVXNyTXNnS2V5SGludFRleHQgPSB7XG4gICAgZW5jb2RlKG1lc3NhZ2UsIHdyaXRlciA9IG1pbmltYWxfMS5Xcml0ZXIuY3JlYXRlKCkpIHtcbiAgICAgICAgZm9yIChjb25zdCB2IG9mIG1lc3NhZ2UuaGludHMpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTApLnN0cmluZyh2KTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNDU1Vzck1zZ0tleUhpbnRUZXh0KCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5oaW50cy5wdXNoKHJlYWRlci5zdHJpbmcoKSk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNDU1Vzck1zZ0tleUhpbnRUZXh0KCk7XG4gICAgICAgIG1lc3NhZ2UuaGludHMgPSAoKF9hID0gb2JqZWN0LmhpbnRzKSA9PT0gbnVsbCB8fCBfYSA9PT0gdm9p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VudGl0eUlkeCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuY2xhc3NJZCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigxNikuaW50MzIobWVzc2FnZS5jbGFzc0lkKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5vcmlnaW5YICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDI0KS5pbnQzMihtZXNzYWdlLm9yaWdpblgpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLm9yaWdpblkgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMzIpLmludDMyKG1lc3NhZ2Uub3JpZ2luWSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2Uub3JpZ2luWiAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig0MCkuaW50MzIobWVzc2FnZS5vcmlnaW5aKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5hbmdsZVkgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNDgpLmludDMyKG1lc3NhZ2UuYW5nbGVZKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5kZWZ1c2VyID09PSB0cnVlKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDU2KS5ib29sKG1lc3NhZ2UuZGVmdXNlcik7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UucGxheWVySGFzRGVmdXNlciA9PT0gdHJ1ZSkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig2NCkuYm9vbChtZXNzYWdlLnBsYXllckhhc0RlZnVzZXIpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnBsYXllckhhc0M0ID09PSB0cnVlKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDcyKS5ib29sKG1lc3NhZ2UucGxheWVySGFzQzQpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiB3cml0ZXI7XG4gICAgfSxcbiAgICBkZWNvZGUoaW5wdXQsIGxlbmd0aCkge1xuICAgICAgICBjb25zdCByZWFkZXIgPSBpbnB1dCBpbnN0YW5jZW9mIG1pbmltYWxfMS5SZWFkZXIgPyBpbnB1dCA6IG5ldyBtaW5pbWFsXzEuUmVhZGVyKGlucHV0KTtcbiAgICAgICAgbGV0IGVuZCA9IGxlbmd0aCA9PT0gdW5kZWZpbmVkID8gcmVhZGVyLmxlbiA6IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ0NTVXNyTXNnUHJvY2Vzc1Nwb3R0ZWRFbnRpdHlVcGRhdGVfU3BvdHRlZEVudGl0eVVwZGF0ZSgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZW50aXR5SWR4ID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5jbGFzc0lkID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5vcmlnaW5YID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5vcmlnaW5ZID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5vcmlnaW5aID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5hbmdsZVkgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA3OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmRlZnVzZXIgPSByZWFkZXIuYm9vbCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDg6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucGxheWVySGFzRGVmdXNlciA9IHJlYWRlci5ib29sKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgOTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5wbGF5ZXJIYXNDNCA9IHJlYWRlci5ib29sKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCBfYiwgX2MsIF9kLCBfZSwgX2YsIF9nLCBfaCwgX2o7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNl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iAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5pdGVtaW5mbyA9IGNzdHJpa2UxNV9nY21lc3NhZ2VzXzEuQ0Vjb25JdGVtUHJldmlld0RhdGFCbG9jay5kZWNvZGUocmVhZGVyLCByZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZW50aW5kZXggPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2E7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ0NTVXNyTXNnU2VuZFBsYXllckl0ZW1Gb3VuZCgpO1xuICAgICAgICBtZXNzYWdlLml0ZW1pbmZvID1cbiAgICAgICAgICAgIG9iamVjdC5pdGVtaW5mbyAhPT0gdW5kZWZpbmVkICYmIG9iamVjdC5pdGVtaW5mbyAhPT0gbnVsbFxuICAgICAgICAgICAgICAgID8gY3N0cmlrZTE1X2djbWVzc2FnZXNfMS5DRWNvbkl0ZW1QcmV2aWV3RGF0YUJsb2NrLmZyb21QYXJ0aWFsKG9iamVjdC5pdGVtaW5mbylcbiAgICAgICAgICAgICAgICA6IHVuZGVmaW5lZDtcbiAgICAgICAgbWVzc2FnZS5lbnRpbmRleCA9IChfYSA9IG9iamVjdC5lbnRpbmRleCkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogMDtcbiAgICAgICAgcmV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IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDQ1NVc3JNc2dSZWxvYWRFZmZlY3QoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmVudGlkeCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuYWN0YW5pbSA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uub3JpZ2luWCA9IHJlYWRlci5mbG9hdCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uub3JpZ2luWSA9IHJlYWRlci5mbG9hdCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uub3JpZ2luWiA9IHJlYWRlci5mbG9hdCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcb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LFxuICAgICAgICBvcmlnaW5ZOiAwLFxuICAgICAgICBvcmlnaW5aOiAwLFxuICAgICAgICBzb3VuZDogXCJcIixcbiAgICAgICAgdGltZXN0YW1wOiAwXG4gICAgfTtcbn1cbmV4cG9ydHMuQ0NTVXNyTXNnV2VhcG9uU291bmQgPSB7XG4gICAgZW5jb2RlKG1lc3NhZ2UsIHdyaXRlciA9IG1pbmltYWxfMS5Xcml0ZXIuY3JlYXRlKCkpIHtcbiAgICAgICAgaWYgKG1lc3NhZ2UuZW50aWR4ICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDgpLmludDMyKG1lc3NhZ2UuZW50aWR4KTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5vcmlnaW5YICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDIxKS5mbG9hdChtZXNzYWdlLm9yaWdpblgpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLm9yaWdpblkgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMjkpLmZsb2F0KG1lc3NhZ2Uub3JpZ2luWSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2Uub3JpZ2luWiAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigzNykuZmxvYXQobWVzc2FnZS5vcmlnaW5aKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5zb3VuZCAhPT0gXCJcIikge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig0Mikuc3RyaW5nKG1lc3NhZ2Uuc291bmQpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnRpbWVzdGFtcCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig1MykuZmxvYXQobWVzc2FnZS50aW1lc3RhbXApO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiB3cml0ZXI7XG4gICAgfSxcbiAgICBkZWNvZGUoaW5wdXQsIGxlbmd0aCkge1xuICAgICAgICBjb25zdCByZWFkZXIgPSBpbnB1dCBpbnN0YW5jZW9mIG1pbmltYWxfMS5SZWFkZXIgPyBpbnB1dCA6IG5ldyBtaW5pbWFsXzEuUmVhZGVyKGlucHV0KTtcbiAgICAgICAgbGV0IGVuZCA9IGxlbmd0aCA9PT0gdW5kZWZpbmVkID8gcmVhZGVyLmxlbiA6IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ0NTVXNyTXNnV2VhcG9uU291bmQoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmVudGlkeCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uub3JpZ2luWCA9IHJlYWRlci5mbG9hdCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uub3JpZ2luWSA9IHJlYWRlci5mbG9hdCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uub3JpZ2luWiA9IHJlYWRlci5mbG9hdCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc291bmQgPSByZWFkZXIuc3RyaW5nKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50aW1lc3RhbXAgPSByZWFkZXIuZmxvYXQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iLCBfYywgX2QsIF9lLCBfZjtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDQ1NVc3JNc2dXZWFwb25Tb3VuZCgpO1xuICAgICAgICBtZXNzYWdlLmVudGlkeCA9IChfYSA9IG9iamVjdC5lbnRpZHgpICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6IDA7XG4gICAgICAgIG1lc3NhZ2Uub3JpZ2luWCA9IChfYiA9IG9iamVjdC5vcmlnaW5YKSAhPT0gbnVsbCAmJiBfYiAhPT0gdm9pZCAwID8gX2IgOiAwO1xuICAgICAgICBtZXNzYWdlLm9yaWdpblkgPSAoX2MgPSBvYmplY3Qub3JpZ2luWSkgIT09IG51bGwgJiYgX2MgIT09IHZvaWQgMCA/IF9jIDogMDtcbiAgICAgICAgbWVzc2FnZS5vcmlnaW5aID0gKF9kID0gb2JqZWN0Lm9yaWdpblopICE9PSBudWxsICYmIF9kICE9PSB2b2lkIDAgPyBfZCA6IDA7XG4gICAgICAgIG1lc3NhZ2Uuc291bmQgPSAoX2UgPSBvYmplY3Quc291bmQpICE9PSBudWxsICYmIF9lICE9PS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VybiB3cml0ZXI7XG4gICAgfSxcbiAgICBkZWNvZGUoaW5wdXQsIGxlbmd0aCkge1xuICAgICAgICBjb25zdCByZWFkZXIgPSBpbnB1dCBpbnN0YW5jZW9mIG1pbmltYWxfMS5SZWFkZXIgPyBpbnB1dCA6IG5ldyBtaW5pbWFsXzEuUmVhZGVyKGlucHV0KTtcbiAgICAgICAgbGV0IGVuZCA9IGxlbmd0aCA9PT0gdW5kZWZpbmVkID8gcmVhZGVyLmxlbiA6IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ0NTVXNyTXNnVXBkYXRlU2NyZWVuSGVhbHRoQmFyKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5lbnRpZHggPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmhlYWx0aHJhdGlvT2xkID0gcmVhZGVyLmZsb2F0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5oZWFsdGhyYXRpb05ldyA9IHJlYWRlci5mbG9hdCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc3R5bGUgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAg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ICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucmVtb3ZlaGlnaGxpZ2h0ID0gcmVhZGVyLmJvb2woKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNDU1Vzck1zZ0VudGl0eU91dGxpbmVIaWdobGlnaHQoKTtcbiAgICAgICAgbWVzc2FnZS5lbnRpZHggPSAoX2EgPSBvYmplY3QuZW50aWR4KSAhPT0gbnVsbCAmJiBfYSAhPT0gdm9pZCAwID8gX2EgOiAwO1xuICAgICAgICBtZXNzYWdlLnJlbW92ZWhpZ2hsaWdodCA9IChfYiA9IG9iamVjdC5yZW1vdmVoaWdobGlnaHQpICE9PSBudWxsICYmIF9iICE9PSB2b2lkIDAgPyBfYiA6IGZhbHNlO1xuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9XG59O1xuZnVuY3Rpb24gY3JlYXRlQmFzZUNDU1Vzck1zZ0FkanVzdE1vbmV5KCkge1xuICAgIHJldHVybiB7IGFtb3VudDogMCB9O1xufVxuZXhwb3J0cy5DQ1NVc3JNc2dBZGp1c3RNb25leSA9IHtcbiAgICBlbmNvZGUobWVzc2FnZSwgd3JpdGVyID0gbWluaW1hbF8xLldyaXRlci5jcmVhdGUoKSkge1xuICAgICAgICBpZiAobWVzc2FnZS5hbW91bnQgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoOCkuaW50MzIobWVzc2FnZS5hbW91bnQpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiB3cml0ZXI7XG4gICAgfSxcbiAgICBkZWNvZGUoaW5wdXQsIGxlbmd0aCkge1xuICAgICAgICBjb25zdCByZWFkZXIgPSBpbnB1dCBpbnN0YW5jZW9mIG1pbmltYWxfMS5SZWFkZXIgPyBpbnB1dCA6IG5ldyBtaW5pbWFsXzEuUmVhZGVyKGlucHV0KTtcbiAgICAgICAgbGV0IGVuZCA9IGxlbmd0aCA9PT0gdW5kZWZpbmVkID8gcmVhZGVyLmxlbiA6IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ0NTVXNyTXNnQWRqdXN0TW9uZXkoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmFtb3VudCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYTtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDQ1NVc3JNc2dBZGp1c3RNb25leSgpO1xuICAgICAgICBtZXNzYWdlLmFtb3VudCA9IChfYSA9IG9iamVjdC5hbW91bnQpICE9PSBudWxsICYmIF9hICE9PSB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SB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDQ1NVc3JNc2dSZXBvcnRIaXQoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnBvc1ggPSByZWFkZXIuZmxvYXQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnBvc1kgPSByZWFkZXIuZmxvYXQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnRpbWVzdGFtcCA9IHJlYWRlci5mbG9hdCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucG9zWiA9IHJlYWRlci5mbG9hdCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2IsIF9jLCBfZDtcbiAgICAgICAgY29uc3QgbWV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1lc3NhZ2Uuc2Vjb25kVGFyZ2V0ICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDI0KS5pbnQzMihtZXNzYWdlLnNlY29uZFRhcmdldCk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDQ1NVc3JNc2dLaWxsQ2FtKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5vYnNNb2RlID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5maXJzdFRhcmdldCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc2Vjb25kVGFyZ2V0ID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZm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WRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmRlc2lyZWRUaW1lc2NhbGUgPSByZWFkZXIuZmxvYXQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmR1cmF0aW9uUmVhbHRpbWVTZWMgPSByZWFkZXIuZmxvYXQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmludGVycG9sYXRvclR5cGUgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnN0YXJ0QmxlbmRUaW1lID0gcmVhZGVyLmZsb2F0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCBfYiwgX2MsIF9kO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNDU1Vzck1zZ0Rlc2lyZWRUaW1lc2NhbGUoKTtcbiAgICAgICAgbWVzc2FnZS5kZXNpcm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5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5hY2hpZXZlbWVudCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuY291bnQgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnVzZXJJZCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2IsIF9jO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNDU1Vzck1zZ0FjaGlldmVtZW50RXZlbnQoKTtcbiAgICAgICAgbWVzc2FnZS5hY2hpZXZlbWVudCA9IChfYSA9IG9iamVjdC5hY2hpZXZlbWVudCkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogMDtcbiAgICAgICAgbWVzc2FnZS5jb3VudCA9IChfYiA9IG9iamVjdC5jb3VudCkgIT09IG51bGwgJiYgX2IgIT09IHZvaWQgMCA/IF9iIDogMDtcbiAgICAgICAgbWVzc2FnZS51c2VyS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RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDQ1NVc3JNc2dNYXRjaEVuZENvbmRpdGlvbnMoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmZyYWdsaW1pdCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubXBNYXhyb3VuZHMgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm1wV2lubGltaXQgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm1wVGltZWxpbWl0ID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWc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1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudmVyc2lvbiA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc3RhdHMucHVzaChleHBvcnRzLkNDU1Vzck1zZ1BsYXllclN0YXRzVXBkYXRlX1N0YXQuZGVjb2RlKHJlYWRlciwgcmVhZGVyLnVpbnQzMigpKSk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS51c2VySWQgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA2OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmNyYyA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2IsIF9jLCBfZDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDQ1NVc3JNc2dQbGF5ZXJTdGF0c1VwZGF0ZSgpO1xuICAgICAgICBtZXNzYWdlLnZlcnNpb24gPSAoX2EgPSBvYmplY3QudmVyc2lvbikgIT09IG51bGwgJiYgX2EgIT09IHZ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LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDQ1NVc3JNc2dQbGF5ZXJTdGF0c1VwZGF0ZV9TdGF0KCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5pZHggPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmRlbHRhID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCBfYjtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDQ1NVc3JNc2dQbGF5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iByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNDU1Vzck1zZ0Rpc3BsYXlJbnZlbnRvcnkoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmRpc3BsYXkgPSByZWFkZXIuYm9vbCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudXNlcklkID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCBfYjtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDQ1NVc3JNc2dEaXNwbGF5SW52ZW50b3J5KCk7XG4gICAgICAgIG1lc3NhZ2UuZGlzcGxheSA9IChfYSA9IG9iamVjdC5kaXNwbGF5KSAhPT0gbnVsbCAmJiBfYSAhPT0gdm9pZCAwID8gX2EgOiBmYWxzZTtcbiAgICAgICAgbWVzc2FnZS51c2VySWQgPSAoX2IgPSBvYmplY3QudXNlcklkKSAhPT0gbnVsbCAmJiBfYiAhPT0gdm9pZCAwID8gX2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ZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNDU1Vzck1zZ1F1ZXN0UHJvZ3Jlc3MoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnF1ZXN0SWQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5ub3JtYWxQb2ludHMgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5ib251c1BvaW50cyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmlzRXZlbnRRdWVzdCA9IHJlYWRlci5ib29sKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAg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MTVfZ2NtZXNzYWdlc18xLlNjb3JlTGVhZGVyYm9hcmREYXRhLmVuY29kZShtZXNzYWdlLmRhdGEsIHdyaXRlci51aW50MzIoMTApLmZvcmsoKSkubGRlbGltKCk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDQ1NVc3JNc2dTY29yZUxlYWRlcmJvYXJkRGF0YSgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZGF0YSA9IGNzdHJpa2UxNV9nY21lc3NhZ2VzXzEuU2NvcmVMZWFkZXJib2FyZERhdGEuZGVjb2RlKHJlYWRlciwgcmVhZGVyLnVpbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICA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dYUmFua0dldCgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubW9kZUlkeCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuY29udHJvbGxlciA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2I7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ0NTVXNyTXNnWFJhbmtHZXQoKTtcbiAgICAgICAgbWVzc2FnZS5tb2RlSWR4ID0gKF9hID0gb2JqZWN0Lm1vZGVJZHgpICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6IDA7XG4gICAgICAgIG1lc3NhZ2UuY29udHJvbGxlciA9IChfYiA9IG9iamVjdC5jb250cm9sbGVyKSAhPT0gbnVsbCAmJiBfYiAhPT0gdm9pZCAwID8gX2IgOiAwO1xuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9XG59O1xuZnVuY3Rpb24gY3JlYXRlQmFzZUNDU1Vzck1zZ1hSYW5rVXBkKCkge1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XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5tb2RlSWR4ID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5jb250cm9sbGVyID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5yYW5raW5nID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCBfYiwgX2M7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ0NTVXNyTXNnWFJhbmtVcGQoKTtcbiAgICAgICAgbWVzc2FnZS5tb2RlSWR4ID0gKF9hID0gb2JqZWN0Lm1vZGVJZHgpICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6IDA7XG4gICAgICAgIG1lc3NhZ2UuY29udHJvbGxlciA9IChfYiA9IG9iamVjdC5jb250cm9sbGVyKSAhPT0gbnVsbCAmJiBfYiAhPT0gdm9pZCAwID8gX2IgOiAwO1xuICAgICAgICBtZXNzYWdlLnJhbmtpbmcgPSAoX2MgPSBvYmplY3QucmFua2luZykgIT09IG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zIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnJlYXNvbiA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudGltZSA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2I7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ0NTVXNyTXNnQ2FsbFZvdGVGYWlsZWQoKTtcbiAgICAgICAgbWVzc2FnZS5yZWFzb24gPSAoX2EgPSBvYmplY3QucmVhc29uKSAhPT0gbnVsbCAmJiBfYSAhPT0gdm9pZCAwID8gX2EgOiAwO1xuICAgICAgICBtZXNzYWdlLnRpbWUgPSAoX2IgPSBvYmplY3QudGltZSkgIT09IG51bGwgJiYgX2IgIT09IHZvaWQgMCA/IF9iIDogMDtcbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfVxufTtcbmZ1bmN0aW9uIGNyZWF0ZUJhc2VDQ1NVc3JNc2dWb3RlU3RhcnQoKSB7XG4gICAgcmV0dXJuIHtcbiAgICAgICAgdGVhbTogMCxcbiAgICAgICAgZW50SWR4OiAwLFxuICAgICAgICB2b3RlVHlwZTogMCxcbiAgICAgICAgZGlzcFN0cjogXCJcIixcbiAgICAgICAgZGV0YWlsc1N0cjogXCJcIixcbiAgICAgICAgb3RoZXJUZWFtU3RyOiBcIlwiLFxuICAgICAgICBpc1llc05vVm90ZTogZmFsc2UsXG4gICAgICAgIGVudGlkeFRhcmdldDogMFxuICAgIH07XG59XG5leHBvcnRzLkNDU1Vzck1zZ1ZvdGVTdGFydCA9IHtcbiAgICBlbmNvZGUobWVzc2FnZSwgd3JpdGVyID0gbWluaW1hbF8xLldyaXRlci5jcmVhdGUoKSkge1xuICAgICAgICBpZiAobWVzc2FnZS50ZWFtICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDgpLmludDMyKG1lc3NhZ2UudGVhbSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuZW50SWR4ICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDE2KS5pbnQzMihtZXNzYWdlLmVudElkeCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2Uudm90ZVR5cGUgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMjQpLmludDMyKG1lc3NhZ2Uudm90ZVR5cGUpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmRpc3BTdHIgIT09IFwiXCIpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMzQpLnN0cmluZyhtZXNzYWdlLmRpc3BTdHIpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmRldGFpbHNTdHIgIT09IFwiXCIpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNDIpLnN0cmluZyhtZXNzYWdlLmRldGFpbHNTdHIpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLm90aGVyVGVhbVN0ciAhPT0gXCJcIikge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig1MCkuc3RyaW5nKG1lc3NhZ2Uub3RoZXJUZWFtU3RyKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5pc1llc05vVm90ZSA9PT0gdHJ1ZSkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig1NikuYm9vbChtZXNzYWdlLmlzWWVzTm9Wb3RlKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5lbnRpZHhUYXJnZXQgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNjQpLmludDMyKG1lc3NhZ2UuZW50aWR4VGFyZ2V0KTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNDU1Vzck1zZ1ZvdGVTdGFydCgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudGVhbSA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZW50SWR4ID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS52b3RlVHlwZSA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZGlzcFN0ciA9IHJlYWRlci5zdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA1OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmRldGFpbHNTdHIgPSByZWFkZXIuc3RyaW5nKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5vdGhlclRlYW1TdHIgPSByZWFkZXIuc3RyaW5nKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5pc1llc05vVm90ZSA9IHJlYWRlci5ib29sKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgODpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5lbnRpZHhUYXJnZXQgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iLCBfYywgX2QsIF9lLC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gcmVhZGVyLmxlbiA6IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ0NTVXNyTXNnVm90ZVBhc3MoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnRlYW0gPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnZvdGVUeXBlID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5kaXNwU3RyID0gcmVhZGVyLnN0cmluZygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZGV0YWlsc1N0ciA9IHJlYWRlci5zdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iLCBfYywgX2Q7XG4gICAgICAgIGNvbnN0I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1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNDU1Vzck1zZ1ZvdGVGYWlsZWQoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnRlYW0gPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnJlYXNvbiA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2I7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ0NTVXNyTXNnVm90ZUZhaWxlZ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29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubnVtSGl0c0dpdmVuID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5kYW1hZ2VHaXZlbiA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubnVtSGl0c1Rha2VuID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5kYW1hZ2VUYWtlbiA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2IsIF9jLCBfZDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDQ1NVc3JNc2dTZW5kTGFzdEtpbGxlckRhbWFnZVRvQ2xpZW50KCk7XG4gICAgICAgIG1lc3NhZ2UubnVtSGl0c0dpdmVuID0gKF9hID0gb2JqZWN0Lm51bUhpdHNHaXZlbikgIT09IG51bG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QgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNDU1Vzck1zZ1NlcnZlclJhbmtVcGRhdGUoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnJhbmtVcGRhdGUucHVzaChleHBvcnRzLkNDU1Vzck1zZ1NlcnZlclJhbmtVcGRhdGVfUmFua1VwZGF0ZS5kZWNvZGUocmVhZGVyLCByZWFkZXIudWludDMyKCkpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2E7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ0NTVXNyTXNnU2VydmVyUmFua1VwZGF0ZSgpO1xuICAgICAgICBtZXNzYWdlLnJhbmtVcGRhdGUgPVxuICAgICAgICAgICAgKChfYSA9IG9iamVjdC5yYW5rVXBkYXRlKSA9PT0gbnVsbCB8fCBfYSA9PT0gdm9pZCAwID8gdm9pZCAwIDogX2EubWFwKGUgPT4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ZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnJhbmtOZXcgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm51bVdpbnMgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA1OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnJhbmtDaGFuZ2UgPSByZWFkZXIuZmxvYXQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA2OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnJhbmtUeXBlSWQgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iLCBfYywgX2QsIF9lLCBfZjtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDQ1NVc3JNc2dTZXJ2ZXJSYW5rVXBkYXRlX1JhbmtVcGRhdGUoKTtcbiAgICAgICAgbWVzc2FnZS5hY2NvdW50SWQgPSAoX2EgPSBvYmplY3QuYWNjb3VudElkKSAhPT0gbnVsbCAmJiBfYSAhPT0gdm9pZCAwID8gX2EgOiAwO1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KTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNDU1Vzck1zZ1hwVXBkYXRlKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5kYXRhID0gY3N0cmlrZTE1X2djbWVzc2FnZXNfMS5DTXNnR0NDc3RyaWtlMTVWMkdDMlNlcnZlck5vdGlmeVhQUmV3YXJkZWQuZGVjb2RlKHJlYWRlciwgcmVhZGVyLnVpbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNDU1Vzck1zZ1hwVXBkYXRlKCk7X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RzICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDgpLmludDMyKG1lc3NhZ2UuYml0c1ZhbGlkU2xvdHMpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmRpc3BsYXlUaW1lICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDE2KS5pbnQzMihtZXNzYWdlLmRpc3BsYXlUaW1lKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5tZW51U3RyaW5nICE9PSBcIlwiKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDI2KS5zdHJpbmcobWVzc2FnZS5tZW51U3RyaW5nKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNDU1Vzck1zZ1Nob3dNZW51KCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5iaXRzVmFsaWRTbG90cyA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZGlzcGxheVRpbWUgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm1lbnVTdHJpbmcgPSByZWFkZXIuc3RyaW5nKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCBfYiwgX2M7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ0NTVXNyTXNnU2hvd01lbnUoKTtcbiAgICAgICAgbWVzc2FnZS5iaXRzVmFsaWRTbG90cyA9IChfYSA9IG9iamVjdC5iaXRzVmFsaWRTbG90cykgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogMDtcbiAgICAgICAgbWVzc2FnZS5kaXNwbGF5VGltZSA9IChfYiA9IG9iamVjdC5kaXNwbGF5VGltZSkgIT09IG51bGwgJiYgX2IgIT09IHZvaWQgMCA/IF9iIDogMDtcbiAgICAgICAgbWVzc2FnZS5tZW51U3RyaW5nID0gKF9jID0gb2JqZWN0Lm1lbnVTdHJpbmcpICE9PSBudWxsICYmIF9jICE9PSB2b2lkIDAgPyBfYyA6IFwiXCI7XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH1cbn07XG5mdW5jdGlvbiBjcmVhdGVCYXNlQ0NTVXNyTXNnQmFyVGltZSgpIHtcbiAgICByZXR1cm4geyB0aW1lOiBcIlwiIH07XG59XG5leHBvcnRzLkNDU1Vzck1zZ0JhclRpbWUgPSB7XG4gICAgZW5jb2RlKG1lc3NhZ2UsIHdyaXRlciA9IG1pbmltYWxfMS5Xcml0ZXIuY3JlYXRlKCkpIHtcbiAgICAgICAgaWYgKG1lc3NhZ2UudGltZSAhPT0gXCJcIikge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigxMCkuc3RyaW5nKG1lc3NhZ2UudGltZSk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDQ1NVc3JNc2dCYXJUaW1lKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50aW1lID0gcmVhZGVyLnN0cmluZygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZ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zdHJpbmcobWVzc2FnZS5hY2hpZXZlbWVudCk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDQ1NVc3JNc2dNYXJrQWNoaWV2ZW1lbnQoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmFjaGlldmVtZW50ID0gcmVhZGVyLnN0cmluZygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYTtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDQ1NVc3JNc2dNYXJrQWNoaWV2ZW1lbnQoKTtcbiAgICAgICAgbWVzc2FnZS5hY2h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MigxNikuYm9vbChtZXNzYWdlLmRlYXRoKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNDU1Vzck1zZ0l0ZW1Ecm9wKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5pdGVtaWQgPSByZWFkZXIuaW50NjQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmRlYXRoID0gcmVhZGVyLmJvb2woKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2E7XG4gICA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ZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDQ1NVc3JNc2dHbG93UHJvcFR1cm5PZmYoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmVudGlkeCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYTtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDQ1NVc3JNc2dHbG93UHJvcFR1cm5PZmYoKTtcbiAgICAgICAgbWVzc2FnZS5lbnRpZHggPSAoX2EgPSBvYmplY3QuZW50aWR4KSAhPT0gbnVsbCAmJiBfYSAhPT0gdm9pZCAwID8gX2EgOiAwO1xuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9XG59O1xuZnVuY3Rpb24gY3JlYXRlQmFzZUNDU1Vzck1zZ1JvdW5kQmFja3VwRmlsZW5hbWVzKCkge1xuICAgIHJldHVybiB7IGNvdW50OiAwLCBpbmRleDogMCwgZmlsZW5hbWU6IFwiXCIsIG5pY2VuYW1lOiBcIlwiIH07XG59XG5leHBvcnRzLkNDU1Vzck1zZ1JvdW5k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gICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuY291bnQgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmluZGV4ID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5maWxlbmFtZSA9IHJlYWRlci5zdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm5pY2VuYW1lID0gcmVhZGVyLnN0cmluZygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2IsIF9jLCBfZDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDQ1NVc3JNc2dSb3VuZEJhY2t1cEZpbGVuYW1lcygpO1xuICAgICAgICBtZXNzYWdlLmNvdW50ID0gKF9hID0gb2JqZWN0LmNvdW50KSAhPT0gbnVsbCAmJiBfYSAhPT0gdm9pZCAwID8gX2EgOiAwO1xuICAgICAgICB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nB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDQ1NVc3JNc2dTU1VJKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zaG93ID0gcmVhZGVyLmJvb2woKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnN0YXJ0VGltZSA9IHJlYWRlci5mbG9hdCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZW5kVGltZSA9IHJlYWRlci5mbG9hdCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgI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+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnh1aWQgPSByZWFkZXIudWludDY0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5mYWN0cy5wdXNoKGV4cG9ydHMuQ0NTVXNyTXNnU3Vydml2YWxTdGF0c19GYWN0LmRlY29kZShyZWFkZXIsIHJlYWRlci51aW50MzIoKSkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudXNlcnMucHVzaChleHBvcnRzLkNDU1Vzck1zZ1N1cnZpdmFsU3RhdHNfUGxhY2VtZW50LmRlY29kZShyZWFkZXIsIHJlYWRlci51aW50MzIoKSkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZGFtYWdlcy5wdXNoKGV4cG9ydHMuQ0NTVXNyTXNnU3Vydml2YWxTdGF0c19EYW1hZ2UuZGVjb2RlKHJlYWRlciwgcmVhZGVyLnVpbnQzMigpKSk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50aWNrbnVtYmVyID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U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ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNDU1Vzck1zZ1N1cnZpdmFsU3RhdHNfRmFjdCgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudHlwZSA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZGlzcGxheSA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudmFsdWUgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmludGVyZXN0aW5nbmVzcyA9IHJlYWRlci5mbG9hdCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAg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ICghbWVzc2FnZS54dWlkLmlzWmVybygpKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDgpLnVpbnQ2NChtZXNzYWdlLnh1aWQpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnRlYW1udW1iZXIgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTYpLmludDMyKG1lc3NhZ2UudGVhbW51bWJlcik7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UucGxhY2VtZW50ICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDI0KS5pbnQzMihtZXNzYWdlLnBsYWNlbWVudCk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDQ1NVc3JNc2dTdXJ2aXZhbFN0YXRzX1BsYWNlbWVudCgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UueHVpZCA9IHJlYWRlci51aW50NjQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnRlYW1udW1iZXIgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnBsYWNlbWVudCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2I7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ0NTVXNyTXNnU3Vydml2YWxTdGF0c19QbGFjZW1lbnQoKTtcbiAgICAgICAgbWVzc2FnZS54dWlkID1cbiAgICAgICAgICAgIG9iamVjdC54dWlkICE9PSB1bmRlZmluZWQgJiYgb2JqZWN0Lnh1aWQgIT09IG51bGxcbiAgICAgICAgICAgICAgICA/IExvbmcuZnJvbVZhbHVlKG9iamVjdC54dWlkKVxuICAgICAgICAgICAgICAgIDogTG9uZy5VWkVSTztcbiAgICAgICAgbWVzc2FnZS50ZWFtbnVtYmVyID0gKF9hID0gb2JqZWN0LnRlYW1udW1iZXIpICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6IDA7XG4gICAgICAgIG1lc3NhZ2UucGxhY2VtZW50ID0gKF9iID0gb2JqZWN0LnBsYWNlbWVudCkgIT09IG51bGwgJiYgX2IgIT09IHZvaWQgMCA/IF9iIDogMDtcbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfVxufTtcbmZ1bm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F8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDQ1NVc3JNc2dTdXJ2aXZhbFN0YXRzX0RhbWFnZSgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UueHVpZCA9IHJlYWRlci51aW50NjQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnRvID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50b0hpdHMgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmZyb20gPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA1OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmZyb21IaXRzID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAg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ci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ0NTVXNyTXNnRW5kT2ZNYXRjaEFsbFBsYXllcnNEYXRhX0FjY29sYWRlKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5lYWNjb2xhZGUgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnZhbHVlID0gcmVhZGVyLmZsb2F0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5wb3NpdGlvbiA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2IsIF9jO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNDU1Vzck1zZ0VuZE9mTWF0Y2hBbGxQbGF5ZXJzRGF0YV9BY2NvbGFkZSgpO1xuICAgICAgICBtZXNzYWdlLmVhY2NvbGFkZSA9IChfYSA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ci51aW50MzIoMTYpLnVpbnQ2NChtZXNzYWdlLnh1aWQpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLm5hbWUgIT09IFwiXCIpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMjYpLnN0cmluZyhtZXNzYWdlLm5hbWUpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnRlYW1udW1iZXIgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMzIpLmludDMyKG1lc3NhZ2UudGVhbW51bWJlcik7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2Uubm9taW5hdGlvbiAhPT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgICBleHBvcnRzLkNDU1Vzck1zZ0VuZE9mTWF0Y2hBbGxQbGF5ZXJzRGF0YV9BY2NvbGFkZS5lbmNvZGUobWVzc2FnZS5ub21pbmF0aW9uLCB3cml0ZXIudWludDMyKDQyKS5mb3JrKCkpLmxkZWxpbSgpO1xuICAgICAgICB9XG4gICAgICAgIGZvciAoY29uc3QgdiBvZiBtZXNzYWdlLml0ZW1zKSB7XG4gICAgICAgICAgICBjc3RyaWtlMTVfZ2NtZXNzYWdlc18xLkNFY29uSXRlbVByZXZpZXdEYXRhQmxvY2suZW5jb2RlKHYsIHdyaXRlci51aW50MzIoNTApLmZvcmsoKSkubGRlbGltKCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UucGxheWVyY29sb3IgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNTYpLmludDMyKG1lc3NhZ2UucGxheWVyY29sb3IpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmlzYm90ID09PSB0cnVlKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDY0KS5ib29sKG1lc3NhZ2UuaXNib3QpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiB3cml0ZXI7XG4gICAgfSxcbiAgICBkZWNvZGUoaW5wdXQsIGxlbmd0aCkge1xuICAgICAgICBjb25zdCByZWFkZXIgPSBpbnB1dCBpbnN0YW5jZW9mIG1pbmltYWxfMS5SZWFkZXIgPyBpbnB1dCA6IG5ldyBtaW5pbWFsXzEuUmVhZGVyKGlucHV0KTtcbiAgICAgICAgbGV0IGVuZCA9IGxlbmd0aCA9PT0gdW5kZWZpbmVkID8gcmVhZGVyLmxlbiA6IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ0NTVXNyTXNnRW5kT2ZNYXRjaEFsbFBsYXllcnNEYXRhX1BsYXllckRhdGEoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmVudGluZGV4ID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS54dWlkID0gcmVhZGVyLnVpbnQ2NCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubmFtZSA9IHJlYWRlci5zdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnRlYW1udW1iZXIgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA1OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm5vbWluYXRpb24gPSBleHBvcnRzLkNDU1Vzck1zZ0VuZE9mTWF0Y2hBbGxQbGF5ZXJzRGF0YV9BY2NvbGFkZS5kZWNvZGUocmVhZGVyLCByZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDY6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuaXRlbXMucHVzaChjc3RyaWtlMTVfZ2NtZXNzYWdlc18xLkNFY29uSXRlbVByZXZpZXdEYXRhQmxvY2suZGVjb2RlKHJlYWRlciwgcmVhZGVyLnVpbnQzMigpKSk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5wbGF5ZXJjb2xvciA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDg6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuaXNib3QgPSByZWFkZXIuYm9vbCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2IsIF9jLCBfZCwgX2UsIF9mO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNDU1Vzck1zZ0VuZE9mTWF0Y2hBbGxQbGF5ZXJzRGF0YV9QbGF5ZXJEYXRhKCk7XG4gICAgICAgI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AgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnRpbWVzdGFtcCA9IHJlYWRlci5mbG9hdCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudGVycm9yaXN0T2RkcyA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuY3RBbGl2ZSA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudEFsaXZlID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS52aWN0aW1EYXRhID0gZXhwb3J0cy5DQ1NVc3JNc2dSb3VuZEltcGFjdFNjb3JlRGF0YV9SaXNFdmVudF9WaWN0aW0uZGVjb2RlKHJlYWRlciwgcmVhZGVyLnVpbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA2OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm9iamVjdGl2ZURhdGEgPSBleHBvcnRzLkNDU1Vzck1zZ1JvdW5kSW1wYWN0U2NvcmVEYXRhX1Jpc0V2ZW50X09iamVjdGl2ZS5kZWNvZGUocmVhZGVyLCByZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDc6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuYWxsRGFtYWdlRGF0YS5wdXNoKGV4cG9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G4gICAgICAgIGlzQm90OiBmYWxzZSxcbiAgICAgICAgaXNEZWFkOiBmYWxzZVxuICAgIH07XG59XG5leHBvcnRzLkNDU1Vzck1zZ1JvdW5kSW1wYWN0U2NvcmVEYXRhX1Jpc0V2ZW50X1ZpY3RpbSA9IHtcbiAgICBlbmNvZGUobWVzc2FnZSwgd3JpdGVyID0gbWluaW1hbF8xLldyaXRlci5jcmVhdGUoKSkge1xuICAgICAgICBpZiAobWVzc2FnZS50ZWFtTnVtYmVyICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDgpLmludDMyKG1lc3NhZ2UudGVhbU51bWJlcik7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuZW50aW5kZXggIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTYpLmludDMyKG1lc3NhZ2UuZW50aW5kZXgpO1xuICAgICAgICB9XG4gICAgICAgIGlmICghbWVzc2FnZS54dWlkLmlzWmVybygpKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDI0KS51aW50NjQobWVzc2FnZS54dWlkKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5jb2xvciAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigzMikuaW50MzIobWVzc2FnZS5jb2xvcik7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuaXNCb3QgPT09IHRydWUpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNDApLmJvb2wobWVzc2FnZS5pc0JvdCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuaXNEZWFkID09PSB0cnVlKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDQ4KS5ib29sKG1lc3NhZ2UuaXNEZWFkKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNDU1Vzck1zZ1JvdW5kSW1wYWN0U2NvcmVEYXRhX1Jpc0V2ZW50X1ZpY3RpbSgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudGVhbU51bWJlciA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZW50aW5kZXggPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnh1aWQgPSByZWFkZXIudWludDY0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5jb2xvciA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuaXNCb3QgPSByZWFkZXIuYm9vbCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDY6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuaXNEZWFkID0gcmVhZGVyLmJvb2woKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iLCBfYywgX2QsIF9lO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNDU1Vzck1zZ1JvdW5kSW1wYWN0U2NvcmVEYXRhX1Jpc0V2ZW50X1ZpY3RpbSgpO1xuICAgICAgICBtZXNzYWdlLnRlYW1OdW1iZXIgPSAoX2EgPSBvYmplY3QudGVhbU51bWJlcikgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogMDtcbiAgICAgICAgbWVzc2FnZS5lbnRpbmRleCA9IChfYiA9IG9iamVjdC5lbnRpbmRleCkgIT09IG51bGwgJiYgX2IgIT09IHZvaWQgMCA/IF9iIDogMDtcbiAgICAgICAgbWVzc2FnZS54dWlkID1cbiAgICAgICAgICAgIG9iamVjdC54dWlkICE9PSB1bmRlZmluZWQgJiYgb2JqZWN0Lnh1aWQgIT09IG51bGxcbiAgICAgICAgICAgICAgICA/IExvbmcuZnJvbVZhbHVlKG9iamVjdC54dWlkKVxuICAgICAgICAgICAgICAgIDogTG9uZy5VWkVSTztcbiAgICAgICAgbWVzc2FnZS5jb2xvciA9IChfYyA9IG9iamVjdC5jb2xvcikgIT09IG51bGwgJiYgX2MgIT09IH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W5kSW1wYWN0U2NvcmVEYXRhX1Jpc0V2ZW50X09iamVjdGl2ZSgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudHlwZSA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYTtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDQ1NVc3JNc2dSb3VuZEltcGFjdFNjb3JlRGF0YV9SaXNFdmVudF9PYmplY3RpdmUoKTtcbiAgICAgICAgbWVzc2FnZS50eXBlID0gKF9hID0gb2JqZWN0LnR5cGUpICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6IDA7XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH1cbn07XG5mdW5jdGlvbiBjcmVhdGVCYXNlQ0NTVXNyTXNnUm91bmRJbXBhY3RTY29yZURhdGFfUmlzRXZlbnRfRGFtYWdlKCkge1xuICAgIHJldHVybiB7XG4gICAgICAgIHRhcmdldEVudGluZGV4OiAwLFxuICAgICAgICB0YXJnZXRYdWlkOiBMb25nLlVaRVJPLFxuICAgICAgICBoZWFsdGhSZW1vdmVkOiAwLFxuICAgICAgICBudW1IaXRzOiAwLFxuICAgICAgICByZXR1cm5IZWFsdGhSZW1vdmVkOiAwLFxuICAgICAgICBudW1SZXR1cm5IaXRzOiAwXG4gICAgfTtcbn1cbmV4cG9ydHMuQ0NTVXNyTXNnUm91bmRJbXBhY3RTY29yZURhdGFfUmlzRXZlbnRfRGFtYWdlID0ge1xuICAgIGVuY29kZShtZXNzYWdlLCB3cml0ZXIgPSBtaW5pbWFsXzEuV3JpdGVyLmNyZWF0ZSgpKSB7XG4gICAgICAgIGlmIChtZXNzYWdlLnRhcmdldEVudGluZGV4ICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDgpLmludDMyKG1lc3NhZ2UudGFyZ2V0RW50aW5kZXgpO1xuICAgICAgICB9XG4gICAgICAgIGlmICghbWVzc2FnZS50YXJnZXRYdWlkLmlzWmVybygpKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDE2KS51aW50NjQobWVzc2FnZS50YXJnZXRYdWlkKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5oZWFsdGhSZW1vdmVkICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDI0KS5pbnQzMihtZXNzYWdlLmhlYWx0aFJlbW92ZWQpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLm51bUhpdHMgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMzIpLmludDMyKG1lc3NhZ2UubnVtSGl0cyk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UucmV0dXJuSGVhbHRoUmVtb3ZlZCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig0MCkuaW50MzIobWVzc2FnZS5yZXR1cm5IZWFsdGhSZW1vdmVkKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5udW1SZXR1cm5IaXRzICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDQ4KS5pbnQzMihtZXNzYWdlLm51bVJldHVybkhpdHMpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiB3cml0ZXI7XG4gICAgfSxcbiAgICBkZWNvZGUoaW5wdXQsIGxlbmd0aCkge1xuICAgICAgICBjb25zdCByZWFkZXIgPSBpbnB1dCBpbnN0YW5jZW9mIG1pbmltYWxfMS5SZWFkZXIgPyBpbnB1dCA6IG5ldyBtaW5pbWFsXzEuUmVhZGVyKGlucHV0KTtcbiAgICAgICAgbGV0IGVuZCA9IGxlbmd0aCA9PT0gdW5kZWZpbmVkID8gcmVhZGVyLmxlbiA6IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ0NTVXNyTXNnUm91bmRJbXBhY3RTY29yZURhdGFfUmlzRXZlbnRfRGFtYWdlKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50YXJnZXRFbnRpbmRleCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudGFyZ2V0WHVpZCA9IHJlYWRlci51aW50NjQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmhlYWx0aFJlbW92ZWQgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm51bUhpdHMgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA1OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnJldHVybkhlYWx0aFJlbW92ZWQgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA2OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm51bVJldHVybkhpdHMgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iLCBfYywgX2QsIF9lO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNDU1Vzck1zZ1JvdW5kSW1wYWN0U2NvcmVEYXRhX1Jpc0V2ZW50X0RhbWFnZSgpO1xuICAgICAgICBtZXNzYWdlLnRhcmdldEVudGluZGV4ID0gKF9hID0gb2JqZWN0LnRhcmdldEVudGluZGV4KSAhPT0gbnVsbCAmJiBfYSAhPT0gdm9pZCAwID8gX2EgOiAwO1xuICAgICAgICBtZXNzYWdlLnRhcmdldFh1aWQgPVxuICAgICAgICAgICAgb2JqZWN0LnRhcmdldFh1aWQgIT09IHVuZGVmaW5lZCAmJiBvYmplY3QudGFyZ2V0WHVpZCAhPT0gbnVsbFxuICAgICAgICAgICAgICAgID8gTG9uZy5mcm9tVmFsdWUob2JqZWN0LnRhcmdldFh1aWQpXG4gICAgICAgICAgICA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AgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UudEVxdWlwVmFsdWUgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTYpLmludDMyKG1lc3NhZ2UudEVxdWlwVmFsdWUpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnRlcnJvcmlzdE9kZHMgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMjQpLmludDMyKG1lc3NhZ2UudGVycm9yaXN0T2Rkcyk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDQ1NVc3JNc2dSb3VuZEltcGFjdFNjb3JlRGF0YV9Jbml0aWFsQ29uZGl0aW9ucygpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuY3RFcXVpcFZhbHVlID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50RXF1aXBWYWx1ZSA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudGVycm9yaXN0T2RkcyA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2IsIF9jO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNDU1Vzck1zZ1JvdW5kSW1wYWN0U2NvcmVEYXRhX0luaXRpYWxDb25kaXRpb25zKCk7XG4gICAgICAgIG1lc3NhZ2UuY3RFcXVpcFZhbHVlID0gKF9hID0gb2JqZWN0LmN0RXF1aXBWYWx1ZSkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogMDtcbiAgICAgICAgbWVzc2FnZS50RXF1aXBWYWx1ZSA9IChfYiA9IG9iamVjdC50RXF1aXBWYWx1ZSkgIT09IG51bGwgJiYgX2IgIT09IHZvaWQgMCA/IF9iIDogMDtcbiAgICAgICAgbWVzc2FnZS50ZXJyb3Jpc3RPZGRzID0gKF9jID0gb2JqZWN0LnRlcnJvcmlzdE9kZHMpICE9PSBudWxsICYmIF9jICE9PSB2b2lkIDAgPyBfYyA6IDA7XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH1cbn07XG5mdW5jdGlvbiBjcmVhdGVCYXNlQ0NTVXNyTXNnQ3VycmVudFJvdW5kT2RkcygpIHtcbiAgICByZXR1cm4geyBvZGRzOiAwIH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kZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNDU1Vzck1zZ0RlZXBTdGF0cygpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc3RhdHMgPSBjc3RyaWtlMTVfZ2NtZXNzYWdlc18xLkNNc2dHQ0NTdHJpa2UxNUNsaWVudERlZXBTdGF0cy5kZWNvZGUocmVhZGVyLCByZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ0NTVXNyTXNnRGVlcFN0YXRzKCk7XG4gICAgICAgIG1lc3NhZ2Uuc3RhdHMgPVxuICAgICAgICAgICAgb2JqZWN0LnN0YXRzICE9PSB1bmRlZmluZWQgJiYgb2JqZWN0LnN0YXRzICE9PSBudWxsXG4gICAgICAgICAgICAgICAgPyBjc3RyaWtlMTVfZ2NtZXNzYWdlc18xLkNNc2dHQ0NTdHJpa2UxNUNsaWVudERlZXBTdGF0cy5mcm9tUGFydGlhbChvYmplY3Quc3RhdHMpXG4gICAgICAgICAgICAgICAgOiB1bmRlZmluZWQ7XG4gICAgICAgIHJldHVybiBtZXNzYWd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IChtZXNzYWdlLmR1bW15ICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDgpLmludDMyKG1lc3NhZ2UuZHVtbXkpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiB3cml0ZXI7XG4gICAgfSxcbiAgICBkZWNvZGUoaW5wdXQsIGxlbmd0aCkge1xuICAgICAgICBjb25zdCByZWFkZXIgPSBpbnB1dCBpbnN0YW5jZW9mIG1pbmltYWxfMS5SZWFkZXIgPyBpbnB1dCA6IG5ldyBtaW5pbWFsXzEuUmVhZGVyKGlucHV0KTtcbiAgICAgICAgbGV0IGVuZCA9IGxlbmd0aCA9PT0gdW5kZWZpbmVkID8gcmVhZGVyLmxlbiA6IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ0NTVXNyTXNnUmVxdWVzdFN0YXRlKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5kdW1teSA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYTtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDQ1NVc3JNc2dSZX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Vzc2FnZSA9IGNyZWF0ZUJhc2VDQ1NVc3JNc2dDbGllbnRJbmZvKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5kdW1teSA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYTtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDQ1NVc3JNc2dDbGllbnRJbmZvKCk7XG4gICAgICAgIG1lc3NhZ2UuZHVtbXkgPSAoX2EgPSBvYmplY3QuZHVtbXkpICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6IDA7XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH1cbn07XG5mdW5jdGlvbiBjcmVhdGVCYXNlQ0NTVXNyTXNnU2VydmVyUmFua1JldmVhbEFsbCgpIHtcbiAgICByZXR1cm4geyBzZWNvbmRzVGlsbFNodXRkb3duOiAwLCByZXNlcnZhdGlvbjogdW5kZWZpbmVkIH07XG59XG5leHBvcnRzLkNDU1Vzck1zZ1NlcnZlclJhbmtSZXZlYWxBbGwgPSB7XG4gICAgZW5jb2RlKG1lc3NhZ2UsIHdyaXRlciA9IG1pbmltYWxfMS5Xcml0ZX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W5jUGFja2V0KCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5tYXRjaElkID0gcmVhZGVyLnVpbnQ2NCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuaW5zdGFuY2VJZCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnNpZ251cGZyYWdtZW50ID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuY3VycmVudGZyYWdtZW50ID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudGlja3JhdGUgPSByZWFkZXIuZmxvYXQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA2OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnRpY2sgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgODpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5ydGRlbGF5ID0gcmVhZGVyLmZsb2F0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgOTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5yY3ZhZ2UgPSByZWFkZXIuZmxvYXQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxMDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5rZXlmcmFtZUludGVydmFsID0gcmVhZGVyLmZsb2F0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuY2RuZGVsYXkgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCBfYiwgX2MsIF9kLCBfZSwgX2YsIF9nLCBfaCwgX2o7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ0VuZ2luZUdvdHZTeW5jUGFja2V0KCk7XG4gICAgICAgIG1lc3NhZ2UubWF0Y2hJZCA9XG4gICAgICAgICAgICBvYmplY3QubWF0Y2hJZCAhPT0gdW5kZWZpbmVkICYmIG9iamVjdC5tYXRjaElkICE9PSBudWxsXG4gICAgICAgICAgICAgICAgPyBMb25nLmZyb21WYWx1ZShvYmplY3QubWF0Y2hJZClcbiAgICAgICAgICAgICAgICA6IExvbmcuVVpFUk87XG4gICAgICAgIG1lc3NhZ2UuaW5zdGFuY2VJZCA9IChfYSA9IG9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nN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnVmVjdG9yKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS54ID0gcmVhZGVyLmZsb2F0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS55ID0gcmVhZGVyLmZsb2F0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS56ID0gcmVhZGVyLmZsb2F0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCBfYiwgX2M7XG4gICAgICAgIGNvbnN0IG1lc3NhZ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nBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnVmVjdG9yMkQoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnggPSByZWFkZXIuZmxvYXQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnkgPSByZWFkZXIuZmxvYXQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNNc2dWZWN0b3IyRCgpO1xuICAgICAgICBtZXNzYWdlLnggPSAoX2EgPSBvYmplY3QueCkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogMDtcbiAgICAgICAgbWVzc2FnZS55ID0gKF9iID0gb2JqZWN0LnkpICE9PSBudWxsICYmIF9iICE9PSB2b2lkIDAgPyBfYiA6IDA7XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH1cbn07XG5mdW5jdGlvbiBjcmVhdGVCYXNlQ01zZ1FBbmdsZSgpIHtcbiAgICByZXR1cm4geyB4OiAwLCB5OiAwLCB6OiAwIH07XG59XG5leHBvcnRzLkNNc2dRQW5nbGUgPSB7XG4gICAgZW5jb2RlKG1lc3NhZ2UsIHdyaXRlciA9IG1pbmltYWxfMS5Xcml0ZXIuY3JlYXRlKCkpIHtcbiAgICAgICAgaWYgKG1lc3NhZ2UueCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigxMykuZmxvYXQobWVzc2FnZS54KTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS55ICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDIxKS5mbG9hdChtZXNzYWdlLnkpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnogIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMjkpLmZsb2F0KG1lc3NhZ2Uueik7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnUUFuZ2xlKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS54ID0gcmVhZGVyLmZsb2F0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS55ID0gcmVhZGVyLmZsb2F0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS56ID0gcmVhZGVyLmZsb2F0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCBfYiwgX2M7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ01zZ1FBbmdsZSgpO1xuICAgICAgICBtZXNzYWdlLnggPSAoX2EgPSBvYmplY3QueCkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogMDtcbiAgICAgICAgbWVzc2FnZS55ID0gKF9iID0gb2JqZWN0LnkpICE9PSBudWxsICYmIF9iICE9PSB2b2lkIDAgPyBfYiA6IDA7XG4gICAgICAgIG1lc3NhZ2UueiA9IChfYyA9IG9iamVjdC56KSAhPT0gbnVsbCAmJiBfYyAhPT0gdm9pZCAwID8gX2MgOiAwO1xuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9XG59O1xuZnVuY3Rpb24gY3JlYXRlQmFzZUNNc2dSR0JBKCkge1xuICAgIHJldHVybiB7IHI6IDAsIGc6IDAsIGI6IDAsIGE6IDAgfTtcbn1cbmV4cG9ydHM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XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnIgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmcgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmIgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmEgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iLCBfYywgX2Q7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ01zZ1JHQkEoKTtcbiAgICAgICAgbWVzc2FnZS5yID0gKF9hID0gb2JqZWN0LnIpICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6IDA7XG4gICAgICAgIG1lc3NhZ2UuZyA9IChfYiA9IG9iamVjdC5nKSAhPT0gbnVsbCAmJiBfYiAhPT0gdm9pZCAwID8gX2IgOiAwO1xuICAgICAgICBtZXNzYWdlLmIgPSAoX2MgPSBvYmplY3QuYikgIT09IG51bGwgJiYgX2MgIT09IHZvaWQgMCA/IF9jIDogMDtcbiAgICAgICAgbWVzc2FnZS5hID0gKF9kID0gb2JqZWN0LmEpICE9PSBudWxsICYmIF9kICE9PSB2b2lkIDAgPyBfZCA6IDA7XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH1cbn07XG5mdW5jdGlvbiBjcmVhdGVCYXNlQ05FVE1zZ1RpY2soKSB7XG4gICAgcmV0dXJuIHtcbiAgICAgICAgdGljazogMCxcbiAgICAgICAgaG9zdENvbXB1dGF0aW9udGltZTogMCxcbiAgICAgICAgaG9zdENvbXB1dGF0aW9udGltZVN0ZERldmlhdGlvbjogMCxcbiAgICAgICAgaG9zdEZyYW1lc3RhcnR0aW1lU3RkRGV2aWF0aW9uOiAwLFxuICAgICAgICBobHR2UmVwbGF5RmxhZ3M6IDBcbiAgICB9O1xufVxuZXhwb3J0cy5DTkVUTXNnVGljayA9IHtcbiAgICBlbmNvZGUobWVzc2FnZSwgd3JpdGVyID0gbWluaW1hbF8xLldyaXRlci5jcmVhdGUoKSkge1xuICAgICAgICBpZiAobWVzc2FnZS50aWNrICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDgpLnVpbnQzMihtZXNzYWdlLnRpY2spO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmhvc3RDb21wdXRhdGlvbnRpbWUgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMzIpLnVpbnQzMihtZXNzYWdlLmhvc3RDb21wdXRhdGlvbnRpbWUpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmhvc3RDb21wdXRhdGlvbnRpbWVTdGREZXZpYXRpb24gIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNDApLnVpbnQzMihtZXNzYWdlLmhvc3RDb21wdXRhdGlvbnRpbWVTdGREZXZpYXRpb24pO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmhvc3RGcmFtZXN0YXJ0dGltZVN0ZERldmlhdGlvbiAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig0OCkudWludDMyKG1lc3NhZ2UuaG9zdEZyYW1lc3RhcnR0aW1lU3RkRGV2aWF0aW9uKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5obHR2UmVwbGF5RmxhZ3MgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNTYpLnVpbnQzMihtZXNzYWdlLmhsdHZSZXBsYXlGbGFncyk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTkVUTXNnVGljaygpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudGljayA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmhvc3RDb21wdXRhdGlvbnRpbWUgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5ob3N0Q29tcHV0YXRpb250aW1lU3RkRGV2aWF0aW9uID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDY6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuaG9zdEZyYW1lc3RhcnR0aW1lU3RkRGV2aWF0aW9uID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDc6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuaGx0dlJlcGxheUZsYWdzID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2IsIF9jLCBfZCwgX2U7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ05FVE1zZ1RpY2soKTtcbiAgICAgICAgbWVzc2FnZS50aWNrID0gKF9hID0gb2JqZWN0LnRpY2spICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6IDA7XG4gICAgICAgIG1lc3NhZ2UuaG9zdENvbXB1dGF0aW9udGltZSA9IChfYiA9IG9iamVjdC5ob3N0Q29tcHV0YXRpb250aW1lKSAhPT0gbnVsbCAmJiBfYiAhPT0gdm9pZCAwID8gX2IgOiAwO1xuICAgICAgICBtZXNzY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xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNORVRNc2dTdHJpbmdDbWQoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmNvbW1hbmQgPSByZWFkZXIuc3RyaW5nKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNORVRNc2dTdHJpbmdDbWQoKTtcbiAgICAgICAgbWVzc2FnZS5jb21tYW5kID0gKF9hID0gb2JqZWN0LmNvbW1hbmQpICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6IFwiXCI7XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH1cbn07XG5mdW5jdGlvbiBjcmVhdGVCYXNlQ05FVE1zZ1NpZ25vblN0YXRlKCkge1xuICAgIHJldHVybiB7XG4gICAgICAgIHNpZ25vblN0YXRlOiAwLFxuICAgICAgICBzcGF3bkNvdW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IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTkVUTXNnU2lnbm9uU3RhdGUoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnNpZ25vblN0YXRlID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc3Bhd25Db3VudCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm51bVNlcnZlclBsYXllcnMgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5wbGF5ZXJzTmV0d29ya2lkcy5wdXNoKHJlYWRlci5zdHJpbmcoKSk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5tYXBOYW1lID0gcmVhZGVyLnN0cmluZygpO1xuICAgICAgICA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BpZiAobWVzc2FnZS5kaWN0aW9uYXJ5TmFtZSAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigyNCkudWludDMyKG1lc3NhZ2UuZGljdGlvbmFyeU5hbWUpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiB3cml0ZXI7XG4gICAgfSxcbiAgICBkZWNvZGUoaW5wdXQsIGxlbmd0aCkge1xuICAgICAgICBjb25zdCByZWFkZXIgPSBpbnB1dCBpbnN0YW5jZW9mIG1pbmltYWxfMS5SZWFkZXIgPyBpbnB1dCA6IG5ldyBtaW5pbWFsXzEuUmVhZGVyKGlucHV0KTtcbiAgICAgICAgbGV0IGVuZCA9IGxlbmd0aCA9PT0gdW5kZWZpbmVkID8gcmVhZGVyLmxlbiA6IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ01zZ0NWYXJzX0NWYXIoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm5hbWUgPSByZWFkZXIuc3RyaW5nKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS52YWx1ZSA9IHJlYWRlci5zdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmRpY3Rpb25hcnlOYW1lID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAg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FycyA9XG4gICAgICAgICAgICBvYmplY3QuY29udmFycyAhPT0gdW5kZWZpbmVkICYmIG9iamVjdC5jb252YXJzICE9PSBudWxsXG4gICAgICAgICAgICAgICAgPyBleHBvcnRzLkNNc2dDVmFycy5mcm9tUGFydGlhbChvYmplY3QuY29udmFycylcbiAgICAgICAgICAgICAgICA6IHVuZGVmaW5lZDtcbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfVxufTtcbmZ1bmN0aW9uIGNyZWF0ZUJhc2VDTkVUTXNnTk9QKCkge1xuICAgIHJldHVybiB7fTtcbn1cbmV4cG9ydHMuQ05FVE1zZ05PUCA9IHtcbiAgICBlbmNvZGUoXywgd3JpdGVyID0gbWluaW1hbF8xLldyaXRlci5jcmVhdGUoKSkge1xuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNORVRNc2dOT1AoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICA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gMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50ZXh0ID0gcmVhZGVyLnN0cmluZygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYTtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTkVUTXNnRGlzY29ubmVjdCgpO1xuICAgICAgICBtZXNzYWdlLnRleHQgPSAoX2EgPSBvYmplY3QudGV4dCkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogXCJcIjtcbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfVxufTtcbmZ1bmN0aW9uIGNyZWF0ZUJhc2VDTkVUTXNnRmlsZSgpIHtcbiAgICByZXR1cm4geyB0cmFuc2ZlcklkOiAwLCBmaWxlTmFtZTogXCJcIiwgaXNSZXBsYXlEZW1vRmlsZTogZmFsc2UsIGRlbnk6IGZhbHNlIH07XG59XG5leHBvcnRzLkNORVRNc2dGaWxlID0ge1xuICAgIGVuY29kZShtZXNzYWdlLCB3cml0ZXIgPSBtaW5pbWFsXzEuV3JpdGVyLmNyZWF0ZSgpKSB7XG4gICAgICAgIGlmIChtZXNzYWdlLnRyYW5zZmVySWQgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoOCkuaW50MzIobWVzc2FnZS50cmFuc2ZlcklkKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5maWxlTmFtZSAhPT0gXCJcIikge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigxOCkuc3RyaW5nKG1lc3NhZ2UuZmlsZU5hbWUpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmlzUmVwbGF5RGVtb0ZpbGUgPT09IHRydWUpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMjQpLmJvb2wobWVzc2FnZS5pc1JlcGxheURlbW9GaWxlKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5kZW55ID09PSB0cnVlKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDMyKS5ib29sKG1lc3NhZ2UuZGVueSk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTkVUTXNnRmlsZSgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudHJhbnNmZXJJZCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZmlsZU5hbWUgPSByZWFkZXIuc3RyaW5nKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5pc1JlcGxheURlbW9GaWxlID0gcmVhZGVyLmJvb2woKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmRlbnkgPSByZWFkZXIuYm9vbCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2IsIF9jLCBfZDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTkVUTXNnRmlsZSgpO1xuICAgICAgICBtZXNzYWdlLnRyYW5zZmVySWQgPSAoX2EgPSBvYmplY3QudHJhbnNmZXJJZCkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogMDtcbiAgICAgICAgbWVzc2FnZS5maWxlTmFtZSA9IChfYiA9IG9iamVjdC5maWxlTmFtZSkgIT09IG51bGwgJiYgX2IgIT09IHZvaWQgMCA/IF9iIDogXCJcIjtcbiAgICAgICAgbWVzc2FnZS5pc1JlcGxheURlbW9GaWxlID0gKF9jID0gb2JqZWN0LmlzUmVwbGF5RGVtb0ZpbGUpICE9PSBudWxsICYmIF9jICE9PSB2b2lkIDAgPyBfYyA6IGZhbHNlO1xuICAgICAgICBtZXNzYWdlLmRlbnkgPSAoX2QgPSBvYmplY3QuZGVueSkgIT09IG51bGwgJiYgX2Qg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ICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYTtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTkVUTXNnU3BsaXRTY3JlZW5Vc2VyKCk7XG4gICAgICAgIG1lc3NhZ2Uuc2xvdCA9IChfYSA9IG9iamVjdC5zbG90KSAhPT0gbnVsbCAmJiBfYSAhPT0gdm9pZCAwID8gX2EgOiAwO1xuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9XG59O1xuZnVuY3Rpb24gY3JlYXRlQmFzZUNORVRNc2dQbGF5ZXJBdmF0YXJEYXRhKCkge1xuICAgIHJldHVybiB7IGFjY291bnRpZDogMCwgcmdiOiBuZXcgVWludDhBcnJheSgpIH07XG59XG5leHBvcnRzLkNORVRNc2dQbGF5ZXJBdmF0YXJEYXRhID0ge1xuICAgIGVuY29kZShtZXNzYWdlLCB3cml0ZXIgPSBtaW5pbWFsXzEuV3JpdGVyLmNyZWF0ZSgpKSB7XG4gICAgICAgIGlmIChtZXNzYWdlLmFjY291bnRpZCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig4KS51aW50MzIobWVzc2FnZS5hY2NvdW50aWQpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnJnYi5sZW5ndGggIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTgpLmJ5dGVzKG1lc3NhZ2UucmdiKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNORVRNc2dQbGF5ZXJBdmF0YXJEYXRhKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5hY2NvdW50aWQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5yZ2IgPSByZWFkZXIuYnl0ZXMoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNORVRNc2dQbGF5ZXJBdmF0YXJEYXRhKCk7XG4gICAgICAgIG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G9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zZW5kVGFibGVDcmMgPSByZWFkZXIuZml4ZWQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc2VydmVyQ291bnQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5pc0hsdHYgPSByZWFkZXIuYm9vbCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuaXNSZXBsYXkgPSByZWFkZXIuYm9vbCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZnJpZW5kc0lkID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDY6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZnJpZW5kc05hbWUgPSByZWFkZXIuc3RyaW5nKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNzpcbiAgICAgICAgICAgICAgICAgICAgaWYgKCh0YWcgJiA3KSA9PT0gMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZW5kMiA9IHJlYWRlci51aW50MzIoKSArIHJlYWRlci5wb3M7XG4gICAgICAgICAgICAgICAgICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZDIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmN1c3RvbUZpbGVzLnB1c2gocmVhZGVyLmZpeGVkMzIoKSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmN1c3RvbUZpbGVzLnB1c2gocmVhZGVyLmZpeGVkMzIoKSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iLCBfYywgX2QsIF9lLCBfZiwgX2c7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ0NMQ01zZ0NsaWVudEluZm8oKTtcbiAgICAgICAgbWVzc2FnZS5zZW5kVGFibGVDcmMgPSAoX2EgPSBvYmplY3Quc2VuZFRhYmxlQ3JjKSAhPT0gbnVsbCAmJiBfYSAhPT0gdm9pZCAwID8gX2EgOiAwO1xuICAgICAgICBtZXNzYWdlLnNlcnZlckNvdW50ID0gKF9iID0gb2JqZWN0LnNlcnZlckNvdW50KSAhPT0gbnVsbCAmJiBfYiAhPT0gdm9pZCAwID8gX2IgOiAwO1xuICAgICAgICBtZXNzYWdlLmlzSGx0diA9IChfYyA9IG9iamVjdC5pc0hsdHYpICE9PSBudWxsICYmIF9jIC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1hbmRzICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDE2KS51aW50MzIobWVzc2FnZS5udW1OZXdDb21tYW5kcyk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuZGF0YS5sZW5ndGggIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMjYpLmJ5dGVzKG1lc3NhZ2UuZGF0YSk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDQ0xDTXNnTW92ZSgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubnVtQmFja3VwQ29tbWFuZHMgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5udW1OZXdDb21tYW5kcyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgIC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gICB9XG4gICAgICAgIHJldHVybiB3cml0ZXI7XG4gICAgfSxcbiAgICBkZWNvZGUoaW5wdXQsIGxlbmd0aCkge1xuICAgICAgICBjb25zdCByZWFkZXIgPSBpbnB1dCBpbnN0YW5jZW9mIG1pbmltYWxfMS5SZWFkZXIgPyBpbnB1dCA6IG5ldyBtaW5pbWFsXzEuUmVhZGVyKGlucHV0KTtcbiAgICAgICAgbGV0IGVuZCA9IGxlbmd0aCA9PT0gdW5kZWZpbmVkID8gcmVhZGVyLmxlbiA6IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ0NMQ01zZ1ZvaWNlRGF0YSgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZGF0YSA9IHJlYWRlci5ieXRlcygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UueHVpZCA9IHJlYWRlci5maXhlZDY0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5mb3JtYXQgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnNlcXVlbmNlQnl0ZXMgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA1OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnNlY3Rpb25OdW1iZXIgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS51bmNvbXByZXNzZWRTYW1wbGVPZmZzZXQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCBfYiwgX2MsIF9kLCBfZTtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDQ0xDTXNnVm9pY2VEYXRhKCk7XG4gICAgICAgIG1lc3NhZ2UuZGF0YSA9IChfYSA9IG9iamVjdC5kYXRhKSAhPT0gbnVsbCAmJiBfYSAhPT0gdm9pZCAwID8gX2EgOiBuZXcgVWludDhBcnJheSgpO1xuICAgICAgICBtZXNzYWdlLnh1aWQgPVxuICAgICAgICAgICAgb2JqZWN0Lnh1aWQgIT09IHVuZGVmaW5lZCAmJiBvYmplY3QueHVpZCAhPT0gbnVsbFxuICAgICAgICAgICAgICAgID8gTG9uZy5mcm9tVmFsdWUob2JqZWN0Lnh1aWQpXG4gICAgICAgICAgICAgICAgOiBMb25nLlVaRVJPO1xuICAgICAgICBtZXNzYWdlLmZvcm1hdCA9IChfYiA9IG9iamVjdC5mb3JtYXQpICE9PSBudWxsICYmIF9iICE9PSB2b2lkIDAgPyBfYiA6IDA7XG4gICAgICAgIG1l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3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNDTENNc2dCYXNlbGluZUFjaygpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuYmFzZWxpbmVUaWNrID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5iYXNlbGluZU5yID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCBfYjtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDQ0xDTXNnQmFzZWxpbmVBY2soKTtcbiAgICAgICAgbWVzc2FnZS5iYXNlbGluZVRpY2sgPSAoX2E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gPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBpZiAoKHRhZyAmIDcpID09PSAyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBlbmQyID0gcmVhZGVyLnVpbnQzMigpICsgcmVhZGVyLnBvcztcbiAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZXZlbnRNYXNrLnB1c2gocmVhZGVyLmZpeGVkMzIoKSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmV2ZW50TWFzay5wdXNoKHJlYWRlci5maXhlZDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNDTENNc2dMaXN0ZW5FdmVudHMoKTtcbiAgICAgICAgbWVzc2FnZS5ldmVudE1hc2sgPSAoKF9hID0gb2JqZWN0LmV2ZW50TWFzaykgPT09IG51bGwgfHwgX2EgPT09IHZ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yBpbnB1dCA6IG5ldyBtaW5pbWFsXzEuUmVhZGVyKGlucHV0KTtcbiAgICAgICAgbGV0IGVuZCA9IGxlbmd0aCA9PT0gdW5kZWZpbmVkID8gcmVhZGVyLmxlbiA6IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ0NMQ01zZ1Jlc3BvbmRDdmFyVmFsdWUoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmNvb2tpZSA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc3RhdHVzQ29kZSA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubmFtZSA9IHJlYWRlci5zdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnZhbHVlID0gcmVhZGVyLnN0cmluZygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWd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xlTnVtYmVyOiAwXG4gICAgfTtcbn1cbmV4cG9ydHMuQ0NMQ01zZ0ZpbGVDUkNDaGVjayA9IHtcbiAgICBlbmNvZGUobWVzc2FnZSwgd3JpdGVyID0gbWluaW1hbF8xLldyaXRlci5jcmVhdGUoKSkge1xuICAgICAgICBpZiAobWVzc2FnZS5jb2RlUGF0aCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig4KS5pbnQzMihtZXNzYWdlLmNvZGVQYXRoKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5wYXRoICE9PSBcIlwiKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDE4KS5zdHJpbmcobWVzc2FnZS5wYXRoKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5jb2RlRmlsZW5hbWUgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMjQpLmludDMyKG1lc3NhZ2UuY29kZUZpbGVuYW1lKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5maWxlbmFtZSAhPT0gXCJcIikge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigzNCkuc3RyaW5nKG1lc3NhZ2UuZmlsZW5hbWUpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmZpbGVGcmFjdGlvbiAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig0MCkuaW50MzIobWVzc2FnZS5maWxlRnJhY3Rpb24pO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLm1kNS5sZW5ndGggIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNTApLmJ5dGVzKG1lc3NhZ2UubWQ1KTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5jcmMgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNTYpLnVpbnQzMihtZXNzYWdlLmNyYyk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gIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmNvZGVQYXRoID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5wYXRoID0gcmVhZGVyLnN0cmluZygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuY29kZUZpbGVuYW1lID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5maWxlbmFtZSA9IHJlYWRlci5zdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA1OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmZpbGVGcmFjdGlvbiA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDY6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubWQ1ID0gcmVhZGVyLmJ5dGVzKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5jcmMgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgODpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5maWxlSGFzaFR5cGUgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA5OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmZpbGVMZW4gPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxMDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5wYWNrRmlsZUlkID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucGFja0ZpbGVOdW1iZXIgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iLCBfYywgX2QsIF9lLCBfZiwgX2csIF9oLCBfaiwgX2ssIF9sO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNDTENNc2dGaWxlQ1JDQ2hlY2soKTtcbiAgICAgICAgbWVzc2FnZS5jb2RlUGF0aCA9IChfYSA9IG9iamVjdC5jb2RlUGF0aCkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogMDtcbiAgICAgICAgbWVzc2FnZS5wYXRoID0gKF9iID0gb2JqZWN0LnBhdGgpICE9PSBudWxsICYmIF9iICE9PSB2b2lkIDAgPyBfYiA6IFwiXCI7XG4gICAgICAgIG1lc3NhZ2UuY29kZUZpbGVuYW1lID0gKF9jID0gb2JqZWN0LmNvZGV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GV0IGVuZCA9IGxlbmd0aCA9PT0gdW5kZWZpbmVkID8gcmVhZGVyLmxlbiA6IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ0NMQ01zZ1NwbGl0UGxheWVyQ29ubmVjdCgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuY29udmFycyA9IGV4cG9ydHMuQ01zZ0NWYXJzLmRlY29kZShyZWFkZXIsIHJlYWRlci51aW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDQ0xDTXNnU3BsaXRQbGF5ZXJDb25uZWN0KCk7XG4gICAgICAgIG1lc3NhZ2UuY29udmFycyA9XG4gICAgICAgICAgICBvYmplY3QuY29udmFycyAhPT0gdW5kZWZpbmVkICYmIG9iamVjdC5jb252YXJzICE9PSBudWxsXG4gICAgICAgICAgICAgICAgPyBleHBvcnRzLkNNc2dDVmFycy5mcm9tUGFydGlhbChvYmplY3QuY29udmFycylcbiAgICAgICAgICAgICAgICA6IHVuZGVmaW5lZDtcbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7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iAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5pc1JlcGxheSA9PT0gdHJ1ZSkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig0OCkuYm9vbChtZXNzYWdlLmlzUmVwbGF5KTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5pc1JlZGlyZWN0aW5nVG9Qcm94eVJlbGF5ID09PSB0cnVlKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDE2OCkuYm9vbChtZXNzYWdlLmlzUmVkaXJlY3RpbmdUb1Byb3h5UmVsYXkpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmNPcyAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig1NikuaW50MzIobWVzc2FnZS5jT3MpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLm1hcENyYyAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig2OSkuZml4ZWQzMihtZXNzYWdlLm1hcENyYyk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuY2xpZW50Q3JjICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDc3KS5maXhlZDMyKG1lc3NhZ2UuY2xpZW50Q3JjKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5zdHJpbmdUYWJsZUNyYyAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig4NSkuZml4ZWQzMihtZXNzYWdlLnN0cmluZ1RhYmxlQ3JjKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5tYXhDbGllbnRzICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDg4KS5pbnQzMihtZXNzYWdlLm1heENsaWVudHMpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLm1heENsYXNzZXMgIT09IDApIHtcbiAgICAgICAg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AgICAgICAgaWYgKG1lc3NhZ2UucHVibGljSXAgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTYwKS51aW50MzIobWVzc2FnZS5wdWJsaWNJcCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKCFtZXNzYWdlLnVnY01hcElkLmlzWmVybygpKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDE3NikudWludDY0KG1lc3NhZ2UudWdjTWFwSWQpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiB3cml0ZXI7XG4gICAgfSxcbiAgICBkZWNvZGUoaW5wdXQsIGxlbmd0aCkge1xuICAgICAgICBjb25zdCByZWFkZXIgPSBpbnB1dCBpbnN0YW5jZW9mIG1pbmltYWxfMS5SZWFkZXIgPyBpbnB1dCA6IG5ldyBtaW5pbWFsXzEuUmVhZGVyKGlucHV0KTtcbiAgICAgICAgbGV0IGVuZCA9IGxlbmd0aCA9PT0gdW5kZWZpbmVkID8gcmVhZGVyLmxlbiA6IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ1NWQ01zZ1NlcnZlckluZm8oKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnByb3RvY29sID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zZXJ2ZXJDb3VudCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuaXNEZWRpY2F0ZWQgPSByZWFkZXIuYm9vbCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuaXNPZmZpY2lhbFZhbHZlU2VydmVyID0gcmVhZGVyLmJvb2woKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA1OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmlzSGx0diA9IHJlYWRlci5ib29sKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5pc1JlcGxheSA9IHJlYWRlci5ib29sKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuaXNSZWRpcmVjdGluZ1RvUHJveHlSZWxheSA9IHJlYWRlci5ib29sKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5jT3MgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA4OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm1hcENyYyA9IHJlYWRlci5maXhlZDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgOTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5jbGllbnRDcmMgPSByZWFkZXIuZml4ZWQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDEwOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnN0cmluZ1RhYmxlQ3JjID0gcmVhZGVyLmZpeGVkMzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5tYXhDbGllbnRzID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubWF4Q2xhc3NlcyA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDEzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnBsYXllclNsb3QgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50aWNrSW50ZXJ2YWwgPSByZWFkZXIuZmxvYXQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxNTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5nYW1lRGlyID0gcmVhZGVyLnN0cmluZygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDE2OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm1hcE5hbWUgPSByZWFkZXIuc3RyaW5nKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTc6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubWFwR3JvdXBOYW1lID0gcmVhZGVyLnN0cmluZygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDE4OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnNreU5hbWUgPSByZWFkZXIuc3RyaW5nKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTk6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuaG9zdE5hbWUgPSByZWFkZXIuc3RyaW5nKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjA6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucHVibGljSXAgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudWdjTWFwSWQgPSByZWFkZXIudWludDY0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCBfYiwgX2MsIF9kLCBfZSwgX2YsIF9nLCBfaCwgX2osIF9rLCBfbCwgX20sIF9vLCBfcCwgX3EsIF9yLCBfcywgX3QsIF91LCBfdiwgX3c7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ1NWQ01zZ1NlcnZlckluZm8oKTtcbiAgICAgICAgbWVzc2FnZS5wcm90b2NvbCA9IChfYSA9IG9iamVjdC5wcm90b2NvbCkgIT09IG51bGwgJiYgX2EgIT09IHZva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Y3JlYXRlQmFzZUNTVkNNc2dTZW5kVGFibGUoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmlzRW5kID0gcmVhZGVyLmJvb2woKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm5ldFRhYmxlTmFtZSA9IHJlYWRlci5zdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm5lZWRzRGVjb2RlciA9IHJlYWRlci5ib29sKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5wcm9wcy5wdXNoKGV4cG9ydHMuQ1NWQ01zZ1NlbmRUYWJsZV9zZW5kcHJvcFQuZGVjb2RlKHJlYWRlciwgcmVhZGVyLnVpbnQzMigpKSk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCBfYiwgX2MsIF9kO1xuICAgICAgICBjb25z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3BUID0ge1xuICAgIGVuY29kZShtZXNzYWdlLCB3cml0ZXIgPSBtaW5pbWFsXzEuV3JpdGVyLmNyZWF0ZSgpKSB7XG4gICAgICAgIGlmIChtZXNzYWdlLnR5cGUgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoOCkuaW50MzIobWVzc2FnZS50eXBlKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS52YXJOYW1lICE9PSBcIlwiKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDE4KS5zdHJpbmcobWVzc2FnZS52YXJOYW1lKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5mbGFncyAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigyNCkuaW50MzIobWVzc2FnZS5mbGFncyk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UucHJpb3JpdHkgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMzIpLmludDMyKG1lc3NhZ2UucHJpb3JpdHkpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmR0TmFtZSAhPT0gXCJcIikge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig0Mikuc3RyaW5nKG1lc3NhZ2UuZHROYW1lKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5udW1FbGVtZW50cyAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig0OCkuaW50MzIobWVzc2FnZS5udW1FbGVtZW50cyk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UubG93VmFsdWUgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNjEpLmZsb2F0KG1lc3NhZ2UubG93VmFsdWUpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmhpZ2hWYWx1ZSAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig2OSkuZmxvYXQobWVzc2FnZS5oaWdoVmFsdWUpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLm51bUJpdHMgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNzIpLmludDMyKG1lc3NhZ2UubnVtQml0cyk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDU1ZDTXNnU2VuZFRhYmxlX3NlbmRwcm9wVCgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudHlwZSA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudmFyTmFtZSA9IHJlYWRlci5zdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmZsYWdzID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5wcmlvcml0eSA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZHROYW1lID0gcmVhZGVyLnN0cmluZygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDY6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubnVtRWxlbWVudHMgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA3OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmxvd1ZhbHVlID0gcmVhZGVyLmZsb2F0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgODpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5oaWdoVmFsdWUgPSByZWFkZXIuZmxvYXQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA5OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm51bUJpdHMgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iLC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gbWluaW1hbF8xLldyaXRlci5jcmVhdGUoKSkge1xuICAgICAgICBpZiAobWVzc2FnZS5lbnRpdHlJbmRleCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig4KS5pbnQzMihtZXNzYWdlLmVudGl0eUluZGV4KTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNTVkNNc2dTZXRWaWV3KCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5lbnRpdHlJbmRleCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYTtcbiAgICAgIC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IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ1NWQ01zZ0NyZWF0ZVN0cmluZ1RhYmxlKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5uYW1lID0gcmVhZGVyLnN0cmluZygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubWF4RW50cmllcyA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubnVtRW50cmllcyA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudXNlckRhdGFGaXhlZFNpemUgPSByZWFkZXIuYm9vbCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudXNlckRhdGFTaXplID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS51c2VyRGF0YVNpemVCaXRzID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5mbGFncyA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDg6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc3RyaW5nRGF0YSA9IHJlYWRlci5ieXRlcygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2IsIF9jLCBfZCwgX2UsIF9mLCBfZywgX2g7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ1NWQ01zZ0NyZWF0ZVN0cmluZ1RhYmxlKCk7XG4gICAgICAgIG1lc3NhZ2UubmFtZSA9IChfYSA9IG9iamVjdC5uYW1lKSAhPT0gbnVsbCAmJiBfYSAhPT0gdm9pZCAwID8gX2EgOiBcIlwiO1xuICAgICAgICBtZXNzYWdlLm1heEVudHJpZXMgPSAoX2IgPSBvYmplY3QubWF4RW50cmllcykgIT09IG51bGwgJiYgX2IgIT09IHZvaWQgMCA/IF9iIDogMDtcbiAgICAgICAgbWVzc2FnZS5udW1FbnRyaWVzID0gKF9jID0gb2JqZWN0Lm51bUVudHJpZXMpICE9PSBudWxsICYmIF9jICE9PSB2b2lkIDAgPyBfYyA6IDA7XG4gICAgICAgIG1lc3NhZ2UudXNlckRhdGFGaXhlZFNpemUgPSAoX2QgPSBvYmplY3QudXNlckRhdGFGaXhlZFNpemUpICE9PSBudWxsICYmIF9kICE9PSB2b2lkID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ge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigxNikuaW50MzIobWVzc2FnZS5udW1DaGFuZ2VkRW50cmllcyk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2Uuc3RyaW5nRGF0YS5sZW5ndGggIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMjYpLmJ5dGVzKG1lc3NhZ2Uuc3RyaW5nRGF0YSk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDU1ZDTXNnVXBkYXRlU3RyaW5nVGFibGUoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnRhYmxlSWQgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm51bUNoYW5nZWRFbnRyaWVzID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNh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PSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmNvZGVjID0gcmVhZGVyLnN0cmluZygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudmVyc2lvbiA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2IsIF9jO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNTVkNNc2dWb2ljZUluaXQoKTtcbiAgICAgICAgbWVzc2FnZS5xdWFsaXR5ID0gKF9hID0gb2JqZWN0LnF1YWxpdHkpICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6IDA7XG4gICAgICAgIG1lc3NhZ2UuY29kZWMgPSAoX2IgPSBvYmplY3QuY29kZWMpICE9PSBudWxsICYmIF9iICE9PSB2b2lkIDAgPyBfYiA6IFwiXCI7XG4gICAgICAgIG1lc3NhZ2UudmVyc2lvbiA9IChfYyA9IG9iamVjdC52ZXJzaW9uKSAhPT0gbnVsbCAmJiBfYyAhPT0gdm9pZCAwID8gX2MgOiAwO1xuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9XG59O1xuZnVuY3Rpb24gY3JlYXRlQmFzZUNTVkNNc2dWb2ljZURhdGEoKSB7XG4gICAgcmV0dXJuIHtcbiAgICAgICAgY2xpZW50OiAwLFxuICAgICAgICBwcm94aW1pdHk6IGZhbHNlLFxuICAgICAgICB4dWlkOiBMb25nLlVaRVJPLFxuICAgICAgICBhdWRpYmxlTWFzazogMCxcbiAgICAgICAgdm9pY2VEYXRhOiBuZXcgVWludDhBcnJheSgpLFxuICAgICAgICBjYXN0ZXI6IGZhbHNlLFxuICAgICAgICBmb3JtYXQ6IDAsXG4gICAgICAgIHNlcXVlbmNlQnl0ZXM6IDAsXG4gICAgICAgIHNlY3Rpb25OdW1iZXI6IDAsXG4gICAgICAgIHVuY29tcHJlc3NlZFNhbXBsZU9mZnNldDogMFxuICAgIH07XG59XG5leHBvcnRzLkNTVkNNc2dWb2ljZURhdGEgPSB7XG4gICAgZW5jb2RlKG1lc3NhZ2UsIHdyaXRlciA9IG1pbmltYWxfMS5Xcml0ZXIuY3JlYXRlKCkpIHtcbiAgICAgICAgaWYgKG1lc3NhZ2UuY2xpZW50ICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDgpLmludDMyKG1lc3NhZ2UuY2xpZW50KTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5wcm94aW1pdHkgPT09IHRydWUpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTYpLmJvb2wobWVzc2FnZS5wcm94aW1pdHkpO1xuICAgICAgICB9XG4gICAgICAgIGlmICghbWVzc2FnZS54dWlkLmlzWmVybygpKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDI1KS5maXhlZDY0KG1lc3NhZ2UueHVpZCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuYXVkaWJsZU1hc2sgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMzIpLmludDMyKG1lc3NhZ2UuYXVkaWJsZU1hc2spO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnZvaWNlRGF0YS5sZW5ndG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9PT0gdW5kZWZpbmVkID8gcmVhZGVyLmxlbiA6IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ1NWQ01zZ1ZvaWNlRGF0YSgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuY2xpZW50ID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5wcm94aW1pdHkgPSByZWFkZXIuYm9vbCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UueHVpZCA9IHJlYWRlci5maXhlZDY0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5hdWRpYmxlTWFzayA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uudm9pY2VEYXRhID0gcmVhZGVyLmJ5dGVzKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5jYXN0ZXIgPSByZWFkZXIuYm9vbCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDc6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZm9ybWF0ID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgODpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zZXF1ZW5jZUJ5dGVzID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgOTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zZWN0aW9uTnVtYmVyID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDEwOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnVuY29tcHJlc3NlZFNhbXBsZU9mZnNldCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iLCBfYywgX2QsIF9lLCBfZiwgX2csIF9oLCBfajtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDU1ZDTXNnVm9pY2VEYXRhKCk7XG4gICAgICAgIG1lc3NhZ2UuY2xpZW50ID0gKF9hID0gb2JqZWN0LmNsaWVudCkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogMDtcbiAgICAgICAgbWVzc2FnZS5wcm94aW1pdHkgPSAoX2IgP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lQ1NWQ01zZ0ZpeEFuZ2xlKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5yZWxhdGl2ZSA9IHJlYWRlci5ib29sKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5hbmdsZSA9IGV4cG9ydHMuQ01zZ1FBbmdsZS5kZWNvZGUocmVhZGVyLCByZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYTtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDU1ZDTXNnRml4QW5nbGUoKTtcbiAgICAgICAgbWVzc2FnZS5yZWxhdGl2ZSA9IChfYSA9IG9iamVjdC5yZWxhdGl2ZSkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogZmFsc2U7XG4gICAgICAgIG1lc3NhZ2UuYW5nbGUgPVxuICAgICAgICAgICAgb2JqZWN0LmFuZ2xlICE9PSB1bmRlZmluZWQgJiYgb2JqZWN0LmFuZ2xlICE9PSBudWxsXG4gICAgICAgICAgICAgICAgPyBleHBvcnRzLkNNc2dRQ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50MzIobWVzc2FnZS5zb3VuZEluZGV4KTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNTVkNNc2dQcmVmZXRjaCgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc291bmRJbmRleCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYTtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDU1ZDTXNnUHJlZmV0Y2goKTtcbiAgICAgICAgbWVzc2FnZS5zb3VuZEluZGV4ID0gKF9hID0gb2JqZWN0LnNvdW5kSW5kZXgpICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6IDA7XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH1cbn07XG5mdW5jdGlvbiBjcmVhdGVCYXNlQ1NWQ01zZ0JTUERlY2FsKCkge1xuICAgIHJldHVybiB7XG4gICAgICAgIHBvczogdW5kZWZpbmVkLFxuICAgICAgICBkZWNhbFRleHR1cmVJbmRleDogMCxcbiAgICAgICAgZW50aXR5SW5kZXg6IDAsXG4gICAgICAgIG1vZGVsSW5kZXg6IDAsXG4gICAgICAgIGxvd1ByaW9yaXR5OiBmYWxzZVxuICAgIH07XG59XG5leHBvcnRzLkNTVkNNc2dCU1BEZWNhbCA9IHtcbiAgICBlbmNvZGUobWVzc2FnZSwgd3JpdGVyID0gbWluaW1hbF8xLldyaXRlci5jcmVhdGUoKSkge1xuICAgICAgICBpZiAobWVzc2FnZS5wb3MgIT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgZXhwb3J0cy5DTXNnVmVjdG9yLmVuY29kZShtZXNzYWdlLnBvcywgd3JpdGVyLnVpbnQzMigxMCkuZm9yaygpKS5sZGVsaW0oKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5kZWNhbFRleHR1cmVJbmRleCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigxNikuaW50MzIobWVzc2FnZS5kZWNhbFRleHR1cmVJbmRleCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuZW50aXR5SW5kZXggIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMjQpLmludDMyKG1lc3NhZ2UuZW50aXR5SW5kZXgpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLm1vZGVsSW5kZXggIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMzIpLmludDMyKG1lc3NhZ2UubW9kZWxJbmRleCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UubG93UHJpb3JpdHkgPT09IHRydWUpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNDApLmJvb2wobWVzc2FnZS5sb3dQcmlvcml0eSk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDU1ZDTXNnQlNQRGVjYWwoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnBvcyA9IGV4cG9ydHMuQ01zZ1ZlY3Rvci5kZWNvZGUocmVhZGVyLCByZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZGVjYWxUZXh0dXJlSW5kZXggPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmVudGl0eUluZGV4ID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5tb2RlbEluZGV4ID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5sb3dQcmlvcml0eSA9IHJlYWRlci5ib29sKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCBfYiwgX2MsIF9kO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNTVkNNc2dCU1BEZWNhbCgpO1xuICAgICAgICBtZXNzYWdlLnBvcyA9XG4gICAgICAgICAgICBvYmplY3QucG9zICE9PSB1bmRlZmluZWQgJiYgb2JqZWN0LnBvcyAhPT0gbnVsbFxuICAgICAgICAgICAgICAgID8gZXhwb3J0cy5DTXNnVmVjdG9yLmZyb21QYXJ0aWFsKG9iamVjdC5wb3MpXG4gICAgICAgICAgICAgICAgOiB1bmRlZmluZWQ7XG4gICAgICAgIG1lc3NhZ2UuZGVjYWxUZXh0dXJlSW5kZXggPSAoX2EgPSBvYmplY3QuZGVjYWxUZXh0dXJlSW5kZXgpICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6IDA7XG4gICAgICAgIG1lc3NhZ2UuZW50aXR5SW5kZXggPSAoX2IgPSBvYmplY3QuZW50aXR5SW5k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29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNTVkNNc2dTcGxpdFNjcmVlbigpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudHlwZSA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc2xvdCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucGxheWVySW5kZXggPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iLCBfYztcbiAgICAg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gaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNTVkNNc2dHZXRDdmFyVmFsdWUoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmNvb2tpZSA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuY3Zhck5hbWUgPSByZWFkZXIuc3RyaW5nKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCBfYjtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDU1ZDTXNnR2V0Q3ZhclZhbHVlKCk7XG4gICAgICAgIG1lc3NhZ2UuY29va2llID0gKF9hID0gb2JqZWN0LmNvb2tpZSkgIT09IG51b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zYWdlID0gY3JlYXRlQmFzZUNTVkNNc2dNZW51KCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5kaWFsb2dUeXBlID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5tZW51S2V5VmFsdWVzID0gcmVhZGVyLmJ5dGVzKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCBfYjtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDU1ZDTXNnTWVudSgpO1xuICAgICAgICBtZXNzYWdlLmRpYWxvZ1R5cGUgPSAoX2EgPSBvYmplY3QuZGlhbG9nVHlwZSkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogMDtcbiAgICAgICAgbWVzc2FnZS5tZW51S2V5VmFsdWVzID0gKF9iID0gb2JqZWN0Lm1lbnVLZXlWYWx1ZXMpICE9PSBudWxsICYmIF9iICE9PSB2b2lkIDAgPyBfYiA6IG5ldyBVaW50OEFycmF5KCk7XG4gICAgICAgIHJldHVybiBtZXNzYW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1VzZXJNZXNzYWdlKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5tc2dUeXBlID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5tc2dEYXRhID0gcmVhZGVyLmJ5dGVzKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5wYXNzdGhyb3VnaCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2IsIF9jO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNTVkNNc2dVc2VyTWVzc2FnZSgpO1xuICAgICAgICBtZXNzYWdlLm1zZ1R5cGUgPSAoX2EgPSBvYmplY3QubXNnVHlwZSkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogMDtcbiAgICAgICAgbWVzc2FnZS5tc2dEYXRhID0gKF9iID0gb2JqZWN0Lm1zZ0RhdGEpICE9PSBudWxs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kZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5wYWludG1hcCA9IHJlYWRlci5ieXRlcygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYTtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDU1ZDTXNnUGFpbnRtYXBEYXRhKCk7XG4gICAgICAgIG1lc3NhZ2UucGFpbnRtYXAgPSAoX2EgPSBvYmplY3QucGFpbnRtYXApICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6IG5ldyBVaW50OEFycmF5KCk7XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH1cbn07XG5mdW5jdGlvbiBjcmVhdGVCYXNlQ1NWQ01zZ0dhbWVFdmVudCgpIHtcbiAgICByZXR1cm4geyBldmVudE5hbWU6IFwiXCIsIGV2ZW50aWQ6IDAsIGtleXM6IFtdLCBwYXNzdGhyb3VnaDogMCB9O1xufVxuZXhwb3J0cy5DU1ZDTXNnR2FtZUV2ZW50ID0ge1xuICAgIGVuY29kZShtZXNzYWdlLCB3cml0ZXIgPSBtaW5pbWFsXzEuV3JpdGVyLmNyZWF0ZSgpKSB7XG4gICAgICAgIGlmIChtZXNzYWdlLmV2ZW50TmFtZSAhPT0gXCJcIikge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigxMCkuc3RyaW5nKG1lc3N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TmFtZSA9IHJlYWRlci5zdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmV2ZW50aWQgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmtleXMucHVzaChleHBvcnRzLkNTVkNNc2dHYW1lRXZlbnRfa2V5VC5kZWNvZGUocmVhZGVyLCByZWFkZXIudWludDMyKCkpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnBhc3N0aHJvdWdoID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCBfYiwgX2MsIF9kO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNTVkNNc2dHYW1lRXZlbnQoKTtcbiAgICAgICAgbWVzc2FnZS5ldmVudE5hbWUgPSAoX2EgPSBvYmplY3QuZXZlbnROYW1lKSAhPT0gbnVsbCAmJiBfYSAhPT0gdm9pZCAwID8gX2EgOiBcIlwiO1xuICAgICAgICBtZXNzYWdlLmV2ZW50aWQgPSAoX2IgPSBvYmplY3QuZXZlbnRpZCkgIT09IG51bGwgJiYgX2IgIT09IHZva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ICAgICAgICAgIHdyaXRlci51aW50MzIoMTgpLnN0cmluZyhtZXNzYWdlLnZhbFN0cmluZyk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UudmFsRmxvYXQgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMjkpLmZsb2F0KG1lc3NhZ2UudmFsRmxvYXQpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnZhbExvbmcgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMzIpLmludDMyKG1lc3NhZ2UudmFsTG9uZyk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UudmFsU2hvcnQgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNDApLmludDMyKG1lc3NhZ2UudmFsU2hvcnQpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnZhbEJ5dGUgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNDgpLmludDMyKG1lc3NhZ2UudmFsQnl0ZSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UudmFsQm9vbCA9PT0gdHJ1ZSkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig1NikuYm9vbChtZXNzYWdlLnZhbEJvb2wpO1xuICAgICAgICB9XG4gICAgICAgIGlmICghbWVzc2FnZS52YWxVaW50NjQuaXNaZXJvKCkpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNjQpLnVpbnQ2NChtZXNzYWdlLnZhbFVpbnQ2NCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UudmFsV3N0cmluZy5sZW5ndGggIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNzQpLmJ5dGVzKG1lc3NhZ2UudmFsV3N0cmluZyk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDU1ZDTXNnR2FtZUV2ZW50X2tleVQoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnR5cGUgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnZhbFN0cmluZyA9IHJlYWRlci5zdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnZhbEZsb2F0ID0gcmVhZGVyLmZsb2F0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS52YWxMb25nID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS52YWxTaG9ydCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDY6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudmFsQnl0ZSA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDc6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudmFsQm9vbCA9IHJlYWRlci5ib29sKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgODpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS52YWxVaW50NjQgPSByZWFkZXIudWludDY0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgOTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS52YWxXc3RyaW5nID0gcmVhZGVyLmJ5dGVzKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCBfYiwgX2MsIF9kLCBfZSwgX2YsIF9nLCBfaDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDU1ZDTXNnR2FtZUV2ZW50X2tleVQoKTtcbiAgICAgICAgbWVzc2FnZS50eXBlID0gKF9hID0gb2JqZWN0LnR5cGUpICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6IDA7XG4gICAgICAgI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50MzIobWVzc2FnZS50eXBlKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5uYW1lICE9PSBcIlwiKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDE4KS5zdHJpbmcobWVzc2FnZS5uYW1lKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNTVkNNc2dHYW1lRXZlbnRMaXN0X2tleVQoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnR5cGUgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm5hbWUgPSByZWFkZXIuc3RyaW5nKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gIC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NlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucmVsaWFibGUgPSByZWFkZXIuYm9vbCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubnVtRW50cmllcyA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZW50aXR5RGF0YSA9IHJlYWRlci5ieXRlcygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2IsIF9jO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNTVkNNc2dUZW1wRW50aXRpZXMoKTtcbiAgICAgICAgbWVzc2FnZS5yZWxpYWJsZSA9IChfYSA9IG9iamVjdC5yZWxpYWJsZSkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogZmFsc2U7XG4gICAgICAgIG1lc3NhZ2UubnVtRW50cmllcyA9IChfYiA9IG9iamVjdC5udW1FbnRyaWVzKSAhPT0gbnVsbCAmJiBfYiAhPT0gdm9pZCAwID8gX2IgOiAwO1xuICAgICAgICBtZXNzYWdlLmVudGl0eURhdGEgPSAoX2MgPSBvYmplY3QuZW50aXR5RGF0YSkgIT09IG51bGwgJiYgX2MgIT09IHZvaWQgMCA/IF9jIDogbmV3IFVpbnQ4QXJyYXkoKTt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ICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuYmFzZWxpbmUgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNDApLmludDMyKG1lc3NhZ2UuYmFzZWxpbmUpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmRlbHRhRnJvbSAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig0OCkuaW50MzIobWVzc2FnZS5kZWx0YUZyb20pO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmVudGl0eURhdGEubGVuZ3RoICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDU4KS5ieXRlcyhtZXNzYWdlLmVudGl0eURhdGEpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiB3cml0ZXI7XG4gICAgfSxcbiAgICBkZWNvZGUoaW5wdXQsIGxlbmd0aCkge1xuICAgICAgICBjb25zdCByZWFkZXIgPSBpbnB1dCBpbnN0YW5jZW9mIG1pbmltYWxfMS5SZWFkZXIgPyBpbnB1dCA6IG5ldyBtaW5pbWFsXzEuUmVhZGVyKGlucHV0KTtcbiAgICAgICAgbGV0IGVuZCA9IGxlbmd0aCA9PT0gdW5kZWZpbmVkID8gcmVhZGVyLmxlbiA6IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ1NWQ01zZ1BhY2tldEVudGl0aWVzKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5tYXhFbnRyaWVzID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS51cGRhdGVkRW50cmllcyA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuaXNEZWx0YSA9IHJlYWRlci5ib29sKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS51cGRhdGVCYXNlbGluZSA9IHJlYWRlci5ib29sKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5iYXNlbGluZSA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDY6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZGVsdGFGcm9tID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5lbnRpdHlEYXRhID0gcmVhZGVyLmJ5dGVzKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCBfYiwg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AgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2Uudm9sdW1lICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDMyKS51aW50MzIobWVzc2FnZS52b2x1bWUpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmRlbGF5VmFsdWUgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNDUpLmZsb2F0KG1lc3NhZ2UuZGVsYXlWYWx1ZSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2Uuc2VxdWVuY2VOdW1iZXIgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNDgpLmludDMyKG1lc3NhZ2Uuc2VxdWVuY2VOdW1iZXIpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmVudGl0eUluZGV4ICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDU2KS5pbnQzMihtZXNzYWdlLmVudGl0eUluZGV4KTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5jaGFubmVsICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDY0KS5pbnQzMihtZXNzYWdlLmNoYW5uZWwpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnBpdGNoICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDcyKS5pbnQzMihtZXNzYWdlLnBpdGNoKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5mbGFncyAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig4MCkuaW50MzIobWVzc2FnZS5mbGFncyk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2Uuc291bmROdW0gIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoODgpLnVpbnQzMihtZXNzYWdlLnNvdW5kTnVtKTtcbiAgICAgICA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cihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNTVkNNc2dTb3VuZHNfc291bmRkYXRhVCgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uub3JpZ2luWCA9IHJlYWRlci5zaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm9yaWdpblkgPSByZWFkZXIuc2ludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5vcmlnaW5aID0gcmVhZGVyLnNpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uudm9sdW1lID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZGVsYXlWYWx1ZSA9IHJlYWRlci5mbG9hdCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDY6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc2VxdWVuY2VOdW1iZXIgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA3OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmVudGl0eUluZGV4ID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgODpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5jaGFubmVsID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgOTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5waXRjaCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDEwOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmZsYWdzID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc291bmROdW0gPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc291bmROdW1IYW5kbGUgPSByZWFkZXIuZml4ZWQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDEzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnNwZWFrZXJFbnRpdHkgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5yYW5kb21TZWVkID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTU6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc291bmRMZXZlbCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDE2OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmlzU2VudGVuY2UgPSByZWFkZXIuYm9vbCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDE3OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmlzQW1iaWVudCA9IHJlYWRlci5ib29sKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCBfYiwgX2MsIF9kLCBfZSwgX2YsIF9nLCBfaCwgX2osIF9rLCBfbCwgX20sIF9vLCBfcCwgX3EsIF9yLCBfcztcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDU1ZDTXNnU291bmRzX3NvdW5kZGF0YVQoKTtcbiAgICAgICAgbWVzc2FnZS5vcmlnaW5YID0gKF9hID0gb2JqZWN0Lm9yaWdpblgpICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6IDA7XG4gICAgICAgIG1lc3NhZ2Uub3JpZ2luWSA9IChfYiA9IG9iamVjdC5vcmlnaW5ZKSAhPT0gbnVsbCAmJiBfYiAhPT0gdm9pZC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ICAgICAgIHdyaXRlci51aW50MzIoOCkuaW50MzIobWVzc2FnZS5lbnRJbmRleCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuY2xhc3NJZCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigxNikuaW50MzIobWVzc2FnZS5jbGFzc0lkKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5lbnREYXRhLmxlbmd0aCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigyNikuYnl0ZXMobWVzc2FnZS5lbnREYXRhKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNTVkNNc2dFbnRpdHlNc2coKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmVudEluZGV4ID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5jbGFzc0lkID0gcmVhZ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lcyA9IHtcbiAgICBlbmNvZGUobWVzc2FnZSwgd3JpdGVyID0gbWluaW1hbF8xLldyaXRlci5jcmVhdGUoKSkge1xuICAgICAgICBpZiAobWVzc2FnZS5rZXl2YWx1ZXMubGVuZ3RoICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDEwKS5ieXRlcyhtZXNzYWdlLmtleXZhbHVlcyk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDU1ZDTXNnQ21kS2V5VmFsdWVzKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5rZXl2YWx1ZXMgPSByZWFkZXIuYnl0ZXMoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgIC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ICAgbGV0IGVuZCA9IGxlbmd0aCA9PT0gdW5kZWZpbmVkID8gcmVhZGVyLmxlbiA6IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ1NWQ01zZ0VuY3J5cHRlZERhdGEoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmVuY3J5cHRlZCA9IHJlYWRlci5ieXRlcygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uua2V5VHlwZSA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2I7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ1NWQ01zZ0VuY3J5cHRlZERhdGEoKTtcbiAgICAgICAgbWVzc2FnZS5lbmNyeXB0ZWQgPSAoX2EgPSBvYmplY3QuZW5jcnlwdGVkKSAhPT0gbnVsbCAmJiBfYSAhPT0gdm9pZCAwID8gX2EgOiBuZXcgVWludDhBcnJheSgpO1xuICAgICAgICBtZXNzYWdlLmtle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4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmRlbGF5ID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5wcmltYXJ5VGFyZ2V0ID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5yZXBsYXlTdG9wQXQgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnJlcGxheVN0YXJ0QXQgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA1OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnJlcGxheVNsb3dkb3duQmVnaW4gPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA2OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnJlcGxheVNsb3dkb3duRW5kID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5yZXBsYXlTbG93ZG93blJhdGUgPSByZWFkZXIuZmxvYXQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcp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XQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnByaW1hcnlUYXJnZXRFbnRJbmRleCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZXZlbnRUaW1lID0gcmVhZGVyLmZsb2F0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCBfYiwgX2MsIF9kLCBfZTtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDQ0xDTXNnSGx0dlJlcGxheSgpO1xuICAgICAgICBtZXNzYWdlLnJlcXVlc3QgPSAoX2EgPSBvYmplY3QucmVxdWVzdCkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogMDtcbiAgICAgICAgbWVzc2FnZS5zbG93ZG93bkxlbmd0aCA9IChfYiA9IG9iamVjdC5zbG93ZG93bkxlbmd0aCkgIT09IG51bGwgJiYgX2IgIT09IHZvaWQgMCA/IF9iIDogMDtcbiAgICAgICAgbWVzc2FnZS5zbG93ZG93blJhdGUgPSAoX2MgPSBvYmplY3Quc2xvd2Rvd25SYXRlKSAhPT0gbnVsbCAmJiBfYyAhPT0gdm9pZCAwID8gX2MgOiAwO1xuICAgICAgICBtZXNzYWdlLnByaW1hcnlUYXJnZXRF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nVmLnJlYWRVSW50OCgpO1xuICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IG51bVRhYmxlczsgKytpKSB7XG4gICAgICAgICAgICBjb25zdCB0YWJsZU5hbWUgPSBiaXRidWYucmVhZENTdHJpbmcoKTtcbiAgICAgICAgICAgIHRoaXMuX2hhbmRsZVN0cmluZ1RhYmxlKHRhYmxlTmFtZSwgYml0YnVmKTtcbiAgICAgICAgfVxuICAgIH1cbiAgICBfaGFuZGxlU3RyaW5nVGFibGUobmFtZSwgYml0YnVmKSB7XG4gICAgICAgIHZhciBfYTtcbiAgICAgICAgY29uc3QgdXNlckRhdGFDYWxsYmFjayA9IHRoaXMudXNlckRhdGFDYWxsYmFja3NbbmFtZV07XG4gICAgICAgIGNvbnN0IHRhYmxlID0gKDAsIGFzc2VydF9leGlzdHNfMS5kZWZhdWx0KSh0aGlzLmZpbmRUYWJsZUJ5TmFtZShuYW1lKSk7XG4gICAgICAgIGNvbnN0IG51bUVudHJpZXMgPSBiaXRidWYucmVhZFVJbnQxNigpO1xuICAgICAgICBmb3IgKGxldCBlbnRyeUluZGV4ID0gMDsgZW50cnlJbmRleCA8IG51bUVudHJpZXM7ICsrZW50cnlJbmRleCkge1xuICAgICAgICAgICAgY29uc3QgZW50cnkgPSBiaXRidWYucmVhZENTdHJpbmcoKTtcbiAgICAgICAgICAgIGxldCB1c2VyRGF0YSA9IG51bGw7XG4gICAgICAgICAgICAvLyBoYXMgdXNlciBkYXRhP1xuICAgICAgICAgICAgaWYgKGJpdGJ1Zi5yZWFkT25lQml0KCkpIHtcbiAgICAgICAgICAgICAgICBjb25zdCB1c2VyRGF0YVNpemUgPSBiaXRidWYucmVhZFVJbnQxNigpO1xuICAgICAgICAgICAgICAgIGNvbnN0IHVzZXJEYXRhQnVmID0gYml0YnVmLnJlYWRCeXRlcyh1c2VyRGF0YVNpemUpO1xuICAgICAgICAgICAgICAgIHVzZXJEYXRhID1cbiAgICAgICAgICAgICAgICAgICAgdXNlckRhdGFDYWxsYmFjayA9PT0gdW5kZWZpbmVkXG4gICAgICAgICAgICAgICAgICAgICAgICA/IHVzZXJEYXRhQnVmXG4gICAgICAgICAgICAgICAgICAgICAgICA6IHVzZXJEYXRhQ2FsbGJhY2sodXNlckRhdGFCdWYpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgY29uc3Qgb2xkVXNlckRhdGEgPSAoX2EgPSB0YWJsZS5lbnRyaWVzW2VudHJ5SW5kZXhdKSA9PT0gbnVsbCB8fCBfYSA9PT0gdm9pZCAwID8gdm9pZCAwIDogX2EudXNlckRhdGE7XG4gICAgICAgICAgICB0YWJsZS5lbnRyaWVzW2VudHJ5SW5kZXhdID0geyBlbnRyeSwgdXNlckRhdGEgfTtcbiAgICAgICAgICAgIHRoaXMuZW1pdChcInVwZGF0ZVwiLCB7XG4gICAgICAgICAgICAgICAgdGFibGUsXG4gICAgICAgICAgICAgICAgZW50cnlJbmRleCxcbiAgICAgICAgICAgICAgICBlbnRyeSxcbiAgICAgICAgICAgICAgICB1c2VyRGF0YSxcbiAgICAgICAgICAgICAgICBvbGRVc2VyRGF0YVxuICAgICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICAgICAgLy8gcGFyc2UgY2xpZW50LXNpZGUgZW50cmllc1xuICAgICAgICBpZiAoYml0YnVmLnJlYWRPbmVCaXQoKSkge1xuICAgICAgICAgICAgY29uc3QgbnVtU3RyaW5ncyA9IGJpdGJ1Zi5yZWFkVUludDE2KCk7XG4gICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IG51bVN0cmluZ3M7ICsraSkge1xuICAgICAgICAgICAgICAgIC8vIGVzbGludC1kaXNhYmxlLW5leHQtbGluZSBAdHlwZXNjcmlwdC1lc2xpbnQvbm8tdW51c2VkLXZhcnNcbiAgICAgICAgICAgICAgICBjb25zdCBlbnRyeSA9IGJpdGJ1Zi5yZWFkQ1N0cmluZygpO1xuICAgICAgICAgICAgICAgIGxldCB1c2VyRGF0YSA9IG51bGw7XG4gICAgICAgICAgICAgICAgaWYgKGJpdGJ1Zi5yZWFkT25lQml0KCkpIHtcbiAgICAgICAgICAgICAgICAgICAgY29uc3QgdXNlckRhdGFTaXplID0gYml0YnVmLnJlYWRVSW50MTYoKTtcbiAgICAgICAgICAgICAgICAgICAgY29uc3QgdXNlckRhdGFCdWYgPSBiaXRidWYucmVhZEJ5dGVzKHVzZXJEYXRhU2l6ZSk7XG4gICAgICAgICAgICAgICAgICAgIC8vIGVzbGludC1kaXNhYmxlLW5leHQtbGluZSBAdHlwZXNjcmlwdC1lc2xpbnQvbm8tdW51c2VkLXZhcnNcbiAgICAgICAgICAgICAgICAgICAgdXNlckRhdGEgPVxuICAgICAgICAgICAgICAgICAgICAgICAgdXNlckRhdGFDYWxsYmFjayA9PT0gdW5kZWZpbmVkXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgPyB1c2VyRGF0YUJ1ZlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIDogdXNlckRhdGFDYWxsYmFjayh1c2VyRGF0YUJ1Zik7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIC8vIFRPRE86IGRvIHNvbWV0aGluZyB3aXRoIGNsaWVudC1zaWRlIGVudHJpZXNcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICAvLyB0YWJsZSBpcyByZWFkeVxuICAgICAgICB0aGlzLmVtaXQoXCJwb3N0Y3JlYXRlXCIsIHRhYmxlKTtcbiAgICB9XG4gICAgX3BhcnNlU3RyaW5nVGFibGVVcGRhdGUoYml0YnVmLCB0YWJsZSwgZW50cmllcykge1xuICAgICAgICBjb25zdCBoaXN0b3J5ID0gW107XG4gICAgICAgIGNvbnN0IGVudHJ5Qml0cyA9IE1hdGguY2VpbChNYXRoLmxvZzIodGFibGUubWF4RW50cmllcykpO1xuICAgICAgICBjb25zdCB1c2VyRGF0YUNhbGxiYWNrID0gdGhpcy51c2VyRGF0YUNhbGxiYWNrc1t0YWJsZS5uYW1lXTtcbiAgICAgICAgYXNzZXJ0KCFiaXRidWYucmVhZE9uZUJpdCgpLCBcImRpY3Rpb25hcnkgZW5jb2RpbmcgdW5zdXBwb3J0ZWRcIik7XG4gICAgICAgIGxldCBlbnRyeUluZGV4ID0gLTE7XG4gICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgZW50cmllczsgKytpKSB7XG4gICAgICAgICAgICBlbnRyeUluZGV4ICs9IDE7XG4gICAgICAgICAgICBpZiAoIWJpdGJ1Zi5yZWFkT25lQml0KCkpIHtcbiAgICAgICAgICAgICAgICBlbnRyeUluZGV4ID0gYml0YnVmLnJlYWRVQml0cyhlbnRyeUJpdHMpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgYXNzZXJ0KGVudHJ5SW5kZXggPj0gMCAmJiBlbnRyeUluZGV4IDwgdGFibGUubWF4RW50cmllcywgXCJib2d1cyBzdHJpbmcgaW5kZXhcIik7XG4gICAgICAgICAgICBjb25zdCBleGlzdGluZ0VudHJ5ID0gdGFibGUuZW50cmllc1tlbnRyeUluZGV4XTtcbiAgICAgICAgICAgIGxldCBlbnRyeSA9IG51bGw7XG4gICAgICAgICAgICAvLyBoYXMgdGhlIGVudHJ5IGNoYW5nZWQ/XG4gICAgICAgICAgICBpZiAoYml0YnVmLnJlYWRPbmVCaXQoKSkge1xuICAgICAgICAgICAgICAgIC8vIHN1YnN0cmluZyBjaGVja1xuICAgICAgICAgICAgICAgIGlmIChiaXRidWYucmVhZE9uZUJpdCgpKSB7XG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IGluZGV4ID0gYml0YnVmLnJlYWRVQml0cyg1KTtcbiAgICAgICAgICAgICAgICAgICAgY29uc3QgYnl0ZXNUb0NvcHkgPSBiaXRidWYucmVhZFVCaXRzKGNvbnN0cy5TVUJTVFJJTkdfQklUUyk7XG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IGxhc3QgPSBoaXN0b3J5W2luZGV4XTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGxhc3QgPT0gbnVsbCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFwic3RyaW5nIHRhYmxlIGVudHJ5IGlzIGRlbHRhIGZyb20gbm9uIGV4aXN0ZW50IGVudHJ5XCIpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IHN1YlN0ciA9IGxhc3Quc2xpY2UoMCwgYnl0ZXNUb0NvcHkpO1xuICAgICAgICAgICAgICAgICAgICBjb25zdCBzdWZmaXggPSBiaXRidWYucmVhZENTdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgZW50cnkgPSBzdWJTdHIgKyBzdWZmaXg7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICBlbnRyeSA9IGJpdGJ1Zi5yZWFkQ1N0cmluZygpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgIC8vIElmIHRoZSBzdHJpbmcgaXRzZWxmIGhhc24ndCBjaGFuZ2VkLCB0aGlzIGVudHJ5IG11c3QgYWxyZWFkeSBleGlzdFxuICAgICAgICAgICAgICAgIGVudHJ5ID0gKDAsIGFzc2VydF9leGlzdHNfMS5kZWZhdWx0KShleGlzdGluZ0VudHJ5KS5lbnRyeTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIC8vIHJlYWQgaW4gdGhlIHVzZXIgZGF0YVxuICAgICAgICAgICAgbGV0IHVzZXJEYXRhID0gbnVsbDtcbiAgICAgICAgICAgIGlmIChiaXRidWYucmVhZE9uZUJpdCgpKSB7XG4gICAgICAgICAgICAgICAgLy8gZG9uJ3QgcmVhZCB0aGUgbGVuZ3RoLCBpdCdzIGZpeGVkIGxlbmd0aCBhbmQgdGhlIGxlbmd0aCB3YXMgbmV0d29ya2VkIGRvd24gYWxyZWFkeVxuICAgICAgICAgICAgICAgIGlmICh0YWJsZS51c2VyRGF0YUZpeGVkU2l6ZSkge1xuICAgICAgICAgICAgICAgICAgICBjb25zdCB1c2VyRGF0YUFycmF5ID0gW2JpdGJ1Zi5yZWFkVUJpdHModGFibGUudXNlckRhdGFTaXplQml0cyldO1xuICAgICAgICAgICAgICAgICAgICB1c2VyRGF0YSA9IEJ1ZmZlci5mcm9tKHVzZXJEYXRhQXJyYXkpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgY29uc3QgYnl0ZXMgPSBiaXRidWYucmVhZFVCaXRzKGNvbnN0cy5NQVhfVVNFUkRBVEFfQklUUyk7XG4gICAgICAgICAgICAgICAgICAgIHVzZXJEYXRhID0gYml0YnVmLnJlYWRCeXRlcyhieXRlcyk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGlmICh1c2VyRGF0YUNhbGxiYWNrICE9PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgdXNlckRhdGEgPSB1c2VyRGF0YUNhbGxiYWNrKHVzZXJEYXRhKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICB1c2VyRGF0YSA9IGV4aXN0aW5nRW50cnkgPT09IG51bGwgfHwgZXhpc3RpbmdFbnRyeSA9PT0gdm9pZCAwID8gdm9pZCAwIDogZXhpc3RpbmdFbnRyeS51c2VyRGF0YTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGNvbnN0IG9sZFVzZXJEYXRhID0gZXhpc3RpbmdFbnRyeSA9PT0gbnVsbCB8fCBleGlzdGluZ0VudHJ5ID09PSB2b2lkIDAgPyB2b2lkIDAgOiBleGlzdGluZ0VudHJ5LnVzZXJEYXRhO1xuICAgICAgICAgICAgdGFibGUuZW50cmllc1tlbnRyeUluZGV4XSA9IHsgZW50cnksIHV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XR5Q2hhbmdlKGV2ZW50KSB7XG4gICAgICAgICAgICBjb25zdCBpbmRleCA9IGV2ZW50LmVudGl0eS5pbmRleDtcbiAgICAgICAgICAgIGlmICghdHJhamVjdG9yaWVzLmhhcyhpbmRleCkpXG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgY29uc3QgcHJvamVjdGlsZSA9IGV2ZW50LmVudGl0eTtcbiAgICAgICAgICAgIGZvciAoY29uc3QgY2hhbmdlIG9mIGV2ZW50LmNoYW5nZXMpIHtcbiAgICAgICAgICAgICAgICBpZiAoY2hhbmdlLnZhck5hbWUgIT09IFwibV9uQm91bmNlc1wiKVxuICAgICAgICAgICAgICAgICAgICBjb250aW51ZTtcbiAgICAgICAgICAgICAgICBjb25zdCBvbGRWYWx1ZSA9IChjaGFuZ2Uub2xkVmFsdWUgfHwgMCk7XG4gICAgICAgICAgICAgICAgY29uc3QgbmV3VmFsdWUgPSBjaGFuZ2UubmV3VmFsdWU7XG4gICAgICAgICAgICAgICAgaWYgKG5ld1ZhbHVlID4gb2xkVmFsdWUpIHtcbiAgICAgICAgICAgICAgICAgICAgdHJhamVjdG9yaWVzLmdldChpbmRleCkucHVzaChwcm9qZWN0aWxlLnBvc2l0aW9uKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgZnVuY3Rpb24gb25HcmVuYWRlRGV0b25hdGVFdmVudChldmVudCkge1xuICAgICAgICAgICAgY29uc3QgcHJvamVjdGlsZSA9IGV2ZW50LmVudGl0eTtcbiAgICAgICAgICAgIC8vIHRvZG86IHdoZW4gY291bGQgdGhpcyBiZSBudWxsP1xuICAgICAgICAgICAgY29uc3QgdHJhamVjdG9yeSA9IHRyYWplY3Rvcmllcy5nZXQoZXZlbnQuZW50aXR5aWQpO1xuICAgICAgICAgICAgdHJhamVjdG9yeS5wdXNoKHByb2plY3RpbGUucG9zaXRpb24pO1xuICAgICAgICAgICAgZGVtby5lbWl0KFwiZ3JlbmFkZVRyYWplY3RvcnlcIiwge1xuICAgICAgICAgICAgICAgIHByb2plY3RpbGUsXG4gICAgICAgICAgICAgICAgdGhyb3dlcjogZXZlbnQucGxheWVyLFxuICAgICAgICAgICAgICAgIHRyYWplY3RvcnlcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgICAgIGZ1bmN0aW9uIG9uTW9sb3RvdkRldG9uYXRlKHsgcHJvamVjdGlsZSwgdGhyb3dlciB9KSB7XG4gICAgICAgICAgICAvLyB0b2RvOiB3aGVuIGNvdWxkIHRoaXMgYmUgbnVsbD9cbiAgICAgICAgICAgIGNvbnN0IHRyYWplY3RvcnkgPSB0cmFqZWN0b3JpZXMuZ2V0KHByb2plY3RpbGUuaW5kZXgpO1xuICAgICAgICAgICAgdHJhamVjdG9yeS5wdXNoKHByb2plY3RpbGUucG9zaXRpb24pO1xuICAgICAgICAgICAgZGVtby5lbWl0KFwiZ3JlbmFkZVRyYWplY3RvcnlcIiwge1xuICAgICAgICAgICAgICAgIHByb2plY3RpbGUsXG4gICAgICAgICAgICAgICAgdGhyb3dlcixcbiAgICAgICAgICAgICAgICB0cmFqZWN0b3J5XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfVxuICAgICAgICBkZW1vLm9uKFwibW9sb3RvdkRldG9uYXRlXCIsIG9uTW9sb3RvdkRldG9uYXRlKTtcbiAgICAgICAgZGVtby5lbnRpdGllcy5vbihcImNyZWF0ZVwiLCBvbkVudGl0eUNyZWF0ZSk7XG4gICAgICAgIGRlbW8uZW50aXRpZXMub24oXCJjaGFuZ2VcIiwgb25FbnRpdHlDaGFuZ2UpO1xuICAgICAgICBkZW1vLmVudGl0aWVzLm9uKFwicmVtb3ZlXCIsIG9uRW50aXR5UmVtb3ZlKTtcbiAgICAgICAgZGVtby5nYW1lRXZlbnRzLm9uKFwiZGVjb3lfZGV0b25hdGVcIiwgb25HcmVuYWRlRGV0b25hdGVFdmVudCk7XG4gICAgICAgIGRlbW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R5IHJlcHJlc2VudGF0aW9uLCBlLmcuIGtldmxhci5cbiAgICAgICAgICAgICAgICBsZXQgd2VhcG9uID0gcGVuZGluZy5wbGF5ZXIud2VhcG9ucy5maW5kKHcgPT4gdy5pdGVtSW5kZXggPT09IHBlbmRpbmcud2VhcG9uSWQpO1xuICAgICAgICAgICAgICAgIC8vIHRvZG86IHdoeSBkb2VzIG1vbG90b3YgbmVlZCByZW1hcHBpbmcgdG8gaW5jZW5kaWFyeT9cbiAgICAgICAgICAgICAgICBpZiAoIXdlYXBvbiAmJiBwZW5kaW5nLndlYXBvbklkID09PSA0Nikge1xuICAgICAgICAgICAgICAgICAgICB3ZWFwb24gPSBwZW5kaW5nLnBsYXllci53ZWFwb25zLmZpbmQodyA9PiB3Lml0ZW1JbmRleCA9PT0gNDgpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBkZW1vLmVtaXQoXCJpdGVtUHVyY2hhc2VcIiwgeyAuLi5wZW5kaW5nLCB3ZWFwb24gfSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBwZW5kaW5nUHVyY2hhc2VzID0gW107XG4gICAgICAgIH1cbiAgICAgICAgZnVuY3Rpb24gb25FbnRpdHlDaGFuZ2UoZSkge1xuICAgICAgICAgICAgdmFyIF9hO1xuICAgICAgICAgICAgaWYgKCEoZS5lbnRpdHkgaW5zdGFuY2VvZiBwbGF5ZXJfMS5QbGF5ZXIpKVxuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIC8vIFBFUkY6IGFkZCBhYmlsaXR5IHRvIGxpc3RlbiBvbiBzcGVjaWZpYyB0YWJsZXNcbiAgICAgICAgICAgIGZvciAoY29uc3QgY2hhbmdlIG9mIGUuY2hhbmdlcykge1xuICAgICAgICAgICAgICAgIGlmIChjaGFuZ2UudGFibGVOYW1lICE9PSBcIm1faVdlYXBvblB1cmNoYXNlc1RoaXNSb3VuZFwiKVxuICAgICAgICAgICAgICAgICAgICBjb250aW51ZTtcbiAgICAgICAgICAgICAgICBjb25zdCB3ZWFwb25JZCA9IHBhcnNlSW50KGNoYW5nZS52YXJOYW1lLCAxMCk7XG4gICAgICAgICAgICAgICAgY29uc3Qgb2xkVmFsdWUgPSAoY2hhbmdlLm9sZFZhbHVlIHx8IDApO1xuICAgICAgICAgICAgICAgIGNvbnN0IG5ld1ZhbHVlID0gY2hhbmdlLm5ld1ZhbHVlO1xuICAgICAgICAgICAgICAgIGNvbnN0IGNvdW50ID0gbmV3VmFsdWUgLSBvbGRWYWx1ZTtcbiAgICAgICAgICAgICAgICBpZiAoY291bnQgPiAwKSB7XG4gICAgICAgICAgICAgICAgICAgIHBlbmRpbmdQdXJjaGFzZXMucHVzaCh7XG4gICAgICAgICAgICAgICAgICAgICAgICBwbGF5ZXI6IGUuZW50aXR5LFxuICAgICAgICAgICAgICAgICAgICAgICAgd2VhcG9uSWQsXG4gICAgICAgICAgICAgICAgICAgICAgICBpdGVtTmFtZTogKChfYSA9IGl0ZW1kZWZzXzEuaXRlbURlZmluaXRpb25JbmRleE1hcFt3ZWFwb25JZF0pID09PSBudWxsIHx8IF9hID09PSB2b2lkIDAgPyB2b2lkIDAgOiBfYS5pdGVtTmFtZSkgfHxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcXVpcG1lbnRJZE1hcFt3ZWFwb25JZF0gfHxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBcIlVua25vd25cIixcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvdW50LFxuICAgICAgICAgICAgICAgICAgICAgICAgd2VhcG9uOiB1bmRlZmluZWRcbiAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGRlbW8ub24oXCJ0aWNrZW5kXCIsIG9uVGlja0VuZCk7XG4gICAgICAgIGRlbW8uZW50aXRpZXMub24oXCJjaGFuZ2VcIiwgb25FbnRpdHlDaGFuZ2UpO1xuICAgIC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pIHtcbiAgICAgICAgICAgICAgICAvLyBXZSBvbmx5IGNhcmUgYWJvdXQgdGhlIGZpcmUgbG9vcCBzb3VuZFxuICAgICAgICAgICAgICAgIGlmIChzb3VuZC5zb3VuZE51bUhhbmRsZSA9PT0gMCkge1xuICAgICAgICAgICAgICAgICAgICBpZiAoc291bmQuc291bmROdW0gIT09IGZpcmVMb29wU291bmRJbmRleClcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgLy8gdG9kbzogbmV2ZXIgYWN0dWFsbHkgc2VlIHRoaXNcbiAgICAgICAgICAgICAgICAgICAgaWYgKHNvdW5kLnNvdW5kTnVtSGFuZGxlICE9PSBtb2xvdG92TG9vcClcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAvLyBUaGUgbG9vcCBzb3VuZCBzdGFydHMgd2hlbiB0aGUgZ3JlbmFkZSBpcyB0aHJvd24sXG4gICAgICAgICAgICAgICAgLy8gYW5kIGlzIHN0b3BwZWQgb24gZGV0b25hdGlvbi5cbiAgICAgICAgICAgICAgICBpZiAoKHNvdW5kLmZsYWdzICYgY29uc3RzXzEuU05EX1NUT1ApID09PSAwKVxuICAgICAgICAgICAgICAgICAgICBjb250aW51ZTtcbiAgICAgICAgICAgICAgICBjb25zdCBwcm9qZWN0aWxlID0gZGVtby5lbnRpdGllcy5lbnRpdGllcy5nZXQoc291bmQuZW50aXR5SW5kZXgpO1xuICAgICAgICAgICAgICAgIGlmICghcHJvamVjdGlsZSlcbiAgICAgICAgICAgICAgICAgICAgY29udGludWU7XG4gICAgICAgICAgICAgICAgLy8gVGhpcyBzb3VuZCBpcyBhbHNvIHN0b3BwZWQgb24gdGhlIHJlc3VsdGluZyBpbmZlcm5vXG4gICAgICAgICAgICAgICAgLy8gK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ZW50c1xyXG4gKiBAcmV0dXJucyB7UHJvbWlzZTwqPn0gUHJvbWlzaWZpZWQgZnVuY3Rpb25cclxuICovXHJcbmZ1bmN0aW9uIGFzUHJvbWlzZShmbiwgY3R4LyosIHZhcmFyZ3MgKi8pIHtcclxuICAgIHZhciBwYXJhbXMgID0gbmV3IEFycmF5KGFyZ3VtZW50cy5sZW5ndGggLSAxKSxcclxuICAgICAgICBvZmZzZXQgID0gMCxcclxuICAgICAgICBpbmRleCAgID0gMixcclxuICAgICAgICBwZW5kaW5nID0gdHJ1ZTtcclxuICAgIHdoaWxlIChpbmRleCA8IGFyZ3VtZW50cy5sZW5ndGgpXHJcbiAgICAgICAgcGFyYW1zW29mZnNldCsrXSA9IGFyZ3VtZW50c1tpbmRleCsrXTtcclxuICAgIHJldHVybiBuZXcgUHJvbWlzZShmdW5jdGlvbiBleGVjdXRvcihyZXNvbHZlLCByZWplY3QpIHtcclxuICAgICAgICBwYXJhbXNbb2Zmc2V0XSA9IGZ1bmN0aW9uIGNhbGxiYWNrKGVyci8qLCB2YXJhcmdzICovKSB7XHJcbiAgICAgICAgICAgIGlmIChwZW5kaW5nKSB7XHJcbiAgICAgICAgICAgICAgICBwZW5kaW5nID0gZmFsc2U7XHJcbiAgICAgICAgICAgICAgICBpZiAoZXJyKVxyXG4gICAgICAgICAgICAgICAgICAgIHJlamVjdChlcnIpO1xyXG4gICAgICAgICAgICAgICAgZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgdmFyIHBhcmFtcyA9IG5ldyBBcnJheShhcmd1bWVudHMubGVuZ3RoIC0gMSksXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIG9mZnNldCA9IDA7XHJcbiAgICAgICAgICAgICAgICAgICAgd2hpbGUgKG9mZnNldCA8IHBhcmFtcy5sZW5ndGgpXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHBhcmFtc1tvZmZzZXQrK10gPSBhcmd1bWVudHNbb2Zmc2V0XTtcclxuICAgICAgICAgICA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VuZCkge1xyXG4gICAgICAgIHZhciBiID0gYnVmZmVyW3N0YXJ0KytdO1xyXG4gICAgICAgIHN3aXRjaCAoaikge1xyXG4gICAgICAgICAgICBjYXNlIDA6XHJcbiAgICAgICAgICAgICAgICBjaHVua1tpKytdID0gYjY0W2IgPj4gMl07XHJcbiAgICAgICAgICAgICAgICB0ID0gKGIgJiAzKSA8PCA0O1xyXG4gICAgICAgICAgICAgICAgaiA9IDE7XHJcbiAgICAgICAgICAgICAgICBicmVhaztcclxuICAgICAgICAgICAgY2FzZSAxOlxyXG4gICAgICAgICAgICAgICAgY2h1bmtbaSsrXSA9IGI2NFt0IHwgYiA+PiA0XTtcclxuICAgICAgICAgICAgICAgIHQgPSAoYiAmIDE1KSA8PCAyO1xyXG4gICAgICAgICAgICAgICAgaiA9IDI7XHJcbiAgICAgICAgICAgICAgICBicmVhaztcclxuICAgICAgICAgICAgY2FzZSAyOlxyXG4gICAgICAgICAgICAgICAgY2h1bmtbaSsrXSA9IGI2NFt0IHwgYiA+PiA2XTtcclxuICAgICAgICAgICAgICAgIGNodW5rW2krK10gPSBiNjRbYiAmIDYzXTtcclxuICAgICAgICAgICAgICAgIGogPSAwO1xyXG4gICAgICAgICAgICAgICAgYnJlYWs7XHJcbiAgICAgICAgfVxyXG4gICAgICAgIGlmIChpID4gODE5MSkge1xyXG4gICAgICAgICAgICAocGFydHMgfHwgKHBhcnRzID0gW10pKS5wdXNoKFN0cmluZy5mcm9tQ2hhckNvZGUuYXBwbHkoU3RyaW5nLCBjaHVuaykpO1xyXG4gICAgICAgICAgICBpID0gMDtcclxuICAgICAgICB9XHJcbiAgICB9XHJcbiAgICBpZiAoaikge1xyXG4gICAgICAgIGNodW5rW2krK10gPSBiNjRbdF07XHJcbiAgICAgICAgY2h1bmtbaSsrXSA9IDYxO1xyXG4gICAgICAgIGlmIChqID09PSAxKVxyXG4gICAgICAgICAgICBjaHVua1tpKytdID0gNjE7XHJcbiAgICB9XHJcbiAgICBpZiAocGFydHM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oYyA9PT0gNjEgJiYgaiA+IDEpXHJcbiAgICAgICAgICAgIGJyZWFrO1xyXG4gICAgICAgIGlmICgoYyA9IHM2NFtjXSkgPT09IHVuZGVmaW5lZClcclxuICAgICAgICAgICAgdGhyb3cgRXJyb3IoaW52YWxpZEVuY29kaW5nKTtcclxuICAgICAgICBzd2l0Y2ggKGopIHtcclxuICAgICAgICAgICAgY2FzZSAwOlxyXG4gICAgICAgICAgICAgICAgdCA9IGM7XHJcbiAgICAgICAgICAgICAgICBqID0gMTtcclxuICAgICAgICAgICAgICAgIGJyZWFrO1xyXG4gICAgICAgICAgICBjYXNlIDE6XHJcbiAgICAgICAgICAgICAgICBidWZmZXJbb2Zmc2V0KytdID0gdCA8PCAyIHwgKGMgJiA0OCkgPj4gNDtcclxuICAgICAgICAgICAgICAgIHQgPSBjO1xyXG4gICAgICAgICAgICAgICAgaiA9IDI7XHJcbiAgICAgICAgICAgICAgICBicmVhaztcclxuICAgICAgICAgICAgY2FzZSAyOlxyXG4gICAgICAgICAgICAgICAgYnVmZmVyW29mZnNldCsrXSA9ICh0ICYgMTUpIDw8IDQgfCAoYyAmIDYwKSA+PiAyO1xyXG4gICAgICAgICAgICAgICAgdCA9IGM7XHJcbiAgICAgICAgICAgICAgICBqID0gMztcclxuICAgICAgICAgICAgICAgIGJyZWFrO1xyXG4gICAgICAgICAgICBjYXNlIDM6XHJcbiAgICAgICAgICAgICAgICBidWZmZXJbb2Zmc2V0KytdID0gKHQgJiAzKSA8PCA2IHwgYztcclxuICAgICAgICAgICAgICAgIGogPSAwO1xyXG4gICAgICAgICAgICAgICAgYnJlYWs7XHJcbiAgICAgICAgfVxyXG4gICAgfVxyXG4gICAgaWYgKGogPT09IDEpXHJcbiAgICAgICAgdGhyb3cgRXJyb3IoaW52YWxpZEVuY29kaW5nKTtcclxuICAgIHJldHVybiBvZmZzZXQgLSBzdGFydDtcclxufTtcclxuXHJcbi8qKlxyXG4gKiBUZXN0cyBpZiB0aGUgc3BlY2lma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AgZjMyWzBdID0gdmFsO1xyXG4gICAgICAgICAgICBidWZbcG9zICAgIF0gPSBmOGJbM107XHJcbiAgICAgICAgICAgIGJ1Zltwb3MgKyAxXSA9IGY4YlsyXTtcclxuICAgICAgICAgICAgYnVmW3BvcyArIDJdID0gZjhiWzFdO1xyXG4gICAgICAgICAgICBidWZbcG9zICsgM10gPSBmOGJbMF07XHJcbiAgICAgICAgfVxyXG5cclxuICAgICAgICAvKiBpc3RhbmJ1bCBpZ25vcmUgbmV4dCAqL1xyXG4gICAgICAgIGV4cG9ydHMud3JpdGVGbG9hdExFID0gbGUgPyB3cml0ZUZsb2F0X2YzMl9jcHkgOiB3cml0ZUZsb2F0X2YzMl9yZXY7XHJcbiAgICAgICAgLyogaXN0YW5idWwgaWdub3JlIG5leHQgKi9cclxuICAgICAgICBleHBvcnRzLndyaXRlRmxvYXRCRSA9IGxlID8gd3JpdGVGbG9hdF9mMzJfcmV2IDogd3JpdGVGbG9hdF9mMzJfY3B5O1xyXG5cclxuICAgICAgICBmdW5jdGlvbiByZWFkRmxvYXRfZjMyX2NweShidWYsIHBvcykge1xyXG4gICAgICAgICAgICBmOGJbMF0gPSBidWZbcG9zICAgIF07XHJcbiAgICAgICAgICAgIGY4YlsxXSA9IGJ1Zltwb3MgKyAxXTtcclxuICAgICAgICAgICAgZjhiWzJdID0gYnVmW3BvcyArIDJdO1xyXG4gICAgICAgICAgICBmOGJbM10gPSBidWZbcG9zICsgM107XHJcbiAgICAgICAgICAgIHJldHVybiBmMzJbMF07XHJcbiAgICAgICAgfVxyXG5cclxuICAgICAgICBmdW5jdGlvbiByZWFkRmxvYXRfZjMyX3JldihidWYsIHBvcykge1xyXG4gICAgICAgICAgICBmOGJbM10gPSBidWZbcG9zICAgIF07XHJcbiAgICAgICAgICAgIGY4YlsyXSA9IGJ1Zltwb3MgKyAxXTtcclxuICAgICAgICAgICAgZjhiWzFdID0gYnVmW3BvcyArIDJdO1xyXG4gICAgICAgICAgICBmOGJbMF0gPSBidWZbcG9zICsgM107XHJcbiAgICAgICAgICAgIHJldHVybiBmMzJbMF07XHJcbiAgICAgICAgfVxyXG5cclxuICAgICAgICAvKiBpc3RhbmJ1bCBpZ25vcmUgbmV4dCAqL1xyXG4gICAgICAgIGV4cG9ydHMucmVhZEZsb2F0TEUgPSBsZSA/IHJlYWRGbG9hdF9mMzJfY3B5IDogcmVhZEZsb2F0X2YzMl9yZXY7XHJcbiAgICAgICAgLyogaXN0YW5idWwgaWdub3JlIG5leHQgKi9cclxuICAgICAgICBleHBvcnRzLnJlYWRGbG9hdEJFID0gbGUgPyByZWFkRmxvYXRfZjMyX3JldiA6IHJlYWRGbG9hdF9mMzJfY3B5O1xyXG5cclxuICAgIC8vIGZsb2F0OiBpZWVlNzU0XHJcbiAgICB9KSgpOyBlbHNlIChmdW5jdGlvbigpIHtcclxuXHJcbiAgICAgICAgZnVuY3Rpb24gd3JpdGVGbG9hdF9pZWVlNzU0KHdyaXRlVWludCwgdmFsLCBidWYsIHBvcykge1xyXG4gICAgICAgICAgICB2YXIgc2lnbiA9IHZhbCA8IDAgPyAxIDogMDtcclxuICAgICAgICAgICAgaWYgKHNpZ24pXHJcbiAgICAgICAgICAgICAgICB2YWwgPSAtdmFsO1xyXG4gICAgICAgICAgICBpZiAodmFsID09PSAwKVxyXG4gICAgICAgICAgICAgICAgd3JpdGVVaW50KDEgLyB2YWwgPiAwID8gLyogcG9zaXRpdmUgKi8gMCA6IC8qIG5lZ2F0aXZlIDAgKi8gMjE0NzQ4MzY0OCwgYnVmLCBwb3MpO1xyXG4gICAgICAgICAgICBlbHNlIGlmIChpc05hTih2YWwpKVxyXG4gICAgICAgICAgICAgICAgd3JpdGVVaW50KDIxNDMyODkzNDQsIGJ1ZiwgcG9zKTtcclxuICAgICAgICAgICAgZWxzZSBpZiAodmFsID4gMy40MDI4MjM0NjYzODUyODg2ZSszOCkgLy8gKy1JbmZpbml0eVxyXG4gICAgICAgICAgICAgICAgd3JpdGVVaW50KChzaWduIDw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gKyAxLFxyXG4gICAgICAgICAgICAgICAgZXhwb25lbnQgPSB1aW50ID4+PiAyMyAmIDI1NSxcclxuICAgICAgICAgICAgICAgIG1hbnRpc3NhID0gdWludCAmIDgzODg2MDc7XHJcbiAgICAgICAgICAgIHJldHVybiBleHBvbmVudCA9PT0gMjU1XHJcbiAgICAgICAgICAgICAgICA/IG1hbnRpc3NhXHJcbiAgICAgICAgICAgICAgICA/IE5hTlxyXG4gICAgICAgICAgICAgICAgOiBzaWduICogSW5maW5pdHlcclxuICAgICAgICAgICAgICAgIDogZXhwb25lbnQgPT09IDAgLy8gZGVub3JtYWxcclxuICAgICAgICAgICAgICAgID8gc2lnbiAqIDEuNDAxMjk4NDY0MzI0ODE3ZS00NSAqIG1hbnRpc3NhXHJcbiAgICAgICAgICAgICAgICA6IHNpZ24gKiBNYXRoLnBvdygyLCBleHBvbmVudCAtIDE1MCkgKiAobWFudGlzc2EgKyA4Mzg4NjA4KTtcclxuICAgICAgICB9XHJcblxyXG4gICAgICAgIGV4cG9ydHMucmVhZEZsb2F0TEUgPSByZWFkRmxvYXRfaWVlZTc1NC5iaW5kKG51bGwsIHJlYWRVaW50TEUpO1xyXG4gICAgICAgIGV4cG9ydHMucmVhZEZsb2F0QkUgPSByZWFkRmxvYXRfaWVlZTc1NC5iaW5kKG51bGwsIHJlYWRVaW50QkUpO1xyXG5cclxuICAgIH0pKCk7XHJcblxyXG4gICAgLy8gZG91YmxlOiB0eXBlZCBhcnJheVxyXG4gICAgaWYgKHR5cGVvZiBGbG9hdDY0QXJyYXkgIT09IFwidW5kZWZpbmVkXCIpIChmdW5jdGlvbigpIHtcclxuXHJcbiAgICAgICAgdmFyIGY2NCA9IG5ldyBGbG9hdDY0QXJyYXkoWy0wXSksXHJcbiAgICAgICAgICAgIGY4YiA9IG5ldyBVaW50OEFycmF5KGY2NC5idWZmZXIpLFxyXG4gICAgICAgICAgICBsZSAgPSBmOGJbN10gPT09IDEyODtcclxuXHJcbiAgICAgICAgZnVuY3Rpb24gd3JpdGVEb3VibGVfZjY0X2NweSh2YWwsIGJ1ZiwgcG9zKSB7XHJcbiAgICAgICAgICAgIGY2NFswXSA9IHZhbDtcclxuICAgICAgICAgICAgYnVmW3BvcyAgICBdID0gZjhiWzBdO1xyXG4gICAgICAgICAgICBidWZbcG9zICsgMV0gPSBmOGJbMV07XHJcbiAgICAgICAgICAgIGJ1Zltwb3MgKyAyXSA9IGY4YlsyXTtcclxuICAgICAgICAgICAgYnVmW3BvcyArIDNdID0gZjhiWzNdO1xyXG4gICAgICAgICAgICBidWZbcG9zICsgNF0gPSBmOGJbNF07XHJcbiAgICAgICAgICAgIGJ1Zltwb3MgKyA1XSA9IGY4Yls1XTtcclxuICAgICAgICAgICAgYnVmW3BvcyArIDZdID0gZjhiWzZdO1xyXG4gICAgICAgICAgICBidWZbcG9zICsgN10gPSBmOGJbN107XHJcbiAgICAgICAgfVxyXG5cclxuICAgICAgICBmdW5jdGlvbiB3cml0ZURvdWJsZV9mNjRfcmV2KHZhbCwgYnVmLCBwb3MpIHtcclxuICAgICAgICAgICAgZjY0WzBdID0gdmFsO1xyXG4gICAgICAgICAgICBidWZbcG9zICAgIF0gPSBmOGJbN107XHJcbiAgICAgICAgICAgIGJ1Zltwb3MgKyAxXSA9IGY4Yls2XTtcclxuICAgICAgICAgICAgYnVmW3BvcyArIDJdID0gZjhiWzVdO1xyXG4gICAgICAgICAgICBidWZbcG9zICsgM10gPSBmOGJbNF07XHJcbiAgICAgICAgICAgIGJ1Zltwb3MgKyA0XSA9IGY4YlszXTtcclxuICAgICAgICAgICAgYnVmW3BvcyArIDVdID0gZjhiWzJdO1xyXG4gICAgICAgICAgICBidWZbcG9zICsgNl0gPSBmOGJbMV07XHJcbiAgICAgICAgICAgIGJ1Zltwb3MgKyA3XSA9IGY4YlswXTtcclxuICAgICAgICB9XHJcblxyXG4gICAgICAgIC8qIGlzdGFuYnVsIGlnbm9yZSBuZXh0ICovXHJcbiAgICAgICAgZXhwb3J0cy53cml0ZURvdWJsZUxFID0gbGUgPyB3cml0ZURvdWJsZV9mNjRfY3B5IDogd3JpdGVEb3VibGVfZjY0X3JldjtcclxuICAgICAgICAvKiBpc3RhbmJ1bCBpZ25vcmUgbmV4dCAqL1xyXG4gICAgICAgIGV4cG9ydHMud3JpdGVEb3VibGVCRSA9IGxlID8gd3JpdGVEb3VibGVfZjY0X3JldiA6IHdyaXRlRG91YmxlX2Y2NF9jcHk7XHJcblxyXG4gICAgICAgIGZ1bmN0aW9uIHJlYWREb3VibGVfZjY0X2NweShidWYsIHBvcykge1xyXG4gICAgICAgICAgICBmOGJbMF0gPSBidWZbcG9zICAgIF07XHJcbiAgICAgICAgICAgIGY4YlsxXSA9IGJ1Zltwb3MgKyAxXTtcclxuICAgICAgICAgICAgZjhiWzJdID0gYnVmW3BvcyArIDJdO1xyXG4gICAgICAgICAgICBmOGJbM10gPSBidWZbcG9zICsgM107XHJcbiAgICAgICAgICAgIGY4Yls0XSA9IGJ1Zltwb3MgKyA0XTtcclxuICAgICAgICAgICAgZjhiWzVdID0gYnVmW3BvcyArIDVdO1xyXG4gICAgICAgICAgICBmOGJbNl0gPSBidWZbcG9zICsgNl07XHJcbiAgICAgICAgICAgIGY4Yls3XSA9IGJ1Zltwb3MgKyA3XTtcclxuICAgICAgICAgICAgcmV0dXJuIGY2NFswXTtcclxuICAgICAgICB9XHJcblxyXG4gICAgICAgIGZ1bmN0aW9uIHJlYWREb3VibGVfZjY0X3JldihidWYsIHBvcykge1xyXG4gICAgICAgICAgICBmOGJbN10gPSBidWZbcG9zICAgIF07XHJcbiAgICAgICAgICAgIGY4Yls2XSA9IGJ1Zltwb3MgKyAxXTtcclxuICAgICAgICAgICAgZjhiWzVdID0gYnVmW3BvcyArIDJdO1xyXG4gICAgICAgICAgICBmOGJbNF0gPSBidWZbcG9zICsgM107XHJcbiAgICAgICAgICAgIGY4YlszXSA9IGJ1Zltwb3MgKyA0XTtcclxuICAgICAgICAgICAgZjhiWzJdID0gYnVmW3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HZhbCkpIHtcclxuICAgICAgICAgICAgICAgIHdyaXRlVWludCgwLCBidWYsIHBvcyArIG9mZjApO1xyXG4gICAgICAgICAgICAgICAgd3JpdGVVaW50KDIxNDY5NTkzNjAsIGJ1ZiwgcG9zICsgb2ZmMSk7XHJcbiAgICAgICAgICAgIH0gZWxzZSBpZiAodmFsID4gMS43OTc2OTMxMzQ4NjIzMTU3ZSszMDgpIHsgLy8gKy1JbmZpbml0eVxyXG4gICAgICAgICAgICAgICAgd3JpdGVVaW50KDAsIGJ1ZiwgcG9zICsgb2ZmMCk7XHJcbiAgICAgICAgICAgICAgICB3cml0ZVVpbnQoKHNpZ24gPDwgMzEgfCAyMTQ2NDM1MDcyKSA+Pj4gMCwgYnVmLCBwb3MgKyBvZmYxKTtcclxuICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgIHZhciBtYW50aXNzYTtcclxuICAgICAgICAgICAgICAgIGlmICh2YWwgPCAyLjIyNTA3Mzg1ODUwNzIwMTRlLTMwOCkgeyAvLyBkZW5vcm1hbFxyXG4gICAgICAgICAgICAgICAgICAgIG1hbnRpc3NhID0gdmFsIC8gNWUtMzI0O1xyXG4gICAgICAgICAgICAgICAgICAgIHdyaXRlVWludChtYW50aXNzYSA+Pj4gMCwgYnVmLCBwb3MgKyBvZmYwKTtcclxuICAgICAgICAgICAgICAgICAgICB3cml0ZVVpbnQoKHNpZ24gPDwgMzEgfCBtYW50aXNzYSAvIDQyOTQ5NjcyOTYpID4+PiAwLCBidWYsIHBvcyArIG9mZjEpO1xyXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICB2YXIgZXhwb25lbnQgPSBNYXRoLmZsb29yKE1hdGgubG9nKHZhbCkgLyBNYXRoLkxOMik7XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKGV4cG9uZW50ID09PSAxMDI0KVxyXG4gICAgICAgICAgICAgICAgICAgICAgICBleHBvbmVudCA9IDEwMjM7XHJcbiAgICAgICAgICAgICAgICAgICAgbWFudGlzc2EgPSB2YWwgKiBNYXRoLnBvdygyLCAtZXhwb25lbnQpO1xyXG4gICAgICAgICAgICAgICAgICAgIHdyaXRlVWludChtYW50aXNzYSAqIDQ1MDM1OTk2MjczNzA0OTYgPj4+IDAsIGJ1ZiwgcG9zICsgb2ZmMCk7XHJcbiAgICAgICAgICAgICAgICAgICAgd3JpdGVVaW50KChzaWduIDw8IDMxIHwgZXhwb25lbnQgKyAxMDIzIDw8IDIwIHwgbWFudGlzc2EgKiAxMDQ4NTc2ICYgMTA0ODU3NSkgPj4+IDAsIGJ1ZiwgcG9zICsgb2ZmMSk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9XHJcblxyXG4gICAgICAgIGV4cG9ydHMud3JpdGVEb3VibGVMRSA9IHdyaXRlRG91YmxlX2llZWU3NTQuYmluZChudWxsLCB3cml0ZVVpbnRMRSwgMCwgNCk7XHJcbiAgICAgICAgZXhwb3J0cy53cml0ZURvdWJsZUJFID0gd3JpdGVEb3VibGVfaWVlZTc1NC5iaW5kKG51bGwsIHdyaXRlVWludEJFLCA0LCAwKTtcclxuXHJcbiAgICAgICAgZnVuY3Rpb24gcmVhZERvdWJsZV9pZWVlNzU0KHJlYWRVaW50LCBvZmYwLCBvZmYxLCBidWYsIHBvcykge1xyXG4gICAgICAgICAgICB2YXIgbG8gPSByZWFkVWludChidWYsIHBvcyArIG9mZjApLFxyXG4gICAgICAgICAgICAgICAgaGkgPSByZWFkVWludChidWYsIHBvcyArIG9mZjEpO1xyXG4gICAgICAgICAgICB2YXIgc2lnbiA9IChoaSA+PiAzMSkgKiAyICsgMSxcclxuICAgICAgICAgICAgICAgIGV4cG9uZW50ID0gaGkgPj4+IDIwICYgMjA0NyxcclxuICAgICAgICAgICAgICAgIG1hbnRpc3NhID0gNDI5NDk2NzI5NiAqIChoaSAmIDEwNDg1NzUpICsgbG87XHJcbiAgICAgICAgICAgIHJldHVybiBleHBvbmVudCA9PT0gMjA0N1xyXG4gICAgICAgICAgICAgICAgPyBtYW50aXNzYVxyXG4gICAgICAgICAgICAgICAgPyBOYU5cclxuICAgICAgICAgICAgICAgIDogc2lnbiAqIEluZmluaXR5XHJcbiAgICAgICAgICAgICAgICA6IGV4cG9uZW50ID09PSAwIC8vIGRlbm9ybWFsXHJcbiAgICAgICAgICAgICAgICA/IHNpZ24gKiA1ZS0zMjQgKiBtYW50aXNzYVxyXG4gICAgICAgICAgICAgICAgOiBzaWduICogTWF0aC5wb3coMiwgZXhwb25lbnQgLSAxMDc1KSAqIChtYW50aXNzYSArIDQ1MDM1OTk2MjczNzA0OTYpO1xyXG4gICAgICAgIH1cclxuXHJcbiAgICAgICAgZXhwb3J0cy5yZWFkRG91YmxlTEUgPSByZWFkRG91YmxlX2llZWU3NTQuYmluZChudWxsLCByZWFkVWludExFLCAwLCA0KTtcclxuICAgICAgICBleHBvcnRzLnJlYWREb3VibGVCRSA9IHJlYWREb3VibGVfaWVlZTc1NC5iaW5kKG51bGwsIHJlYWRVaW50QkUsIDQsIDApO1xyXG5cclxuICAgIH0pKCk7XHJcblxyXG4gICAgcmV0dXJuIGV4cG9ydHM7XHJcbn1cclxuXHJcbi8vIHVpbnQgaGVscGVyc1xyXG5cclxuZnVuY3Rpb24gd3JpdGVVaW50TEUodmFsLCBidWYsIHBvcykge1xyXG4gICAgYnVmW3BvcyAgICBdID0gIHZhbCAgICAgICAgJiAyNTU7XHJcbiAgICBidWZbcG9zICsgMV0gPSAgdmFsID4+PiA4ICAmIDI1NTtcclxuICAgIGJ1Zltwb3MgKyAyXSA9ICB2YWwgPj4+IDE2ICYgMjU1O1xyXG4gICAgYnVmW3BvcyArIDNdID0gIHZhbCA+Pj4gMjQ7XHJcbn1cclxuXHJcbmZ1bmN0aW9uIHdyaXRlVWludEJFKHZhbCwgYnVmLCBwb3MpIHtcclxuICAgIGJ1Zltwb3MgICAgXSA9ICB2YWwgPj4+IDI0O1x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cbiAgICB2YXIgc3RhcnQgPSBvZmZzZXQsXHJcbiAgICAgICAgYzEsIC8vIGNoYXJhY3RlciAxXHJcbiAgICAgICAgYzI7IC8vIGNoYXJhY3RlciAyXHJcbiAgICBmb3IgKHZhciBpID0gMDsgaSA8IHN0cmluZy5sZW5ndGg7ICsraSkge1xyXG4gICAgICAgIGMxID0gc3RyaW5nLmNoYXJDb2RlQXQoaSk7XHJcbiAgICAgICAgaWYgKGMxIDwgMTI4KSB7XHJcbiAgICAgICAgICAgIGJ1ZmZlcltvZmZzZXQrK10gPSBjMTtcclxuICAgICAgICB9IGVsc2UgaWYgKGMxIDwgMjA0OCkge1xyXG4gICAgICAgICAgICBidWZmZXJbb2Zmc2V0KytdID0gYzEgPj4gNiAgICAgICB8IDE5MjtcclxuICAgICAgICAgICAgYnVmZmVyW29mZnNldCsrXSA9IGMxICAgICAgICYgNjMgfCAxMjg7XHJcbiAgICAgICAgfSBlbHNlIGlmICgoYzEgJiAweEZDMDApID09PSAweEQ4MDAgJiYgKChjMiA9IHN0cmluZy5jaGFyQ29kZUF0KGkgKyAxKSkgJiAweEZDMDApID09PSAweERDMDApIHtcclxuICAgICAgICAgICAgYzEgPSAweDEwMDAwICsgKChjMSAmIDB4MDNGRikgPDwgMTApICsgKGMyICYgMHgwM0ZGKTtcclxuICAgICAgICAgICAgKytpO1xyXG4gICAgICAgICAgICBidWZmZXJbb2Zmc2V0KytdID0gYzEgPj4gMTggICAgICB8IDI0MDtcclxuICAgICAgICAgICAgYnVmZmVyW29mZnNldCsrXSA9IGMxID4+IDEyICYgNjMgfCAxMjg7XHJcbiAgICAgICAgICAgIGJ1ZmZlcltvZmZzZXQrK10gPSBjMSA+PiA2ICAmIDYzIHwgMTI4O1xyXG4gICAgICAgICAgICBidWZmZXJbb2Zmc2V0KytdID0gYzEgICAgICAgJiA2MyB8IDEyODtcclxuICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICBidWZmZXJbb2Zmc2V0KytdID0gYzEg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wYXJlQWJzKGFyciwgTUFYX0lOVF9BUlIpIDwgMCkge1xyXG4gICAgICAgICAgICBzd2l0Y2ggKGxlbmd0aCkge1xyXG4gICAgICAgICAgICAgICAgY2FzZSAwOiByZXR1cm4gMDtcclxuICAgICAgICAgICAgICAgIGNhc2UgMTogcmV0dXJuIGFyclswXTtcclxuICAgICAgICAgICAgICAgIGNhc2UgMjogcmV0dXJuIGFyclswXSArIGFyclsxXSAqIEJBU0U7XHJcbiAgICAgICAgICAgICAgICBkZWZhdWx0OiByZXR1cm4gYXJyWzBdICsgKGFyclsxXSArIGFyclsyXSAqIEJBU0UpICogQkFTRTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH1cclxuICAgICAgICByZXR1cm4gYXJyO1xyXG4gICAgfVxyXG5cclxuICAgIGZ1bmN0aW9uIHRyaW0odikge1xyXG4gICAgICAgIHZhciBpID0gdi5sZW5ndGg7XHJcbiAgICAgICAgd2hpbGUgKHZbLS1pXSA9PT0gMCk7XHJcbiAgICAgICAgdi5sZW5ndGggPSBpICsgMTtcclxuICAgIH1cclxuXHJcbiAgICBmdW5jdGlvbiBjcmVhdGVBcnJheShsZW5ndGgpIHsgLy8gZnVuY3Rpb24gc2hhbWVsZXNzbHkgc3RvbGVuIGZyb20gWWFmZmxlJ3MgbGlicmFyeSBodHRwczovL2dpdGh1Yi5jb20vWWFmZmxlL0JpZ0ludGVnZXJcclxuICAgICAgICB2YXIgeCA9IG5ldyBBcnJheShsZW5ndGgpO1xyXG4gICAgICAgIHZhciBpID0gLTE7XHJcbiAgICAgICAgd2hpbGUgKCsraSA8IGxlbmd0aCkge1xyXG4gICAgICAgICAgICB4W2ldID0gMDtcclxuICAgICAgICB9XHJcbiAgICAgICAgcmV0dXJuIHg7XHJcbiAgICB9XHJcblxyXG4gICAgZnVuY3Rpb24gdHJ1bmNhdGUobikge1xyXG4gICAgICAgIGlmIChuID4gMCkgcmV0dXJuIE1hdGguZmxvb3Iobik7XHJcbiAgICAgICAgcmV0dXJuIE1hdGguY2VpbChuKTtcclxuICAgIH1cclxuXHJcbiAgICBmdW5jdGlvbiBhZGQoYSwgYikgeyAvLyBhc3N1bWVzIGEgYW5kIGIgYXJlIGFycmF5cyB3aXRoIGEubGVuZ3RoID49IGIubGVuZ3RoXHJcbiAgICAgICAgdmFyIGxfYSA9IGEubGVuZ3RoLFxyXG4gICAgICAgICAgICBsX2IgPSBiLmxlbmd0aCxcclxuICAgICAgICAgICAgciA9IG5ldyBBcnJheShsX2EpLFxyXG4gICAgICAgICAgICBjYXJyeSA9IDAsXHJcbiAgICAgICAgICAgIGJhc2UgPSBCQVNFLFxyXG4gICAgICAgICAgICBzdW0sIGk7XHJcbiAgICAgICAgZm9yIChpID0gMDsgaSA8IGxfYjsgaSsrKSB7XHJcbiAgICAgICAgICAgIHN1bSA9IGFbaV0gKyBiW2ldICsgY2Fycnk7XHJcbiAgICAgICAgICAgIGNhcnJ5ID0gc3VtID49IGJhc2UgPyAxIDogMDtcclxuICAgICAgICAgICAgcltpXSA9IHN1bSAtIGNhcnJ5ICogYmFzZTtcclxuICAgICAgICB9XHJcbiAgICAgICAgd2hpbGUgKGkgPCBsX2EpIHtcclxuICAgICAgICAgICAgc3VtID0gYVtpXSArIGNhcnJ5O1xyXG4gICAgICAgICAgICBjYXJyeSA9IHN1bSA9PT0gYmFzZSA/IDEgOiAwO1xyXG4gICAgICAgICAgICByW2krK10gPSBzdW0gLSBjYXJyeSAqIGJhc2U7XHJcbiAgICAgICAgfVxyXG4gICAgICAgIGlmIChjYXJyeSA+IDApIHIucHVzaChjYXJyeSk7XHJcbiAgICAgICAgcmV0dXJuIHI7XHJcbiAgICB9XHJcblxyXG4gICAgZnVuY3Rpb24gYWRkQW55KGEsIGIpIHtcclxuICAgICAgICBpZiAoYS5sZW5ndGggPj0gYi5sZW5ndGgpIHJldHVybiBhZGQoYSwgYik7XHJcbiAgICAgICAgcmV0dXJuIGFkZChiLCBhKTtcclxuICAgIH1cclxuXHJcbiAgICBmdW5jdGlvbiBhZGRTbWFsbChhLCBjYXJyeSkgeyAvLyBhc3N1bWVzIGEgaXMgYXJyYXksIGNhcnJ5IGlzIG51bWJlciB3aXRoIDAgPD0gY2FycnkgPCBNQVhfSU5UXHJcbiAgICAgICAgdmFyIGwgPSBhLmxlbmd0aCxcclxuICAgICAgICAgICAgciA9IG5ldyBBcnJheShsKSxcclxuICAgICAgICAgICAgYmFzZSA9IEJBU0UsXHJcbiAgICAgICAgICAgIHN1bSwgaTtcclxuICAgICAgICBmb3IgKGkgPSAwOyBpIDwgbDsgaSsrKSB7XHJcbiAgICAgICAgICAgIHN1bSA9IGFbaV0gLSBiYXNlICsgY2Fycnk7XHJcbiAgICAgICAgICAgIGNhcnJ5ID0gTWF0aC5mbG9vcihzdW0gLyBiYXNlKTtcclxuICAgICAgICAgICAgcltpXSA9IHN1bSAtIGNhcnJ5ICogYmFzZTtcclxuICAgICAgICAgICAgY2FycnkgKz0gMTtcclxuICAgICAgICB9XHJcbiAgICAgICAgd2hpbGUgKGNhcnJ5ID4gMCkge1xyXG4gICAgICAgICAgICByW2krK10gPSBjYXJyeSAlIGJhc2U7XHJcbiAgICAgICAgICAgIGNhcnJ5ID0gTWF0aC5mbG9vcihjYXJyeSAvIGJhc2UpO1xyXG4gICAgICAgIH1cclxuICAgICAgICByZXR1cm4gcjtcclxuICAgIH1cclxuXHJcbiAgICBCaWdJbnRlZ2VyLnByb3RvdHlwZS5hZGQgPSBmdW5jdGlvbiAodikge1xyXG4gICAgICAgIHZhciBuID0gcGFyc2VWYWx1ZSh2KTtcclxuICAgICAgICBpZiAodGhpcy5zaWduICE9PSBuLnNpZ24pIHtcclxuICAgICAgICAgICAgcmV0dXJuIHRoaXMuc3VidHJhY3Qobi5uZWdhdGUoKSk7XHJcbiAgICAgICAgfVxyXG4gICAgICAgIHZhciBhID0gdGhpcy52YWx1ZSwgYiA9IG4udmFsdWU7XHJcbiAgICAgICAgaWYgKG4uaXNTbWFsbCkge1xyXG4gICAgICA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ZlQmlnSW50KHRoaXMudmFsdWUgKyBwYXJzZVZhbHVlKHYpLnZhbHVlKTtcclxuICAgIH1cclxuICAgIE5hdGl2ZUJpZ0ludC5wcm90b3R5cGUucGx1cyA9IE5hdGl2ZUJpZ0ludC5wcm90b3R5cGUuYWRkO1xyXG5cclxuICAgIGZ1bmN0aW9uIHN1YnRyYWN0KGEsIGIpIHsgLy8gYXNzdW1lcyBhIGFuZCBiIGFyZSBhcnJheXMgd2l0aCBhID49IGJcclxuICAgICAgICB2YXIgYV9sID0gYS5sZW5ndGgsXHJcbiAgICAgICAgICAgIGJfbCA9IGIubGVuZ3RoLFxyXG4gICAgICAgICAgICByID0gbmV3IEFycmF5KGFfbCksXHJcbiAgICAgICAgICAgIGJvcnJvdyA9IDAsXHJcbiAgICAgICAgICAgIGJhc2UgPSBCQVNFLFxyXG4gICAgICAgICAgICBpLCBkaWZmZXJlbmNlO1xyXG4gICAgICAgIGZvciAoaSA9IDA7IGkgPCBiX2w7IGkrKykge1xyXG4gICAgICAgICAgICBkaWZmZXJlbmNlID0gYVtpXSAtIGJvcnJvdyAtIGJbaV07XHJcbiAgICAgICAgICAgIGlmIChkaWZmZXJlbmNlIDwgMCkge1xyXG4gICAgICAgICAgICAgICAgZGlmZmVyZW5jZSArPSBiYXNlO1xyXG4gICAgICAgICAgICAgICAgYm9ycm93ID0gMTtcclxuICAgICAgICAgICAgfSBlbHNlIGJvcnJvdyA9IDA7XHJcbiAgICAgICAgICAgIHJbaV0gPSBkaWZmZXJlbmNlO1xyXG4gICAgICAgIH1cclxuICAgICAgICBmb3IgKGkgPSBiX2w7IGkgPCBhX2w7IGkrKykge1xyXG4gICAgICAgICAgICBkaWZmZXJlbmNlID0gYVtpXSAtIGJvcnJvdztcclxuICAgICAgICAgICAgaWYgKGRpZmZlcmVuY2UgPCAwKSBkaWZmZXJlbmNlICs9IGJhc2U7XHJcbiAgICAgICAgICAgIGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgcltpKytdID0gZG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xlbmd0aCxcclxuICAgICAgICAgICAgciA9IG5ldyBBcnJheShsKSxcclxuICAgICAgICAgICAgY2FycnkgPSAtYixcclxuICAgICAgICAgICAgYmFzZSA9IEJBU0UsXHJcbiAgICAgICAgICAgIGksIGRpZmZlcmVuY2U7XHJcbiAgICAgICAgZm9yIChpID0gMDsgaSA8IGw7IGkrKykge1xyXG4gICAgICAgICAgICBkaWZmZXJlbmNlID0gYVtpXSArIGNhcnJ5O1xyXG4gICAgICAgICAgICBjYXJyeSA9IE1hdGguZmxvb3IoZGlmZmVyZW5jZSAvIGJhc2UpO1xyXG4gICAgICAgICAgICBkaWZmZXJlbmNlICU9IGJhc2U7XHJcbiAgICAgICAgICAgIHJbaV0gPSBkaWZmZXJlbmNlIDwgMCA/IGRpZmZlcmVuY2UgKyBiYXNlIDogZGlmZmVyZW5jZTtcclxuICAgICAgICB9XHJcbiAgICAgICAgciA9IGFycmF5VG9TbWFsbChyKTtcclxuICAgICAgICBpZiAodHlwZW9mIHIgPT09IFwibnVtYmVyXCIpIHtcclxuICAgICAgICAgICAgaWYgKHNpZ24pIHIgPSAtcjtcclxuICAgICAgICAgICAgcmV0dXJuIG5ldyBTbWFsbEludGVnZXIocik7XHJcbiAgICAgICAgfSByZXR1cm4gbmV3IEJpZ0ludGVnZXIociwgc2lnbik7XHJcbiAgICB9XHJcblxyXG4gICAgQmlnSW50ZWdlci5wcm90b3R5cGUuc3VidHJhY3QgPSBmdW5jdGlvbiAodikge1xyXG4gICAgICAgIHZhciBuID0gcGFyc2VWYWx1ZSh2KTtcclxuICAgICAgICBpZiAodGhpcy5zaWduICE9PSBuLnNpZ24pIHtcclxuICAgICAgICAgICAgcmV0dXJuIHRoaXMuYWRkKG4ubmVnYXRlKCkpO1xyXG4gICAgICAgIH1cclxuICAgICAgICB2YXIgYSA9IHRoaXMudmFsdWUsIGIgPSBuLnZhbHVlO1xyXG4gICAgICAgIGlmIChuLmlzU21hbGwpXHJcbiAgICAgICAgICAgIHJldHVybiB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1cclxuXHJcblxyXG4gICAgZnVuY3Rpb24gbXVsdGlwbHlMb25nKGEsIGIpIHtcclxuICAgICAgICB2YXIgYV9sID0gYS5sZW5ndGgsXHJcbiAgICAgICAgICAgIGJfbCA9IGIubGVuZ3RoLFxyXG4gICAgICAgICAgICBsID0gYV9sICsgYl9sLFxyXG4gICAgICAgICAgICByID0gY3JlYXRlQXJyYXkobCksXHJcbiAgICAgICAgICAgIGJhc2UgPSBCQVNFLFxyXG4gICAgICAgICAgICBwcm9kdWN0LCBjYXJyeSwgaSwgYV9pLCBiX2o7XHJcbiAgICAgICAgZm9yIChpID0gMDsgaSA8IGFfbDsgKytpKSB7XHJcbiAgICAgICAgICAgIGFfaSA9IGFbaV07XHJcbiAgICAgICAgICAgIGZvciAodmFyIGogPSAwOyBqIDwgYl9sOyArK2opIHtcclxuICAgICAgICAgICAgICAgIGJfaiA9IGJbal07XHJcbiAgICAgICAgICAgICAgICBwcm9kdWN0ID0gYV9pICogYl9qICsgcltpICsgal07XHJcbiAgICAgICAgICAgICAgICBjYXJyeSA9IE1hdGguZmxvb3IocHJvZHVjdCAvIGJhc2UpO1xyXG4gICAgICAgICAgICAgICAgcltpICsgal0gPSBwcm9kdWN0IC0gY2FycnkgKiBiYXNlO1xyXG4gICAgICAgICAgICAgICAgcltpICsgaiArIDFdICs9IGNhcnJ5O1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgfVxyXG4gICAgICAgIHRyaW0ocik7XHJcbiAgICAgICAgcmV0dXJuIHI7XHJcbiAgICB9XHJcblxyXG4gICAgZnVuY3Rpb24gbXVsdGlwbHlTbWFsbChhLCBiKSB7IC8vIGFzc3VtZXMgYSBpcyBhcnJheSwgYiBpcyBudW1iZXIgd2l0aCB8YnwgPCBCQVNFXHJcbiAgICAgICAgdmFyIGwgPSBhLmxlbmd0aCxcclxuICAgICAgICAgICAgciA9IG5ldyBBcnJheShsKSxcclxuICAgICAgICAgICAgYmFzZSA9IEJBU0UsXHJcbiAgICAgICAgICAgIGNhcnJ5ID0gMCxcclxuICAgICAgICAgICAgcHJvZHVjdCwgaTtcclxuICAgICAgICBmb3IgKGkgPSAwOyBpIDwgbDsgaSsrKSB7XHJcbiAgICAgICAgICAgIHByb2R1Y3QgPSBhW2ldICogYiArIGNhcnJ5O1xyXG4gICAgICAgICAgICBjYXJyeSA9IE1hdGguZmxvb3IocHJvZHVjdCAvIGJhc2UpO1xyXG4gICAgICAgICAgICByW2ldID0gcHJvZHVjdCAtIGNhcnJ5ICogYmFzZTtcclxuICAgICAgICB9XHJcbiAgICAgICAgd2hpbGUgKGNhcnJ5ID4gMCkge1xyXG4gICAgICAgICAgICByW2krK10gPSBjYXJyeSAlIGJhc2U7XHJcbiAgICAgICAgICAgIGNhcnJ5ID0gTWF0aC5mbG9vcihjYXJyeSAvIGJhc2UpO1xyXG4gICAgICAgIH1cclxuICAgICAgICByZXR1cm4gcjtcclxuICAgIH1cclxuXHJcbiAgICBmdW5jdGlvbiBzaGlmdExlZnQoeCwgbikge1xyXG4gICAgICAgIHZhciByID0gW107XHJcbiAgICAgICAgd2hpbGUgKG4tLSA+IDApIHIucHVzaCgwKTtcclxuICAgICAgICByZXR1cm4gci5jb25jYXQoeCk7XHJcbiAgICB9XHJcblxyXG4gICAgZnVuY3Rpb24gbXVsdGlwbHlLYXJhdHN1YmEoeCwgeSkge1xyXG4gICAgICAgIHZhciBuID0gTWF0aC5tYXgoeC5sZW5ndGgsIHkubGVuZ3RoKTtcclxuXHJcbiAgICAgICAgaWYgKG4gPD0gMzApIHJldHVybiBtdWx0aXBseUxvbmcoeCwgeSk7XHJcbiAgICAgICAgbiA9IE1hdGguY2VpbChuIC8gMik7XHJcblxyXG4gICAgICAgIHZhciBiID0geC5zbGljZShuKSxcclxuICAgICAgICAgICAgYSA9IHguc2xpY2UoMCwgbiksXHJcbiAgICAgICAgICAgIGQgPSB5LnNsaWNlKG4pLFxyXG4gICAgICAgICAgICBjID0geS5zbGljZSgwLCBuKTtcclxuXHJcbi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iA9IHRoaXMuc2lnbiAhPT0gbi5zaWduLFxyXG4gICAgICAgICAgICBhYnM7XHJcbiAgICAgICAgaWYgKG4uaXNTbWFsbCkge1xyXG4gICAgICAgICAgICBpZiAoYiA9PT0gMCkgcmV0dXJuIEludGVnZXJbMF07XHJcbiAgICAgICAgICAgIGlmIChiID09PSAxKSByZXR1cm4gdGhpcztcclxuICAgICAgICAgICAgaWYgKGIgPT09IC0xKSByZXR1cm4gdGhpcy5uZWdhdGUoKTtcclxuICAgICAgICAgICAgYWJzID0gTWF0aC5hYnMoYik7XHJcbiAgICAgICAgICAgIGlmIChhYnMgPCBCQVNFKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gbmV3IEJpZ0ludGVnZXIobXVsdGlwbHlTbWFsbChhLCBhYnMpLCBzaWduKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBiID0gc21hbGxUb0FycmF5KGFicyk7XHJcbiAgICAgICAgfVxyXG4gICAgICAgIGlmICh1c2VLYXJhdHN1YmEoYS5sZW5ndGgsIGIubGVuZ3RoKSkgLy8gS2FyYXRzdWJhIGlzIG9ubHkgZmFzdGVyIGZvciBjZXJ0YWluIGFycmF5IHNpemVzXHJcbiAgICAgICAgICAgIHJldHVybiBuZXcgQmlnSW50ZWdlcihtdWx0aXBseUthcmF0c3ViYShhLCBiKSwgc2lnbik7XHJcbiAgICAgICAgcmV0dXJuIG5ldyBCaWdJbnRlZ2VyKG11bHRpcGx5TG9uZyhhLCBiKSwgc2lnbik7XHJcbiAgICB9O1xyXG5cclxuICAgIEJpZ0ludGVnZXIucHJvdG90eXBlLnRpbWVzID0gQmlnSW50ZWdlci5wcm90b3R5cGUubXVsdGlwbHk7XHJcblxyXG4gICAgZnVuY3Rpb24gbXVsdGlwbHlTbWFsbEFuZEFycmF5KGEsIGIsIHNpZ24pIHsgLy8gYSA+PSAwXHJcbiAgICAgICAgaWYgKGEgPCBCQVNFKSB7XHJcbiAgICAgICAgICAgIHJldHVybiBu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R1cm4gcGFyc2VWYWx1ZSh2KS5fbXVsdGlwbHlCeVNtYWxsKHRoaXMpO1xyXG4gICAgfTtcclxuICAgIFNtYWxsSW50ZWdlci5wcm90b3R5cGUudGltZXMgPSBTbWFsbEludGVnZXIucHJvdG90eXBlLm11bHRpcGx5O1xyXG5cclxuICAgIE5hdGl2ZUJpZ0ludC5wcm90b3R5cGUubXVsdGlwbHkgPSBmdW5jdGlvbiAodikge1xyXG4gICAgICAgIHJldHVybiBuZXcgTmF0aXZlQmlnSW50KHRoaXMudmFsdWUgKiBwYXJzZVZhbHVlKHYpLnZhbHVlKTtcclxuICAgIH1cclxuICAgIE5hdGl2ZUJpZ0ludC5wcm90b3R5cGUudGltZXMgPSBOYXRpdmVCaWdJbnQucHJvdG90eXBlLm11bHRpcGx5O1xyXG5cclxuICAgIGZ1bmN0aW9uIHNxdWFyZShhKSB7XHJcbiAgICAgICAgLy9jb25zb2xlLmFzc2VydCgyICogQkFTRSAqIEJBU0UgPCBNQVhfSU5UKTtcclxuICAgICAgICB2YXIgbCA9IGEubGVuZ3RoLFxyXG4gICAgICAgICAgICByID0gY3JlYXRlQXJyYXkobCArIGwpLFxyXG4gICAgICAgICAgICBiYXNlID0gQkFTRSxcclxuICAgICAgICAgICAgcHJvZHVjdCwgY2FycnksIGksIGFfaSwgYV9qO1xyXG4gICAgICAgIGZvciAoaSA9IDA7IGkgPCBsOyBpKyspIHtcclxuICAgICAgICAgICAgYV9pID0gYVtpXTtcclxuICAgICAgICAgICAgY2FycnkgPSAwIC0gYV9pICogYV9pO1xyXG4gICAgICAgICAgICBmb3IgKHZhciBqID0gaTsgaiA8IGw7IGorKykge1xyXG4gICAgICAgICAgICAgICAgYV9qID0gYVtqXTtcclxuICAgICAgICAgICAgICAgIHByb2R1Y3QgPSAyICogKGFfaSAqIGFfaikgKyByW2kgKyBqXSArIGNhcnJ5O1xyXG4gICAgICAgICAgICAgICAgY2FycnkgPSBNYXRoLmZsb29yKHByb2R1Y3QgLyBiY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iAgICAgICAgdmFyIGFfbCA9IGEubGVuZ3RoLFxyXG4gICAgICAgICAgICBiX2wgPSBiLmxlbmd0aCxcclxuICAgICAgICAgICAgYmFzZSA9IEJBU0UsXHJcbiAgICAgICAgICAgIHJlc3VsdCA9IGNyZWF0ZUFycmF5KGIubGVuZ3RoKSxcclxuICAgICAgICAgICAgZGl2aXNvck1vc3RTaWduaWZpY2FudERpZ2l0ID0gYltiX2wgLSAxXSxcclxuICAgICAgICAgICAgLy8gbm9ybWFsaXphdGlvblxyXG4gICAgICAgICAgICBsYW1iZGEgPSBNYXRoLmNlaWwoYmFzZSAvICgyICogZGl2aXNvck1vc3RTaWduaWZpY2FudERpZ2l0KSksXHJcbiAgICAgICAgICAgIHJlbWFpbmRlciA9IG11bHRpcGx5U21hbGwoYSwgbGFtYmRhKSxcclxuICAgICAgICAgICAgZGl2aXNvciA9IG11bHRpcGx5U21hbGwoYiwgbGFtYmRhKSxcclxuICAgICAgICAgICAgcXVvdGllbnREaWdpdCwgc2hpZnQsIGNhcnJ5LCBib3Jyb3csIGksIGwsIHE7XHJcbiAgICAgICAgaWYgKHJlbWFpbmRlci5sZW5ndGggPD0gYV9sKSByZW1haW5kZXIucHVzaCgwKTtcclxuICAgICAgICBkaXZpc29yLnB1c2goMCk7XHJcbiAgICAgICAgZGl2aXNvck1vc3RTaWduaWZpY2FudERpZ2l0ID0gZGl2aXNvcltiX2wgLSAxXTtcclxuICAgICAgICBmb3IgKHNoaWZ0ID0gYV9sIC0gYl9sOyBzaGlmdCA+PSAwOyBzaGlmdC0tKSB7XHJcbiAgICAgICAgICAgIHF1b3RpZW50RGlnaXQgPSBiYXNlIC0gMTtcclxuICAgICAgICAgICAgaWYgKHJlbWFpbmRlcltzaGlmdCArIGJfbF0gIT09IGRpdmlzb3JNb3N0U2lnbmlmaWNhbnREaWdpdCkge1xyXG4gICAgICAgICAgICAgICAgcXVvdGllbnREaWdpdCA9IE1hdGguZmxvb3IoKHJlbWFpbmRlcltzaGlmdCArIGJfbF0gKiBiYXNlICsgcmVtYWluZGVyW3NoaWZ0ICsgYl9sIC0gMV0pIC8gZGl2aXNvck1vc3RTaWduaWZpY2FudERpZ2l0KTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAvLyBxdW90aWVudERpZ2l0IDw9IGJhc2UgLSAxXHJcbiAgICAgICAgICAgIGNhcnJ5ID0gMDtcclxuICAgICAgICAgICAgYm9ycm93ID0gMDtcclxuICAgICAgICAgICAgbCA9IGRpdmlzb3IubGVuZ3RoO1xyXG4gICAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgbDsgaSsrKSB7XHJcbiAgICAgICAgICAgICAgICBjYXJyeSArPSBxdW90aWVudERpZ2l0ICogZGl2aXNvcltpXTtcclxuICAgICAgICAgICAgICAgIHEgPSBNYXRoLmZsb29yKGNhcnJ5IC8gYmFzZSk7XHJcbiAgICAgICAgICAgICAgICBib3Jyb3cgKz0gcmVtYWluZGVyW3NoaWZ0ICsgaV0gLSAoY2FycnkgLSBxICogYmFzZSk7XHJcbiAgICAgICAgICAgICAgICBjYXJyeSA9IHE7XHJcbiAgICAgICAgICAgICAgICBpZiAoYm9ycm93IDwgMCkge1xyXG4gICAgICAgICAgICAgICAgICAgIHJlbWFpbmRlcltzaGlmdCArIGldID0gYm9ycm93ICsgYmFzZTtcclxuICAgICAgICAgICAgICAgICAgICBib3Jyb3cgPSAtMTtcclxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgcmVtYWluZGVyW3NoaWZ0ICsgaV0gPSBib3Jyb3c7XHJcbiAgICAgICAgICAgICAgICAgICAgYm9ycm93ID0gMDtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB3aGlsZSAoYm9ycm93ICE9PSAwKSB7XHJcbiAgICAgICAgICAgICAgICBxdW90aWVudERpZ2l0IC09IDE7XHJcbiAgICAgICAgICAgICAgICBjYXJyeSA9IDA7XHJcbiAgICAgICAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgbDsgaSsrKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgY2FycnkgKz0gcmVtYWluZGVyW3NoaWZ0ICsgaV0gLSBiYXNlICsgZGl2aXNvcltpXTtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoY2FycnkgPCAwKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlbWFpbmRlcltzaGlmdCArIGldID0gY2FycnkgKyBiYXNlO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBjYXJyeSA9IDA7XHJcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmVtYWluZGVyW3NoaWZ0ICsgaV0gPSBjYXJyeTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgY2FycnkgPSAxO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIGJvcnJvdyArPSBjYXJyeTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICByZXN1bHRbc2hpZnRdID0gcXVvdGllbnREaWdpdDtcclxuICAgICAgICB9XHJcbiAgICAgICAgLy8gZGVub3JtYWxpemF0aW9uXHJcbiAgICAgICAgcmVtYWluZGVyID0gZGl2TW9kU21hbGwocmVtYWluZGVyLCBsYW1iZGEpWzBdO1xyXG4gICAgICAgIHJldHVybiBbYXJyYXlUb1NtYWxsKHJlc3VsdCksIGFycmF5VG9TbWFsbChyZW1haW5kZXIpXTtcclxuICAgIH1cclxuXHJcbiAgICBmdW5jdGlvbiBkaXZNb2QyKGEsIGIpIHsgLy8gSW1wbGVtZW50YXRpb24gaWRlYSBzaGFtZWxlc3NseSBzdG9sZW4gZnJvbSBTaWxlbnQgTWF0dCdzIGxpYnJhcnkgaHR0cDovL3NpbGVudG1hdHQuY29tL2JpZ2ludGVnZXIvXHJcbiAgICAgICAgLy8gUGVyZm9ybXMgZmFzdGVyIHRoYW4gZGl2TW9kMSBvbiBsYXJnZXIgaW5wdXQgc2l6ZXMuXHJcbiAgICAgICAgdmFyIGFfbCA9IGEubGVuZ3RoLFxyXG4gICAgICAgICAgICBiX2wgPSBiLmxlbmd0aCxcclxuICAgICAgICAgICAgcmVzdWx0ID0gW10sXHJcbiAgICAgICAgICAgIHBhcnQgPSBbXSxcclxuICAgICAgICAgICAgYmFzZSA9IEJBU0UsXHJcbiAgICAgICAgICAgIGd1ZXNzLCB4bGVuLCBoaWdoeCwgaGlnaHksIGNoZWNrO1xyXG4gICAgICAgIHdoaWxlIChhX2wpIHtcclxuICAgICAgICAgICAgcGFydC51bnNoaWZ0KGFbLS1hX2xdKTtcclxuICAgICAgICAgICAgdHJpbShwYXJ0KTtcclxuICAgICAgICAgICAgaWYgKGNvbXBhcmVBYnMocGFydCwgYikgPCAwKSB7XHJcbiAgICAgICAgICAgICAgICByZXN1bHQucHVzaCgwKTtcclxuICAgICAgICAgICAgICAgIGNvbnRpbnVlO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHhsZW4gPSBwYXJ0Lmxlbmd0aDtcclxuICAgICAgICAgICAgaGlnaHggPSBwYXJ0W3hsZW4gLSAxXSAqIGJhc2UgKyBwYXJ0W3hsZW4gLSAyXTtcclxuICAgICAgICAgICAgaGlnaHkgPSBiW2JfbCAtIDFdICogYmFzZSArIGJbYl9sIC0gMl07XHJcbiAgICAgICAgICAgIGlmICh4bGVuID4gYl9sKSB7XHJcbiAgICAgICAgICAgICAgICBoaWdoeCA9IChoaWdoeCArIDEpICogYmFzZTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBndWVzcyA9IE1hdGguY2VpbChoaWdoeCAvIGhpZ2h5KTtcclxuICAgICAgICAgICAgZG8ge1xyXG4gICAgICAgICAgICAgICAgY2hlY2sgPSBtdWx0aXBseVNtYWxsKGIsIGd1ZXNzKTtcclxuICAgICAgICAgICAgICAgIGlmIChjb21wYX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gICAgICAgICAgcXVvdGllbnQgPSBhcnJheVRvU21hbGwodmFsdWVbMF0pO1xyXG4gICAgICAgICAgICAgICAgdmFyIHJlbWFpbmRlciA9IHZhbHVlWzFdO1xyXG4gICAgICAgICAgICAgICAgaWYgKHNlbGYuc2lnbikgcmVtYWluZGVyID0gLXJlbWFpbmRlcjtcclxuICAgICAgICAgICAgICAgIGlmICh0eXBlb2YgcXVvdGllbnQgPT09IFwibnVtYmVyXCIpIHtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoc2VsZi5zaWduICE9PSBuLnNpZ24pIHF1b3RpZW50ID0gLXF1b3RpZW50O1xyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBbbmV3IFNtYWxsSW50ZWdlcihxdW90aWVudCksIG5ldyBTbWFsbEludGVnZXIocmVtYWluZGVyKV07XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gW25ldyBCaWdJbnRlZ2VyKHF1b3RpZW50LCBzZWxmLnNpZ24gIT09IG4uc2lnbiksIG5ldyBTbWFsbEludGVnZXIocmVtYWluZGVyKV07XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgYiA9IHNtYWxsVG9BcnJheShhYnMpO1xyXG4gICAgICAgIH1cclxuICAgICAgICB2YXIgY29tcGFyaXNvbiA9IGNvbXBhcmVBYnMoYSwgYik7XHJcbiAgICAgICAgaWYgKGNvbXBhcmlzb24gPT09IC0xKSByZXR1cm4gW0ludGVnZXJbMF0sIHNlbGZdO1xyXG4gICAgICAgIGlmIChjb21wYXJpc29uID09PSAwKSByZXR1cm4gW0ludGVnZXJbc2VsZi5zaWduID09PSBuLnNpZ24gPyAxIDogLTFdLCBJbnRlZ2VyWzBdXTtcclxuXHJcbiAgICAgICAgLy8gZGl2TW9kMSBpcyBmYXN0ZXIgb24gc21hbGxlciBpbnB1dCBzaXplc1xyXG4gICAgICAgIGlmIChhLmxlbmd0aCArIGIubGVuZ3RoIDw9IDIwMClccl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RlciA9IFNtYWxsSW50ZWdlci5wcm90b3R5cGUubW9kID0gQmlnSW50ZWdlci5wcm90b3R5cGUucmVtYWluZGVyID0gQmlnSW50ZWdlci5wcm90b3R5cGUubW9kO1xyXG5cclxuICAgIEJpZ0ludGVnZXIucHJvdG90eXBlLnBvdyA9IGZ1bmN0aW9uICh2KSB7XHJcbiAgICAgICAgdmFyIG4gPSBwYXJzZVZhbHVlKHYpLFxyXG4gICAgICAgICAgICBhID0gdGhpcy52YWx1ZSxcclxuICAgICAgICAgICAgYiA9IG4udmFsdWUsXHJcbiAgICAgICAgICAgIHZhbHVlLCB4LCB5O1xyXG4gICAgICAgIGlmIChiID09PSAwKSByZXR1cm4gSW50ZWdlclsxXTtcclxuICAgICAgICBpZiAoYSA9PT0gMCkgcmV0dXJuIEludGVnZXJbMF07XHJcbiAgICAgICAgaWYgKGEgPT09IDEpIHJldHVybiBJbnRlZ2VyWzFdO1xyXG4gICAgICAgIGlmIChhID09PSAtMSkgcmV0dXJuIG4uaXNFdmVuKCkgPyBJbnRlZ2VyWzFdIDogSW50ZWdlclstMV07XHJcbiAgICAgICAgaWYgKG4uc2lnbikge1xyXG4gICAgICAgICAgICByZXR1cm4gSW50ZWdlclswXTtcclxuICAgICAgICB9XHJcbiAgICAgICAgaWYgKCFuLmlzU21hbGwpIHRocm93IG5ldyBFcnJvcihcIlRoZSBleHBvbmVudCBcIiArIG4udG9TdHJpbmcoKSArIFwiIGlzIHRvbyBsYXJnZS5cIik7XHJcbiAgICAgICAgaWYgKHRoaXMuaXNTbWFsbCkge1xyXG4gICAgICAgICAgICBpZiAoaXNQcmVjaXNlKHZhbHVlID0gTWF0aC5wb3coYSwgYikpKVxyXG4gICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBTbWFsbEludGVnZXIodHJ1bmNhdGUodmFsdWUpKTtcclxuICAgICAgICB9XHJcbiAgICAgICAgeCA9IHRoaXM7XHJcbiAgICAgICAgeSA9IEludGVnZXJbMV07XHJcbiAgICAgICAgd2hpbGUgKHRydWUpIHtcclxuICAgICAgICAgICAgaWYgKGIgJiAxID09PSAxKSB7XHJcbiAgICAgICAgICAgICAgICB5ID0geS50aW1lcyh4KTtcclxuICAgICAgICAgICAgICAgIC0tYjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBpZiAoYiA9PT0gMCkgYnJlYWs7XHJcbiAgICAgICAgICAgIGIgLz0gMjtcclxuICAgICAgICAgICAgeCA9IHguc3F1YXJlKCk7XHJcbiAgICAgICAgfVxyXG4gICAgICAgIHJldHVybiB5O1xyXG4gICAgfTtcclxuICAgIFNtYWxsSW50ZWdlci5wcm90b3R5cGUucG93ID0gQmlnSW50ZWdlci5wcm90b3R5cGUucG93O1xyXG5cclxuICAgIE5hdGl2ZUJpZ0ludC5wcm90b3R5cGUucG93ID0gZnVuY3Rpb24gKHYpIHtcclxuICAgICAgICB2YXIgbiA9IHBhcnNlVmFsdWUodik7XHJcbiAgICAgICAgdmFyIGEgPSB0aGlzLnZhbHVlLCBiID0gbi52YWx1ZTtcclxuICAgICAgICB2YXIgXzAgPSBCaWdJbnQoMCksIF8xID0gQmlnSW50KDEpLCBfMiA9IEJpZ0ludCgyKTtcclxuICAgICAgICBpZiAoYiA9PT0gXzApIHJldHVybiBJbnRlZ2VyWzFdO1xyXG4gICAgICAgIGlmIChhID09PSBfMCkgcmV0dXJuIEludGVnZXJbMF07XHJcbiAgICAgICAgaWYgKGEgPT09IF8xKSByZXR1cm4gSW50ZWdlclsxXTtcclxuICAgICAgICBpZiAoYSA9PT0gQmlnSW50KC0xKSkgcmV0dXJuIG4uaXNFdmVuKCkgPyBJbnRlZ2VyWzFdIDogSW50ZWdlclstMV07XHJcbiAgICAgICAgaWYgKG4uaXNOZWdhdGl2ZSgpKSByZXR1cm4gbmV3IE5hdGl2ZUJpZ0ludChfMCk7XHJcbiAgICAgICAgdmFyIHggPSB0aGlzO1xyXG4gICAgICAgIHZhciB5ID0gSW50ZWdlclsxXTtcclxuICAgICAgICB3aGlsZSAodHJ1ZSkge1xyXG4gICAgICAgICAgICBpZiAoKGIgJiBfMSkgPT09IF8xKSB7XHJcbiAgICAgICAgICAgICAgICB5ID0geS50aW1lcyh4KTtcclxuICAgICAgICAgICAgICAgIC0tYjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBpZiAoYiA9PT0gXzApIGJyZWFrO1xyXG4gICAgICAgICAgICBiIC89IF8yO1xyXG4gICAgICAgICAgICB4ID0geC5zcXVhcmUoKTtcclxuICAgICAgICB9XHJcbiAgICAgICAgcmV0dXJuIHk7XHJcbiAgICB9XHJcblxyXG4gICAgQmlnSW50ZWdlci5wcm90b3R5cGUubW9kUG93ID0gZnVuY3Rpb24gKGV4cCwgbW9kKSB7XHJcbiAgICAgICAgZXhwID0gcGFyc2VWYWx1ZShleHApO1xyXG4gICAgICAgIG1vZCA9IHBhcnNlVmFsdWUobW9kKTtcclxuICAgICAgICBpZiAobW9kLmlzWmVybygpKSB0aHJvdyBuZXcgRXJyb3IoXCJDYW5ub3QgdGFrZSBtb2RQb3cgd2l0aCBtb2R1bHVzIDBcIik7XHJcbiAgICAgICAgdmFyIHIgPSBJbnRlZ2VyWzFdLFxyXG4gICAgICAgICAgICBiYXNlID0gdGhpcy5tb2QobW9kKTtcclxuICAgICAgICBpZiAoZXhwLmlzTmVnYXRpdmUoKSkge1xyXG4gICAgICAgICAgICBleHAgPSBleHAubXVsdGlwbHkoSW50ZWdlclstMV0pO1xyXG4gICAgICAgICAgICBiYXNlID0gYmFzZS5tb2RJbnYobW9kKTtcclxuICAgICAgICB9XHJcbiAgICAgICAgd2hpbGUgKGV4cC5pc1Bvc2l0aXZlKCkpIHtcclxuICAgICAgICAgICAgaWYgKGJhc2UuaXNaZXJvKCkpIHJldHVybiBJbnRlZ2VyWzBdO1xyXG4gICAgICAgICAgICBpZiAoZXhwLmlzT2RkKCkpIHIgPSByLm11bHRpcGx5KGJhc2UpLm1vZChtb2QpO1xyXG4gICAgICAgICAgICBleHAgPSBleHAuZGl2aWRlKDIpO1xyXG4gICAgICAgICAgICBiYXNlID0gYmFzZS5zcXVhcmUoKS5tb2QobW9kKTtcclxuICAgICAgICB9XHJcbiAgICAgICAgcmV0dXJuIHI7XHJcbiAgICB9O1xyXG4gICAgTmF0aXZlQmlnSW50LnByb3RvdHlwZS5tb2RQb3cgPSBTbWFsbEludGVnZXIucHJvdG90eXBlLm1vZFBvdyA9IEJpZ0ludGVnZXIucHJvdG90eXBlLm1vZFBvdztcclxuXHJcbiAgICBmdW5jdGlvbiBjb21wYXJlQWJzKGEsIGIpIHtcclxuICAgICAgICBpZiAoYS5sZW5ndGggIT09IGIubGVuZ3RoKSB7XHJcbiAgICAgICAgICAgIHJldHVybiBhLmxlbmd0aCA+IGIubGVuZ3RoID8gMSA6IC0xO1xyXG4gICAgICAgIH1cclxuICAgICAgICBmb3IgKHZhciBpID0gYS5sZW5ndGggLSAxOyBpID49IDA7IGktLSkge1xyXG4gICAgICAgICAgICBpZiAoYVtpXSAhPT0gYltpXSkgcmV0dXJuIGFbaV0gPiBiW2ldID8gMSA6IC0xO1xyXG4gICAgICAgIH1cclxuICAgICAgICByZXR1cm4gMDtcclxuICAgIH1cclxuXHJcbiAgICBCaWdJbnRlZ2VyLnByb3RvdHlwZS5jb21wYXJlQWJzID0gZnVuY3Rpb24gKHYpIHtcclxuICAgICAgICB2YXIgbiA9IHBhcnNlVmFsdWUodiksXHJcbiAgICAgICAgICAgIGEgPSB0aGlzLnZhbHVlLFxyXG4gICAgICAgICAgICBiID0gbi52YWx1ZTtcclxuICAgICAgICBpZiAobi5pc1NtYWxsKSByZXR1cm4gMTtcclxuICAgICAgICByZXR1cm4gY29tcGFyZUFicyhhLCBiKTtcclxuICAgIH07XHJcbiAgICBTbWFsbEludGVnZXIucHJvdG90eXBlLmNvbXBhcmVBYnMgPSBmdW5jdGlvbiAodikge1xyXG4gICAgICAgIHZhciBuID0gcGFyc2VWYWx1ZSh2KSxcclxuICAgICAgICAgICAgYSA9IE1hdGguYWJzKHRoaXMudmFsdWUpLFxyXG4gICAgICAgICAgICBiID0gbi52YWx1ZTtcclxuICAgICAgICBpZiAobi5pc1NtYWxsKSB7XHJcbiAgICAgICAgICAgIGIgPSBNYXRoLmFicyhiKTtcclxuICAgICAgICAgICAgcmV0dXJuIGEgPT09IGIgPyAwIDogYSA+IGIgPyAxIDogLTE7XHJcbiAgICAgICAgfVxyXG4gICAgICAgIHJldHVybiAtMTtcclxuICAgIH07XHJcbiAgICBOYXRpdmVCaWdJbnQucHJvdG90eXBlLmNvbXBhcmVBYnMgPSBmdW5jdGlvbiAodikge1xyXG4gICAgICAgIHZhciBhID0gdGhpcy52YWx1ZTtcclxuICAgICAgICB2YXIgYiA9IHBhcnNlVmFsdWUodikudmFsdWU7XHJcbiAgICAgICAgYSA9IGEgPj0gMCA/IGEgOiAtYTtcclxuICAgICAgICBiID0gYiA+PSAwID8gYiA6IC1iO1xyXG4gICAgICAgIHJldHVybiBhID09PSBiID8gMCA6IGEgPiBiID8gMSA6IC0xO1xyXG4gICAgfVxyXG5cclxuICAgIEJpZ0ludGVnZXIucHJvdG90eXBlLmNvbXBhcmUgPSBmdW5jdGlvbiAodikge1xyXG4gICAgICAgIC8vIFNlZSBkaXNjdXNzaW9uIGFib3V0IGNvbXBhcmlzb24gd2l0aCBJbmZpbml0eTpcclxuICAgICAgICAvLyBodHRwczovL2dpdGh1Yi5jb20vcGV0ZXJvbHNvbi9CaWdJbnRlZ2VyLmpzL2lzc3Vlcy82MVxyXG4gICAgICAgIGlmICh2ID09PSBJbmZpbml0eSkge1xyXG4gICAgICAgICAgICByZXR1cm4gLTE7XHJcbiAgICAgICAgfVxyXG4gICAgICAgIGlmICh2ID09PSAtSW5maW5pdHkpIHtcclxuICAgICAgICAgICAgcmV0dXJuIDE7XHJcbiAgICAgICAgfVxyXG5cclxuICAgICAgICB2YXIgbiA9IHBhcnNlVmFsdWUodiksXHJcbiAgICAgICAgICAgIGEgPSB0aGlzLnZhbHVlLFxyXG4gICAgICAgICAgICBiID0gbi52YWx1ZTtcclxuICAgICAgICBpZiAodGhpcy5zaWduICE9PSBuLnNpZ24pIHtcclxuICAgICAgICAgICAgcmV0dXJuIG4uc2lnbiA/IDEgOiAtMTtcclxuICAgICAgICB9XHJcbiAgICAgICAgaWYgKG4uaXNTbWFsbCkge1xyXG4gICAgICAgICAgICByZXR1cm4gdGhpcy5zaWduID8gLTEgOiAxO1xyXG4gICAgICAgIH1cclxuICAgICAgICByZXR1cm4gY29tcGFyZUFicyhhLCBiKSAqICh0aGlzLnNpZ24gPyAtMSA6IDEpO1xyXG4gICAgfTtcclxuICAgIEJpZ0ludGVnZXIucHJvdG90eXBlLmNvbXBhcmVUbyA9IEJpZ0ludGVnZXIucHJvdG90eXBlLmNvbXBhcmU7XHJcblxyXG4gICAgU21hbGxJbnRlZ2VyLnByb3RvdHlwZS5jb21wYXJlID0gZnVuY3Rpb24gKHYpIHtcclxuICAgICAgICBpZiAodiA9PT0gSW5maW5pdHkpIHtcclxuICAgICAgICAgICAgcmV0dXJuIC0xO1xyXG4gICAgICAgIH1cclxuICAgICAgICBpZiAodiA9PT0gLUluZmluaXR5KSB7XHJcbiAgICAgICAgICAgIHJldHVybiAxO1xyXG4gICAgICAgIH1cclxuXHJcbiAgICAgICAgdmFyIG4gPSBwYXJzZVZhbHVlKHYpLFxyXG4gICAgICAgICAgICBhID0gdGhpcy52YWx1ZSxcclxuICAgICAgICAgICAgYiA9IG4udmFsdWU7XHJcbiAgICAgICAgaWYgKG4uaXNTbWFsbCkge1xyXG4gICAgICAgICAgICByZXR1cm4gYSA9PSBiID8gMCA6IGEgPiBiID8gMSA6IC0xO1xyXG4gICAgICAgIH1cclxuICAgICAgICBpZiAoYSA8IDAgIT09IG4uc2lnbikge1xyXG4gICAgICAgICAgICByZXR1cm4gYSA8IDAgPyAtMSA6IDE7XHJcbiAgICAgICAgfVxyXG4gICAgICAgIHJldHVybiBhIDwgMCA/IDEgOiAtMTtcclxuICAgIH07XH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yUmFiaW5UZXN0KG4sIGEpIHtcclxuICAgICAgICB2YXIgblByZXYgPSBuLnByZXYoKSxcclxuICAgICAgICAgICAgYiA9IG5QcmV2LFxyXG4gICAgICAgICAgICByID0gMCxcclxuICAgICAgICAgICAgZCwgdCwgaSwgeDtcclxuICAgICAgICB3aGlsZSAoYi5pc0V2ZW4oKSkgYiA9IGIuZGl2aWRlKDIpLCByKys7XHJcbiAgICAgICAgbmV4dDogZm9yIChpID0gMDsgaSA8IGEubGVuZ3RoOyBpKyspIHtcclxuICAgICAgICAgICAgaWYgKG4ubGVzc2VyKGFbaV0pKSBjb250aW51ZTtcclxuICAgICAgICAgICAgeCA9IGJpZ0ludChhW2ldKS5tb2RQb3coYiwgbik7XHJcbiAgICAgICAgICAgIGlmICh4LmlzVW5pdCgpIHx8IHguZXF1YWxzKG5QcmV2KSkgY29udGludWU7XHJcbiAgICAgICAgICAgIGZvciAoZCA9IHIgLSAxOyBkICE9IDA7IGQtLSkge1xyXG4gICAgICAgICAgICAgICAgeCA9IHguc3F1YXJlKCkubW9kKG4pO1xyXG4gICAgICAgICAgICAgICAgaWYgKHguaXNVbml0KCkpIHJldHVybiBmYWxzZTtcclxuICAgICAgICAgICAgICAgIGlmICh4LmVxdWFscyhuUHJldikpIGNvbnRpbnVlIG5leHQ7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xyXG4gICAgICAgIH1cclxuICAgICAgICByZXR1cm4gdHJ1ZTtcclxuICAgIH1cclxuXHJcbiAgICAvLyBTZXQgXCJzdHJpY3RcIiB0byB0cnVlIHRvIGZvcmNlIEdSSC1zdXBwb3J0ZWQgbG93ZXIgYm91bmQgb2YgMipsb2coTileMlxyXG4gICAgQmlnSW50ZWdlci5wcm90b3R5cGUuaXNQcmltZSA9IGZ1bmN0aW9uIChzdHJpY3QpIHtcclxuICAgICAgICB2YXIgaXNQcmltZSA9IGlzQmFzaWNQcmltZSh0aGlzKTtcclxuICAgICAg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ICAgICAgICB2YXIgdCA9IGl0ZXJhdGlvbnMgPT09IHVuZGVmaW5lZCA/IDUgOiBpdGVyYXRpb25zO1xyXG4gICAgICAgIGZvciAodmFyIGEgPSBbXSwgaSA9IDA7IGkgPCB0OyBpKyspIHtcclxuICAgICAgICAgICAgYS5wdXNoKGJpZ0ludC5yYW5kQmV0d2VlbigyLCBuLm1pbnVzKDIpLCBybmcpKTtcclxuICAgICAgICB9XHJcbiAgICAgICAgcmV0dXJuIG1pbGxlclJhYmluVGVzdChuLCBhKTtcclxuICAgIH07XHJcbiAgICBOYXRpdmVCaWdJbnQucHJvdG90eXBlLmlzUHJvYmFibGVQcmltZSA9IFNtYWxsSW50ZWdlci5wcm90b3R5cGUuaXNQcm9iYWJsZVByaW1lID0gQmlnSW50ZWdlci5wcm90b3R5cGUuaXNQcm9iYWJsZVByaW1lO1xyXG5cclxuICAgIEJpZ0ludGVnZXIucHJvdG90eXBlLm1vZEludiA9IGZ1bmN0aW9uIChuKSB7XHJcbiAgICAgICAgdmFyIHQgPSBiaWdJbnQuemVybywgbmV3VCA9IGJpZ0ludC5vbmUsIHIgPSBwYXJzZVZhbHVlKG4pLCBuZXdSID0gdGhpcy5hYnMoKSwgcSwgbGFzdFQsIGxhc3RSO1xyXG4gICAgICAgIHdoaWxlICghbmV3Ui5pc1plcm8oKSkge1xyXG4gICAgICAgICAgICBxID0gci5kaXZpZGUobmV3Uik7XHJcbiAgICAgICAgICAgIGxhc3RUID0gdDtcclxuICAgICAgICAgICAgbGFzdFIgPSByO1xyXG4gICAgICAgICAgICB0ID0gbmV3VDtcclxuICAgICAgICAgICAgciA9IG5ld1I7XHJcbiAgICAgICAgICAgIG5ld1QgPSBsYXN0VC5zdWJ0cmFjdChxLm11bHRpcGx5KG5ld1QpKTtcclxuICAgICAgICAgICAgbmV3UiA9IGxhc3RSLnN1YnRyYWN0KHEubXVsdGlwbHkobmV3UikpO1xyXG4gICAgICAgIH1cclxuICAgICAgICBpZiAoIXIuaXNVbml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zdE9uZUJpdCAocm91Z2gpXHJcbiAgICAgICAgLy8gU21hbGxJbnRlZ2VyOiByZXR1cm4gTWluKGxvd2VzdE9uZUJpdChuKSwgMSA8PCAzMClcclxuICAgICAgICAvLyBCaWdJbnRlZ2VyOiByZXR1cm4gTWluKGxvd2VzdE9uZUJpdChuKSwgMSA8PCAxNCkgW0JBU0U9MWU3XVxyXG4gICAgICAgIHZhciB2ID0gbi52YWx1ZSxcclxuICAgICAgICAgICAgeCA9IHR5cGVvZiB2ID09PSBcIm51bWJlclwiID8gdiB8IExPQk1BU0tfSSA6XHJcbiAgICAgICAgICAgICAgICB0eXBlb2YgdiA9PT0gXCJiaWdpbnRcIiA/IHYgfCBCaWdJbnQoTE9CTUFTS19JKSA6XHJcbiAgICAgICAgICAgICAgICAgICAgdlswXSArIHZbMV0gKiBCQVNFIHwgTE9CTUFTS19CSTtcclxuICAgICAgICByZXR1cm4geCAmIC14O1xyXG4gICAgfVxyXG5cclxuICAgIGZ1bmN0aW9uIGludGVnZXJMb2dhcml0aG0odmFsdWUsIGJhc2UpIHtcclxuICAgICAgICBpZiAoYmFzZS5jb21wYXJlVG8odmFsdWUpIDw9IDApIHtcclxuICAgICAgICAgICAgdmFyIHRtcCA9IGludGVnZXJMb2dhcml0aG0odmFsdWUsIGJhc2Uuc3F1YXJlKGJhc2UpKTtcclxuICAgICAgICAgICAgdmFyIHAgPSB0bXAucDtcclxuICAgICAgICAgICAgdmFyIGUgPSB0bXAuZTtcclxuICAgICAgICAgICAgdmFyIHQgPSBwLm11bHRpcGx5KGJhc2UpO1xyXG4gICAgICAgICAgICByZXR1cm4gdC5jb21wYXJlVG8odmFsdWUpIDw9IDAgPyB7IHA6IHQsIGU6IGUgKiAyICsgMSB9IDogeyBwOiBwLCBlOiBlICogMiB9O1xyXG4gICAgICAgIH1cclxuICAgICAgICByZXR1cm4geyBwOiBiaWdJbnQoMSksIGU6IDAgfTtcclxuICAgIH1cclxuXHJcbiAgICBCaWdJbnRlZ2Vy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ICAgICBpZiAoYS5lcXVhbHMoYikpIHJldHVybiBhO1xyXG4gICAgICAgIGlmIChhLmlzWmVybygpKSByZXR1cm4gYjtcclxuICAgICAgICBpZiAoYi5pc1plcm8oKSkgcmV0dXJuIGE7XHJcbiAgICAgICAgdmFyIGMgPSBJbnRlZ2VyWzFdLCBkLCB0O1xyXG4gICAgICAgIHdoaWxlIChhLmlzRXZlbigpICYmIGIuaXNFdmVuKCkpIHtcclxuICAgICAgICAgICAgZCA9IG1pbihyb3VnaExPQihhKSwgcm91Z2hMT0IoYikpO1xyXG4gICAgICAgICAgICBhID0gYS5kaXZpZGUoZCk7XHJcbiAgICAgICAgICAgIGIgPSBiLmRpdmlkZShkKTtcclxuICAgICAgICAgICAgYyA9IGMubXVsdGlwbHkoZCk7XHJcbiAgICAgICAgfVxyXG4gICAgICAgIHdoaWxlIChhLmlzRXZlbigpKSB7XHJcbiAgICAgICAgICAgIGEgPSBhLmRpdmlkZShyb3VnaExPQihhKSk7XHJcbiAgICAgICAgfVxyXG4gICAgICAgIGRvIHtcclxuICAgICAgICAgICAgd2hpbGUgKGIuaXNFdmVuKCkpIHtcclxuICAgICAgICAgICAgICAgIGIgPSBiLmRpdmlkZShyb3VnaExPQihiKSk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKGEuZ3JlYXRlcihiKSkge1xyXG4gICAgICAgICAgICAgICAgdCA9IGI7IGIgPSBhOyBhID0gdDtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBiID0gYi5zdWJ0cmFjdChhKTtcclxuICAgICAgICB9IHdoaWxlICghYi5pc1plcm8oKSk7XHJcbiAgICAgICAgcmV0dXJuIGMuaXNVbml0KCkgPyBhIDogYS5tdWx0aXBseShjKTtcclxuICAgIH1cclxuICAgIGZ1bmN0aW9uIGxjbShhLCBiKSB7XHJcbiAgICAgICAgYSA9IHBhcnNlVmFsdWUoYSkuYWJzKCk7XHJcbiAgICAgICAgYiA9IHBhcnNlVmFsdW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CBub256ZXJvIG51bWJlcnMgdG8gYmFzZSAwLlwiKTtcclxuICAgICAgICB9XHJcbiAgICAgICAgaWYgKGJhc2UuZXF1YWxzKC0xKSkge1xyXG4gICAgICAgICAgICBpZiAobi5pc1plcm8oKSkgcmV0dXJuIHsgdmFsdWU6IFswXSwgaXNOZWdhdGl2ZTogZmFsc2UgfTtcclxuICAgICAgICAgICAgaWYgKG4uaXNOZWdhdGl2ZSgpKVxyXG4gICAgICAgICAgICAgICAgcmV0dXJuIHtcclxuICAgICAgICAgICAgICAgICAgICB2YWx1ZTogW10uY29uY2F0LmFwcGx5KFtdLCBBcnJheS5hcHBseShudWxsLCBBcnJheSgtbi50b0pTTnVtYmVyKCkpKVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAubWFwKEFycmF5LnByb3RvdHlwZS52YWx1ZU9mLCBbMSwgMF0pXHJcbiAgICAgICAgICAgICAgICAgICAgKSxcclxuICAgICAgICAgICAgICAgICAgICBpc05lZ2F0aXZlOiBmYWxzZVxyXG4gICAgICAgICAgICAgICAgfTtcclxuXHJcbiAgICAgICAgICAgIHZhciBhcnIgPSBBcnJheS5hcHBseShudWxsLCBBcnJheShuLnRvSlNOdW1iZXIoKSAtIDEpKVxyXG4gICAgICAgICAgICAgICAgLm1hcChBcnJheS5wcm90b3R5cGUudmFsdWVPZiwgWzAsIDFdKTtcclxuICAgICAgICAgICAgYXJyLnVuc2hpZnQoWzFdKTtcclxuICAgICAgICAgICAgcmV0dXJuIHtcclxuICAgICAgICAgICAgICAgIHZhbHVlOiBbXS5jb25jYXQuYXBwbHkoW10sIGFyciksXHJcbiAgICAgICAgICAgICAgICBpc05lZ2F0aXZlOiBmYWxzZVxyXG4gICAgICAgICAgICB9O1xyXG4gICAgICAgIH1cclxuXHJcbiAgICAgICAgdmFyIG5lZyA9IGZhbHNlO1xyXG4gICAgICAgIGlmIChuLmlzTmVnYXRpdmUoKSAmJiBiYXNlLmlzUG9zaXRpdmUoKSkge1xyXG4gICAgICAgICAgICBuZWcgPSB0cnVlO1xyXG4gICAgICAgICAgICBuID0gbi5hYnMoKTtcclxuICAgICAgICB9XHJcbiAgICAgICAgaWYgKGJhc2UuaXNVbml0KCkpIHtcclxuICAgICAgICAgICAgaWYgKG4uaXNaZXJvKCkpIHJldHVybiB7IHZhbHVlOiBbMF0sIGlzTmVnYXRpdmU6IGZhbHNlIH07XHJcblxyXG4gICAgICAgICAgICByZXR1cm4ge1xyXG4gICAgICAgICAgICAgICAgdmFsdWU6IEFycmF5LmFwcGx5KG51bGwsIEFycmF5KG4udG9KU051bWJlcigpKSlcclxuICAgICAgICAgICAgICAgICAgICAubWFwKE51bWJlci5wcm90b3R5cGUudmFsdWVPZiwgMSksXHJcbiAgICAgICAgICAgICAgICBpc05lZ2F0aXZlOiBuZWdcclxuICAgICAgICAgICAgfTtcclxuICAgICAgICB9XHJcbiAgICAgICAgdmFyIG91dCA9IFtdO1xyXG4gICAgICAgIHZhciBsZWZ0ID0gbiwgZGl2bW9kO1xyXG4gICAgICAgIHdoaWxlIChsZWZ0LmlzTmVnYXRpdmUoKSB8fCBsZWZ0LmNvbXBhcmVBYnMoYmFzZSkgPj0gMCkge1xyXG4gICAgICAgICAgICBkaXZtb2QgPSBsZWZ0LmRpdm1vZChiYXNlKTtcclxuICAgICAgICAgICAgbGVmdCA9IGRpdm1vZC5xdW90aWVudDtcclxuICAgICAgICAgICAgdmFyIGRpZ2l0ID0gZGl2bW9kLnJlbWFpbmRlcjtcclxuICAgICAgICAgICAgaWYgKGRpZ2l0LmlzTmVnYXRpdmUoKSkge1xyXG4gICAgICAgICAgICAgICAgZGlnaXQgPSBiYXNlLm1pbnVzKGRpZ2l0KS5hYnMoKTtcclxuICAgICAgICAgICAgICAgIGxlZnQgPSBsZWZ0Lm5leHQoKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBvdXQucHVzaChkaWdpdC50b0pTTnVtYmVyKCkpO1xyXG4gICAgICAgIH1cclxuICAgICAgICBvdXQucHVz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0aXZlIGV4cG9uZW50IHBhcnQgZm9yIGludGVnZXJzXCIpO1xyXG4gICAgICAgICAgICB0ZXh0ICs9IChuZXcgQXJyYXkoZXhwICsgMSkpLmpvaW4oXCIwXCIpO1xyXG4gICAgICAgICAgICB2ID0gdGV4dDtcclxuICAgICAgICB9XHJcbiAgICAgICAgdmFyIGlzVmFsaWQgPSAvXihbMC05XVswLTldKikkLy50ZXN0KHYpO1xyXG4gICAgICAgIGlmICghaXNWYWxpZCkgdGhyb3cgbmV3IEVycm9yKFwiSW52YWxpZCBpbnRlZ2VyOiBcIiArIHYpO1xyXG4gICAgICAgIGlmIChzdXBwb3J0c05hdGl2ZUJpZ0ludCkge1xyXG4gICAgICAgICAgICByZXR1cm4gbmV3IE5hdGl2ZUJpZ0ludChCaWdJbnQoc2lnbiA/IFwiLVwiICsgdiA6IHYpKTtcclxuICAgICAgICB9XHJcbiAgICAgICAgdmFyIHIgPSBbXSwgbWF4ID0gdi5sZW5ndGgsIGwgPSBMT0dfQkFTRSwgbWluID0gbWF4IC0gbDtcclxuICAgICAgICB3aGlsZSAobWF4ID4gMCkge1xyXG4gICAgICAgICAgICByLnB1c2goK3Yuc2xpY2UobWluLCBtYXgpKTtcclxuICAgICAgICAgICAgbWluIC09IGw7XHJcbiAgICAgICAgICAgIGlmIChtaW4gPCAwKSBtaW4gPSAwO1xyXG4gICAgICAgICAgICBtYXggLT0gbDtcclxuICAgICAgICB9XHJcbiAgICAgICAgdHJpbShyKTtcclxuICAgICAgICByZXR1cm4gbmV3IEJpZ0ludGVnZXIociwgc2lnbik7XHJcbiAgICB9XHJcblxyXG4gICAgZnVuY3Rpb24gcGFyc2VOdW1iZXJWYWx1ZSh2KSB7XHJcbiAgICAgICAgaWYgKHN1cHBvcnRzTmF0aXZlQmlnSW50KSB7XHJcbiAgICAgICAgICAgIHJldHVybiBuZXcgTmF0aXZlQmlnSW50KEJpZ0ludCh2KSk7XHJcbiAgICAgICAgfVxyXG4gICAgICAgIGlmIChpc1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AgICBiaXQgPSAwLFxyXG4gICAgICAgICAgaztcclxuXHJcbiAgICAgIG9mZnNldCArPSB0aGlzLndyaXRlVmFyaW50MzIoYml0cyxvZmZzZXQpO1xyXG5cclxuICAgICAgd2hpbGUoYnl0ZXMtLSkge1xyXG4gICAgICAgIGsgPSAoISF2YWx1ZVtiaXQrK10gJiAxKSB8XHJcbiAgICAgICAgICAgICgoISF2YWx1ZVtiaXQrK10gJiAxKSA8PCAxKSB8XHJcbiAgICAgICAgICAgICgoISF2YWx1ZVtiaXQrK10gJiAxKSA8PCAyKSB8XHJcbiAgICAgICAgICAgICgoISF2YWx1ZVtiaXQrK10gJiAxKSA8PCAzKSB8XHJcbiAgICAgICAgICAgICgoISF2YWx1ZVtiaXQrK10gJiAxKSA8PCA0KSB8XHJcbiAgICAgICAgICAgICgoISF2YWx1ZVtiaXQrK10gJiAxKSA8PCA1KSB8XHJcbiAgICAgICAgICAgICgoISF2YWx1ZVtiaXQrK10gJiAxKSA8PCA2KSB8XHJcbiAgICAgICAgICAgICgoISF2YWx1ZVtiaXQrK10gJiAxKSA8PCA3KTtcclxuICAgICAgICB0aGlzLndyaXRlQnl0ZShrLG9mZnNldCsrKTtcclxuICAgICAgfVxyXG5cclxuICAgICAgaWYoYml0IDwgYml0cykge1xyXG4gICAgICAgIHZhciBtID0gMDsgayA9IDA7XHJcbiAgICAgICAgd2hpbGUoYml0IDwgYml0cykgayA9IGsgfCAoKCEhdmFsdWVbYml0KytdICYgMSkgPDwgKG0rKykpO1xyXG4gICAgICAgIHRoaXMud3JpdGVCeXRlKGssb2Zmc2V0KyspO1xyXG4gICAgICB9XHJcblxyXG4gICAgICBpZiAocmVsYXRpdmUpIHtcclxuICAgICAgICB0aGlzLm9mZnNldCA9IG9mZnNldDtcclxuICAgICAgICByZXR1cm4gdGhpcztcclxuICAgICAgfVxyXG4gICAgICByZXR1cm4gb2Zmc2V0IC0gc3RhcnQ7XHJcbiAgICB9XHJcblxyXG4gICAgLyoqXHJcbiA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ICAgICAgICAgICAgICAgdGhpcy5yZXNpemUoKGNhcGFjaXR5NiAqPSAyKSA+IG9mZnNldCA/IGNhcGFjaXR5NiA6IG9mZnNldCk7XG4gICAgICAgICAgICBvZmZzZXQgLT0gODtcbiAgICAgICAgICAgIHZhciBsbyA9IHZhbHVlLmxvdyxcclxuICAgICAgICAgICAgICAgIGhpID0gdmFsdWUuaGlnaDtcclxuICAgICAgICAgICAgaWYgKHRoaXMubGl0dGxlRW5kaWFuKSB7XHJcbiAgICAgICAgICAgICAgICB0aGlzLnZpZXdbb2Zmc2V0KzNdID0gKGxvID4+PiAyNCkgJiAweEZGO1xuICAgICAgICAgICAgICAgIHRoaXMudmlld1tvZmZzZXQrMl0gPSAobG8gPj4+IDE2KSAmIDB4RkY7XG4gICAgICAgICAgICAgICAgdGhpcy52aWV3W29mZnNldCsxXSA9IChsbyA+Pj4gIDgpICYgMHhGRjtcbiAgICAgICAgICAgICAgICB0aGlzLnZpZXdbb2Zmc2V0ICBdID0gIGxvICAgICAgICAgJiAweEZGO1xuICAgICAgICAgICAgICAgIG9mZnNldCArPSA0O1xyXG4gICAgICAgICAgICAgICAgdGhpcy52aWV3W29mZnNldCszXSA9IChoaSA+Pj4gMjQpICYgMHhGRjtcbiAgICAgICAgICAgICAgICB0aGlzLnZpZXdbb2Zmc2V0KzJdID0gKGhpID4+PiAxNikgJiAweEZGO1xuICAgICAgICAgICAgICAgIHRoaXMudmlld1tvZmZzZXQrMV0gPSAoaGkgPj4+ICA4KSAmIDB4RkY7XG4gICAgICAgICAgICAgICAgdGhpcy52aWV3W29mZnNldCAgXSA9ICBoaSAgICAgICAgICYgMHhGRjtcbiAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICB0aGlzLnZpZXdbb2Zmc2V0ICBdID0gKGhpID4+PiAyNCkgJiAweEZGO1xuICAgICAgICAgICAgICAgIHRoaXMudmlld1tvZmZzZXQrMV0gPSAoaGkgPj4+IDE2KSAmIDB4RkY7XG4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AgICAgICAgICAgICAgdGhyb3cgUmFuZ2VFcnJvcihcIklsbGVnYWwgb2Zmc2V0OiAwIDw9IFwiK29mZnNldCtcIiAoK1wiKzgrXCIpIDw9IFwiK3RoaXMuYnVmZmVyLmJ5dGVMZW5ndGgpO1xuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB2YXIgbG8gPSAwLFxyXG4gICAgICAgICAgICAgICAgaGkgPSAwO1xyXG4gICAgICAgICAgICBpZiAodGhpcy5saXR0bGVFbmRpYW4pIHtcclxuICAgICAgICAgICAgICAgIGxvICA9IHRoaXMudmlld1tvZmZzZXQrMl0gPDwgMTY7XG4gICAgICAgICAgICAgICAgbG8gfD0gdGhpcy52aWV3W29mZnNldCsxXSA8PCAgODtcbiAgICAgICAgICAgICAgICBsbyB8PSB0aGlzLnZpZXdbb2Zmc2V0ICBdO1xuICAgICAgICAgICAgICAgIGxvICs9IHRoaXMudmlld1tvZmZzZXQrM10gPDwgMjQgPj4+IDA7XG4gICAgICAgICAgICAgICAgb2Zmc2V0ICs9IDQ7XHJcbiAgICAgICAgICAgICAgICBoaSAgPSB0aGlzLnZpZXdbb2Zmc2V0KzJdIDw8IDE2O1xuICAgICAgICAgICAgICAgIGhpIHw9IHRoaXMudmlld1tvZmZzZXQrMV0gPDwgIDg7XG4gICAgICAgICAgICAgICAgaGkgfD0gdGhpcy52aWV3W29mZnNldCAgXTtcbiAgICAgICAgICAgICAgICBoaSArPSB0aGlzLnZpZXdbb2Zmc2V0KzNdIDw8IDI0ID4+PiAwO1xuICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgIGhpICA9IHRoaXMudmlld1tvZmZzZXQrMV0gPDwgMTY7XG4gICAgICAgICAgICAgICAgaGkgfD0gdGhpcy52aWV3W29mZnNldCsyXSA8PCAgODtcbiAgICAgICAgICAgICAgICBoaSB8PSB0aGlzLnZpZXdbb2Zmc2V0KzNdO1xuICAgICAgICAgICAgICAgIGhpICs9IHRoaXMudmlld1tvZm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ICB2YXIgbG8gPSB2YWx1ZS5sb3csXHJcbiAgICAgICAgICAgICAgICBoaSA9IHZhbHVlLmhpZ2g7XHJcbiAgICAgICAgICAgIGlmICh0aGlzLmxpdHRsZUVuZGlhbikge1xyXG4gICAgICAgICAgICAgICAgdGhpcy52aWV3W29mZnNldCszXSA9IChsbyA+Pj4gMjQpICYgMHhGRjtcbiAgICAgICAgICAgICAgICB0aGlzLnZpZXdbb2Zmc2V0KzJdID0gKGxvID4+PiAxNikgJiAweEZGO1xuICAgICAgICAgICAgICAgIHRoaXMudmlld1tvZmZzZXQrMV0gPSAobG8gPj4+ICA4KSAmIDB4RkY7XG4gICAgICAgICAgICAgICAgdGhpcy52aWV3W29mZnNldCAgXSA9ICBsbyAgICAgICAgICYgMHhGRjtcbiAgICAgICAgICAgICAgICBvZmZzZXQgKz0gNDtcclxuICAgICAgICAgICAgICAgIHRoaXMudmlld1tvZmZzZXQrM10gPSAoaGkgPj4+IDI0KSAmIDB4RkY7XG4gICAgICAgICAgICAgICAgdGhpcy52aWV3W29mZnNldCsyXSA9IChoaSA+Pj4gMTYpICYgMHhGRjtcbiAgICAgICAgICAgICAgICB0aGlzLnZpZXdbb2Zmc2V0KzFdID0gKGhpID4+PiAgOCkgJiAweEZGO1xuICAgICAgICAgICAgICAgIHRoaXMudmlld1tvZmZzZXQgIF0gPSAgaGkgICAgICAgICAmIDB4RkY7XG4gICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgdGhpcy52aWV3W29mZnNldCAgXSA9IChoaSA+Pj4gMjQpICYgMHhGRjtcbiAgICAgICAgICAgICAgICB0aGlzLnZpZXdbb2Zmc2V0KzFdID0gKGhpID4+PiAxNikgJiAweEZGO1xuICAgICAgICAgICAgICAgIHRoaXMudmlld1tvZmZzZXQrMl0gPSAoaGkgPj4+ICA4KSAmIDB4RkY7XG4gICAgICAgICAgICAgICAgdGhpcy52aWV3W29mZnNldCszXSA9ICBoaSAgICAgICAgICYgMHhGRjtc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RlTGVuZ3RoKTtcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgdmFyIGxvID0gMCxcclxuICAgICAgICAgICAgICAgIGhpID0gMDtcclxuICAgICAgICAgICAgaWYgKHRoaXMubGl0dGxlRW5kaWFuKSB7XHJcbiAgICAgICAgICAgICAgICBsbyAgPSB0aGlzLnZpZXdbb2Zmc2V0KzJdIDw8IDE2O1xuICAgICAgICAgICAgICAgIGxvIHw9IHRoaXMudmlld1tvZmZzZXQrMV0gPDwgIDg7XG4gICAgICAgICAgICAgICAgbG8gfD0gdGhpcy52aWV3W29mZnNldCAgXTtcbiAgICAgICAgICAgICAgICBsbyArPSB0aGlzLnZpZXdbb2Zmc2V0KzNdIDw8IDI0ID4+PiAwO1xuICAgICAgICAgICAgICAgIG9mZnNldCArPSA0O1xyXG4gICAgICAgICAgICAgICAgaGkgID0gdGhpcy52aWV3W29mZnNldCsyXSA8PCAxNjtcbiAgICAgICAgICAgICAgICBoaSB8PSB0aGlzLnZpZXdbb2Zmc2V0KzFdIDw8ICA4O1xuICAgICAgICAgICAgICAgIGhpIHw9IHRoaXMudmlld1tvZmZzZXQgIF07XG4gICAgICAgICAgICAgICAgaGkgKz0gdGhpcy52aWV3W29mZnNldCszXSA8PCAyNCA+Pj4gMDtcbiAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICBoaSAgPSB0aGlzLnZpZXdbb2Zmc2V0KzFdIDw8IDE2O1xuICAgICAgICAgICAgICAgIGhpIHw9IHRoaXMudmlld1tvZmZzZXQrMl0gPDwgIDg7XG4gICAgICAgICAgICAgICAgaGkgfD0gdGhpcy52aWV3W29mZnNldCszXTtcbiAgICAgICAgICAgICAgICBoaSArPSB0aGlzLnZpZXdbb2Zmc2V0ICBdIDw8IDI0ID4+PiAwO1xuICAgICAgICAgICAgICAgIG9mZnNldCArPSA0O1xyXG4gICAgICAgICAgICAgICAgbG8gID0gdGhpcy52aWV3W29mZnNldCsxXSA8PCAxNjtcbiA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xuICAgICAgICAgICAgZUxlbiA9IG5CeXRlcyAqIDggLSBtTGVuIC0gMSxcclxuICAgICAgICAgICAgZU1heCA9ICgxIDw8IGVMZW4pIC0gMSxcclxuICAgICAgICAgICAgZUJpYXMgPSBlTWF4ID4+IDEsXHJcbiAgICAgICAgICAgIG5CaXRzID0gLTcsXHJcbiAgICAgICAgICAgIGkgPSBpc0xFID8gKG5CeXRlcyAtIDEpIDogMCxcclxuICAgICAgICAgICAgZCA9IGlzTEUgPyAtMSA6IDEsXHJcbiAgICAgICAgICAgIHMgPSBidWZmZXJbb2Zmc2V0ICsgaV07XHJcblxyXG4gICAgICAgIGkgKz0gZDtcclxuXHJcbiAgICAgICAgZSA9IHMgJiAoKDEgPDwgKC1uQml0cykpIC0gMSk7XHJcbiAgICAgICAgcyA+Pj0gKC1uQml0cyk7XHJcbiAgICAgICAgbkJpdHMgKz0gZUxlbjtcclxuICAgICAgICBmb3IgKDsgbkJpdHMgPiAwOyBlID0gZSAqIDI1NiArIGJ1ZmZlcltvZmZzZXQgKyBpXSwgaSArPSBkLCBuQml0cyAtPSA4KSB7fVxyXG5cclxuICAgICAgICBtID0gZSAmICgoMSA8PCAoLW5CaXRzKSkgLSAxKTtcclxuICAgICAgICBlID4+PSAoLW5CaXRzKTtcclxuICAgICAgICBuQml0cyArPSBtTGVuO1xyXG4gICAgICAgIGZvciAoOyBuQml0cyA+IDA7IG0gPSBtICogMjU2ICsgYnVmZmVyW29mZnNldCArIGldLCBpICs9IGQsIG5CaXRzIC09IDgpIHt9XHJcblxyXG4gICAgICAgIGlmIChlID09PSAwKSB7XHJcbiAgICAgICAgICAgIGUgPSAxIC0gZUJpYXM7XHJcbiAgICAgICAgfSBlbHNlIGlmIChlID09PSBlTWF4KSB7XHJcbiAgICAgICAgICAgIHJldHVybiBtID8gTmFOIDogKChzID8gLTEgOiAxKSAqIEluZmluaXR5KTtcclxuICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICBtID0gbSArIE1hdGg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DwgMCkgPyAxIDogMDtcclxuXHJcbiAgICAgICAgdmFsdWUgPSBNYXRoLmFicyh2YWx1ZSk7XHJcblxyXG4gICAgICAgIGlmIChpc05hTih2YWx1ZSkgfHwgdmFsdWUgPT09IEluZmluaXR5KSB7XHJcbiAgICAgICAgICAgIG0gPSBpc05hTih2YWx1ZSkgPyAxIDogMDtcclxuICAgICAgICAgICAgZSA9IGVNYXg7XHJcbiAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgZSA9IE1hdGguZmxvb3IoTWF0aC5sb2codmFsdWUpIC8gTWF0aC5MTjIpO1xyXG4gICAgICAgICAgICBpZiAodmFsdWUgKiAoYyA9IE1hdGgucG93KDIsIC1lKSkgPCAxKSB7XHJcbiAgICAgICAgICAgICAgICBlLS07XHJcbiAgICAgICAgICAgICAgICBjICo9IDI7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKGUgKyBlQmlhcyA+PSAxKSB7XHJcbiAgICAgICAgICAgICAgICB2YWx1ZSArPSBydCAvIGM7XHJcbiAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICB2YWx1ZSArPSBydCAqIE1hdGgucG93KDIsIDEgLSBlQmlhcyk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKHZhbHVlICogYyA+PSAyKSB7XHJcbiAgICAgICAgICAgICAgICBlKys7XHJcbiAgICAgICAgICAgICAgICBjIC89IDI7XHJcbiAgICAgICAgICAgIH1cclxuXHJcbiAgICAgICAgICAgIGlmIChlICsgZUJpYXMgPj0gZU1heCkge1xyXG4gICAgICAgICAgICAgICAgbSA9IDA7XHJcbiAgICAgICAgICAgICAgICBlID0gZU1heDtcclxuICAgICAgICAgICAgfSBlbHNlIGlmIChlICsgZUJpYXMgPj0gMSkge1xyXG4gICAgICAgICAgICAgICAgbSA9ICh2YWx1ZSAqIGMgLSAxKSAqIE1hdGgucG93KDIsIG1MZW4pO1xyXG4gICAgICAgICA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AgIHJldHVybiBwYXJ0MCA8IDEgPDwgNyA/IDEgOiAyO1xyXG4gICAgICAgICAgICAgICAgICAgIGVsc2VcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHBhcnQwIDwgMSA8PCAyMSA/IDMgOiA0O1xyXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICBpZiAocGFydDEgPCAxIDw8IDE0KVxyXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcGFydDEgPCAxIDw8IDcgPyA1IDogNjtcclxuICAgICAgICAgICAgICAgICAgICBlbHNlXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBwYXJ0MSA8IDEgPDwgMjEgPyA3IDogODtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfSBlbHNlXHJcbiAgICAgICAgICAgICAgICByZXR1cm4gcGFydDIgPCAxIDw8IDcgPyA5IDogMTA7XHJcbiAgICAgICAgfTtcclxuXHJcbiAgICAgICAgLyoqXHJcbiAgICAgICAgICogWmlnemFnIGVuY29kZXMgYSBzaWduZWQgNjRiaXQgaW50ZWdlciBzbyB0aGF0IGl0IGNhbiBiZSBlZmZlY3RpdmVseSB1c2VkIHdpdGggdmFyaW50IGVuY29kaW5nLlxyXG4gICAgICAgICAqIEBwYXJhbSB7bnVtYmVyfCFMb25nfSB2YWx1ZSBTaWduZWQgbG9uZ1xyXG4gICAgICAgICAqIEByZXR1cm5zIHshTG9uZ30gVW5zaWduZWQgemlnemFnIGVuY29kZWQgbG9uZ1xyXG4gICAgICAgICAqIEBleHBvc2VcclxuICAgICAgICAgKi9cclxuICAgICAgICBCeXRlQnVmZmVyLnppZ1phZ0VuY29kZTY0ID0gZnVuY3Rpb24odmFsdWUpIHtcclxuICAgICAgICAgICAgaWYgKHR5cGVvZiB2YWx1ZSA9PT0gJ251bWJlcicpXG4gICAgICAgICAgICAgICAgdmFsdWUgPSBMb25nLmZyb21OdW1iZXIod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pIHwgMHg4MCA6IChwYXJ0MCA+Pj4gMTQpICYgMHg3RjtcclxuICAgICAgICAgICAgICAgIGNhc2UgMiA6IHRoaXMudmlld1tvZmZzZXQrMV0gPSBzaXplICE9PSAyID8gKHBhcnQwID4+PiAgNykgfCAweDgwIDogKHBhcnQwID4+PiAgNykgJiAweDdGO1xyXG4gICAgICAgICAgICAgICAgY2FzZSAxIDogdGhpcy52aWV3W29mZnNldCAgXSA9IHNpemUgIT09IDEgPyAocGFydDAgICAgICAgKSB8IDB4ODAgOiAocGFydDAgICAgICAgKSAmIDB4N0Y7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKHJlbGF0aXZlKSB7XHJcbiAgICAgICAgICAgICAgICB0aGlzLm9mZnNldCArPSBzaXplO1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuIHRoaXM7XHJcbiAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gc2l6ZTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH07XHJcblxyXG4gICAgICAgIC8qKlxyXG4gICAgICAgICAqIFdyaXRlcyBhIHppZy16YWcgZW5jb2RlZCA2NGJpdCBiYXNlIDEyOCB2YXJpYWJsZS1sZW5ndGggaW50ZWdlci5cclxuICAgICAgICAgKiBAcGFyYW0ge251bWJlcnxMb25nfSB2YWx1ZSBWYWx1ZSB0byB3cml0ZVxyXG4gICAgICAgICAqIEBwYXJhbSB7bnVtYmVyPX0gb2Zmc2V0IE9mZnNldCB0byB3cml0ZSB0by4gV2lsbCB1c2UgYW5kIGluY3JlYXNlIHtAbGluayBCeXRlQnVmZmVyI29mZnNldH0gYnkgdGhlIG51bWJlciBvZiBieXRlc1xyXG4gICAgICAgICAqICB3cml0dGVuIGlmIG9taXR0ZWQuXHJcbiAgICAgICAgICogQHJldHVybnMgeyFCeXRlQnVmZmVyfG51bWJlcn0gYHRoaXNgIGlmIG9mZnNldCBpcyBvbWl0dGVkLCBlbH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nQ2NCA9IGZ1bmN0aW9uKG9mZnNldCkge1xyXG4gICAgICAgICAgICB2YXIgcmVsYXRpdmUgPSB0eXBlb2Ygb2Zmc2V0ID09PSAndW5kZWZpbmVkJztcbiAgICAgICAgICAgIGlmIChyZWxhdGl2ZSkgb2Zmc2V0ID0gdGhpcy5vZmZzZXQ7XG4gICAgICAgICAgICBpZiAoIXRoaXMubm9Bc3NlcnQpIHtcclxuICAgICAgICAgICAgICAgIGlmICh0eXBlb2Ygb2Zmc2V0ICE9PSAnbnVtYmVyJyB8fCBvZmZzZXQgJSAxICE9PSAwKVxuICAgICAgICAgICAgICAgICAgICB0aHJvdyBUeXBlRXJyb3IoXCJJbGxlZ2FsIG9mZnNldDogXCIrb2Zmc2V0K1wiIChub3QgYW4gaW50ZWdlcilcIik7XG4gICAgICAgICAgICAgICAgb2Zmc2V0ID4+Pj0gMDtcbiAgICAgICAgICAgICAgICBpZiAob2Zmc2V0IDwgMCB8fCBvZmZzZXQgKyAxID4gdGhpcy5idWZmZXIuYnl0ZUxlbmd0aClcbiAgICAgICAgICAgICAgICAgICAgdGhyb3cgUmFuZ2VFcnJvcihcIklsbGVnYWwgb2Zmc2V0OiAwIDw9IFwiK29mZnNldCtcIiAoK1wiKzErXCIpIDw9IFwiK3RoaXMuYnVmZmVyLmJ5dGVMZW5ndGgpO1xuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAvLyByZWY6IHNyYy9nb29nbGUvcHJvdG9idWYvaW8vY29kZWRfc3RyZWFtLmNjXHJcbiAgICAgICAgICAgIHZhciBzdGFydCA9IG9mZnNldCxcclxuICAgICAgICAgICAgICAgIHBhcnQwID0gMCxcclxuICAgICAgICAgICAgICAgIHBhcnQxID0gMCxcclxuICAgICAgICAgICAgICAgIHBhcnQyID0gMCxcclxuICAgICAgICAgICAgICAgIGIgID0gMDtcclxuICAgICAgICAgICAgYiA9IHRoaXMudmlld1tvZmZzZXQrK107IHBhcnQwICA9IChiICYgMHg3RikgICAgICA7IGlmICggYiAmIDB4ODAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICApIHtcclxuICAgICAgICAgICAgYiA9IHRoaXMudmlld1tvZmZzZXQrK107IHBhcnQwIHw9IChiICYgMHg3RikgPDwgIDc7IGlmICgoYiAmIDB4ODApIHx8ICh0aGlzLm5vQXNzZXJ0ICYmIHR5cGVvZiBiID09PSAndW5kZWZpbmVkJykpIHtcclxuICAgICAgICAgICAgYiA9IHRoaXMudmlld1tvZmZzZXQrK107IHBhcnQwIHw9IChiICYgMHg3RikgPDwgMTQ7IGlmICgoYiAmIDB4ODApIHx8ICh0aGlzLm5vQXNzZXJ0ICYmIHR5cGVvZiBiID09PSAndW5kZWZpbmVkJykpIHtcclxuICAgICAgICAgICAgYiA9IHRoaXMudmlld1tvZmZzZXQrK107IHBhcnQwIHw9IChiICYgMHg3RikgPDwgMjE7IGlmICgoYiAmIDB4ODApIHx8ICh0aGlzLm5vQXNzZXJ0ICYmIHR5cGVvZiBiID09PSAndW5kZWZpbmVkJykpIHtcclxuICAgICAgICAgICAgYiA9IHRoaXMudmlld1tvZmZzZXQrK107IHBhcnQxICA9IChiICYgMHg3RikgICAgICA7IGlmICgoYiAmIDB4ODApIHx8ICh0aGlzLm5vQXNzZXJ0ICYmIHR5cGVvZiBiID09PSAndW5kZWZpbmVkJykpIHtcclxuICAgICAgICAgICAgYiA9IHRoaXMudmlld1tvZmZzZXQrK107IHBhcnQxIHw9IChiICYgMHg3RikgPDwgIDc7IGlmICgoYiAmIDB4ODApIHx8ICh0aGlzLm5vQXNzZXJ0ICYmIHR5cGVvZiBiID09PSAndW5kZWZpbmVkJykpIHtcclxuICAgICAgICAgICAgYiA9IHRoaXMudmlld1tvZmZzZXQrK107IHBhcnQxIHw9IChiICYgMHg3RikgPDwgMTQ7IGlmICgoYiAmIDB4ODApIHx8ICh0aGlzLm5vQXNzZXJ0ICYmIHR5cGVvZiBiID09PSAndW5kZWZpbmVkJykpIHtcclxuICAgICAgICAgICAgYiA9IHRoaXMudmlld1tvZmZzZXQrK107IHBhcnQxIHw9IChiICYgMHg3RikgPDwgMjE7IGlmICgoYiAmIDB4ODApIHx8ICh0aGlzLm5vQXNzZXJ0ICYmIHR5cGVvZiBiID09PSAndW5kZWZpbmVkJykpIHtcclxuICAgICAgICAgICAgYiA9IHRoaXMudmlld1tvZmZzZXQrK107IHBhcnQyICA9IChiICYgMHg3RikgICAgICA7IGlmICgoYiAmIDB4ODApIHx8ICh0aGlzLm5vQXNzZXJ0ICYmIHR5cGVvZiBiID09PSAndW5kZWZpbmVkJykpIHtcclxuICAgICAgICAgICAgYiA9IHRoaXMudmlld1tvZmZzZXQrK107IHBhcnQyIHw9IChiICYgMHg3RikgPDwgIDc7IGlmICgoYiAmIDB4ODApIHx8ICh0aGlzLm5vQXNzZXJ0ICYmIHR5cGVvZiBiID09PSAndW5kZWZpbmVkJykpIHtcclxuICAgICAgICAgICAgdGhyb3cgRXJyb3IoXCJCdWZmZXIgb3ZlcnJ1blwiKTsgfX19fX19fX19fVxyXG4gICAgICAgICAgICB2YXIgdmFsdWUgPSBMb25nLmZyb21CaXRzKHBhcnQwIHwgKHBhcnQxIDw8IDI4KSwgKHBhcnQxID4+PiA0KSB8IChwYXJ0MikgPDwgMjQsIGZhbHNlKTtcclxuICAgICAgICAgICAgaWYgKHJlbGF0aXZlKSB7XHJcbiAgICAgICAgICAgICAgICB0aGlzLm9mZnNldCA9IG9mZnNldDtcclxuICAgICAgICAgICAgICAgIHJldHVybiB2YWx1ZTtcclxuICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgIHJldHVybiB7XHJcbiAgICAgICAgICAgICAgICAgICAgJ3ZhbHVlJzogdmFsdWUsXHJcbiAgICAgICAgICAgICAgICAgICAgJ2xlbmd0aCc6IG9mZnNldC1zdGFydFxyXG4gICAgICAgICAgICAgICAgfTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH07XHJcblxyXG4gICAgICA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4gMTYpICYgMHhGRjtcbiAgICAgICAgICAgIHRoaXMudmlld1tvZmZzZXQrMV0gPSAoayA+Pj4gIDgpICYgMHhGRjtcbiAgICAgICAgICAgIHRoaXMudmlld1tvZmZzZXQgIF0gPSAgayAgICAgICAgICYgMHhGRjtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHRoaXMudmlld1tvZmZzZXQgIF0gPSAoayA+Pj4gMjQpICYgMHhGRjtcbiAgICAgICAgICAgIHRoaXMudmlld1tvZmZzZXQrMV0gPSAoayA+Pj4gMTYpICYgMHhGRjtcbiAgICAgICAgICAgIHRoaXMudmlld1tvZmZzZXQrMl0gPSAoayA+Pj4gIDgpICYgMHhGRjtcbiAgICAgICAgICAgIHRoaXMudmlld1tvZmZzZXQrM10gPSAgayAgICAgICAgICYgMHhGRjtcbiAgICAgICAgfVxuICAgICAgICBvZmZzZXQgKz0gNDtcclxuICAgICAgICB1dGZ4LmVuY29kZVVURjE2dG9VVEY4KHN0cmluZ1NvdXJjZShzdHIpLCBmdW5jdGlvbihiKSB7XHJcbiAgICAgICAgICAgIHRoaXMudmlld1tvZmZzZXQrK10gPSBiO1xyXG4gICAgICAgIH0uYmluZCh0aGlzKSk7XHJcbiAgICAgICAgaWYgKG9mZnNldCAhPT0gc3RhcnQgKyA0ICsgaylcclxuICAgICAgICAgICAgdGhyb3cgUmFuZ2VFcnJvcihcIklsbGVnYWwgcmFuZ2U6IFRydW5jYXRlZCBkYXRhLCBcIitvZmZzZXQrXCIgPT0gXCIrKG9mZnNldCs0K2spKTtcclxuICAgICAgICBpZiAocmVsYXRpdmUpIHtcclxuICAgICAgICAgICAgdGhpcy5vZmZzZXQgPSBvZmZzZXQ7XHJcbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xyXG4gICAgICAgIH1cclxuICAgICAgICByZXR1cm4gb2Zmc2V0IC0gc3RhcnQ7XHJcbiAgICB9O1xyXG5cclxuICAgIC8qKlxyXG4gICAgICogUmVhZHMgYSBsZW5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ChvZmZzZXQgPCAwIHx8IG9mZnNldCArIDQgPiB0aGlzLmJ1ZmZlci5ieXRlTGVuZ3RoKVxuICAgICAgICAgICAgICAgIHRocm93IFJhbmdlRXJyb3IoXCJJbGxlZ2FsIG9mZnNldDogMCA8PSBcIitvZmZzZXQrXCIgKCtcIis0K1wiKSA8PSBcIit0aGlzLmJ1ZmZlci5ieXRlTGVuZ3RoKTtcbiAgICAgICAgfVxyXG4gICAgICAgIHZhciBzdGFydCA9IG9mZnNldDtcclxuICAgICAgICB2YXIgbGVuID0gdGhpcy5yZWFkVWludDMyKG9mZnNldCk7XHJcbiAgICAgICAgdmFyIHN0ciA9IHRoaXMucmVhZFVURjhTdHJpbmcobGVuLCBCeXRlQnVmZmVyLk1FVFJJQ1NfQllURVMsIG9mZnNldCArPSA0KTtcclxuICAgICAgICBvZmZzZXQgKz0gc3RyWydsZW5ndGgnXTtcclxuICAgICAgICBpZiAocmVsYXRpdmUpIHtcclxuICAgICAgICAgICAgdGhpcy5vZmZzZXQgPSBvZmZzZXQ7XHJcbiAgICAgICAgICAgIHJldHVybiBzdHJbJ3N0cmluZyddO1xyXG4gICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgIHJldHVybiB7XHJcbiAgICAgICAgICAgICAgICAnc3RyaW5nJzogc3RyWydzdHJpbmcnXSxcclxuICAgICAgICAgICAgICAgICdsZW5ndGgnOiBvZmZzZXQgLSBzdGFydFxyXG4gICAgICAgICAgICB9O1xyXG4gICAgICAgIH1cclxuICAgIH07XHJcblxyXG4gICAgLy8gdHlwZXMvc3RyaW5ncy91dGY4c3RyaW5nXHJcblxyXG4gICAgLyoqXHJcbiAgICAgKiBNZXRyaWNzIHJlcHJlc2VudGluZyBudW1iZXIgb2YgVVRGOCBjaGFyYWN0ZXJzLiBFdmFsdWF0ZXMgdG8gYGNgLlxyXG4gICAgICogQHR5cGUge3N0cmluZ31cclxuICAgICAqIEBjb25zdFxyXG4gICAgICogQGV4cG9zZVxyXG4gICAgIC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gICAgICAgICAgICAgICAgdGhyb3cgUmFuZ2VFcnJvcihcIklsbGVnYWwgb2Zmc2V0OiAwIDw9IFwiK29mZnNldCtcIiAoK1wiKzArXCIpIDw9IFwiK3RoaXMuYnVmZmVyLmJ5dGVMZW5ndGgpO1xuICAgICAgICB9XHJcbiAgICAgICAgdmFyIGkgPSAwLFxyXG4gICAgICAgICAgICBzdGFydCA9IG9mZnNldCxcclxuICAgICAgICAgICAgc2Q7XHJcbiAgICAgICAgaWYgKG1ldHJpY3MgPT09IEJ5dGVCdWZmZXIuTUVUUklDU19DSEFSUykgeyAvLyBUaGUgc2FtZSBmb3Igbm9kZSBhbmQgdGhlIGJyb3dzZXJcclxuICAgICAgICAgICAgc2QgPSBzdHJpbmdEZXN0aW5hdGlvbigpO1xyXG4gICAgICAgICAgICB1dGZ4LmRlY29kZVVURjgoZnVuY3Rpb24oKSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gaSA8IGxlbmd0aCAmJiBvZmZzZXQgPCB0aGlzLmxpbWl0ID8gdGhpcy52aWV3W29mZnNldCsrXSA6IG51bGw7XHJcbiAgICAgICAgICAgIH0uYmluZCh0aGlzKSwgZnVuY3Rpb24oY3ApIHtcclxuICAgICAgICAgICAgICAgICsraTsgdXRmeC5VVEY4dG9VVEYxNihjcCwgc2QpO1xyXG4gICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgaWYgKGkgIT09IGxlbmd0aClcclxuICAgICAgICAgICAgICAgIHRocm93IFJhbmdlRXJyb3IoXCJJbGxlZ2FsIHJhbmdlOiBUcnVuY2F0ZWQgZGF0YSwgXCIraStcIiA9PSBcIitsZW5ndGgpO1xyXG4gICAgICAgICAgICBpZiAocmVsYXRpdmUpIHtcclxuICAgICAgICAgICAgICAgIHRoaXMub2Zmc2V0ID0gb2Zmc2V0O1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuIHNkKCk7XHJcbiAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICBy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W5nRGVzdGluYXRpb24oKSwgdGhpcy5ub0Fzc2VydCk7XHJcbiAgICAgICAgICAgIGlmIChvZmZzZXQgIT09IGspXHJcbiAgICAgICAgICAgICAgICB0aHJvdyBSYW5nZUVycm9yKFwiSWxsZWdhbCByYW5nZTogVHJ1bmNhdGVkIGRhdGEsIFwiK29mZnNldCtcIiA9PSBcIitrKTtcclxuICAgICAgICAgICAgaWYgKHJlbGF0aXZlKSB7XHJcbiAgICAgICAgICAgICAgICB0aGlzLm9mZnNldCA9IG9mZnNldDtcclxuICAgICAgICAgICAgICAgIHJldHVybiBzZCgpO1xyXG4gICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuIHtcclxuICAgICAgICAgICAgICAgICAgICAnc3RyaW5nJzogc2QoKSxcclxuICAgICAgICAgICAgICAgICAgICAnbGVuZ3RoJzogb2Zmc2V0IC0gc3RhcnRcclxuICAgICAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9IGVsc2VcclxuICAgICAgICAgICAgdGhyb3cgVHlwZUVycm9yKFwiVW5zdXBwb3J0ZWQgbWV0cmljczogXCIrbWV0cmljcyk7XHJcbiAgICB9O1xyXG5cclxuICAgIC8qKlxyXG4gICAgICogUmVhZHMgYW4gVVRGOCBlbmNvZGVkIHN0cmluZy4gVGhpcyBpcyBhbiBhbGlhcyBvZiB7QGxpbmsgQnl0ZUJ1ZmZlciNyZWFkVVRGOFN0cmluZ30uXHJcbiAgICAgKiBAZnVuY3Rpb25cclxuICAgICAqIEBwYXJhbSB7bnVtYmVyfSBsZW5ndGggTnVtYmVyIG9mIGNoYXJhY3RlcnMgb3IgYnl0ZXMgdG8gcmVhZFxyXG4gICAgICogQHBhcmFtIHtudW1iZXI9fSBtZXRyaWNzIE1ldHJpY3Mgc3BlY2lmeWluZyB3aGF0IGBuYCBpcyBtZWFudCB0byBjb3VudC4gRGVmYXVsdHMgdG9cclxuICAgICAqICB7QGxpbmsg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GltaXQ9XCIrdGhpcy5saW1pdCtcIixjYXBhY2l0eT1cIit0aGlzLmNhcGFjaXR5KCkrXCIpXCI7XHJcbiAgICAgICAgaWYgKHR5cGVvZiBlbmNvZGluZyA9PT0gJ251bWJlcicpXHJcbiAgICAgICAgICAgIGVuY29kaW5nID0gXCJ1dGY4XCIsXHJcbiAgICAgICAgICAgIGJlZ2luID0gZW5jb2RpbmcsXHJcbiAgICAgICAgICAgIGVuZCA9IGJlZ2luO1xyXG4gICAgICAgIHN3aXRjaCAoZW5jb2RpbmcpIHtcclxuICAgICAgICAgICAgY2FzZSBcInV0ZjhcIjpcclxuICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnRvVVRGOChiZWdpbiwgZW5kKTtcclxuICAgICAgICAgICAgY2FzZSBcImJhc2U2NFwiOlxyXG4gICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMudG9CYXNlNjQoYmVnaW4sIGVuZCk7XHJcbiAgICAgICAgICAgIGNhc2UgXCJoZXhcIjpcclxuICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnRvSGV4KGJlZ2luLCBlbmQpO1xyXG4gICAgICAgICAgICBjYXNlIFwiYmluYXJ5XCI6XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy50b0JpbmFyeShiZWdpbiwgZW5kKTtcclxuICAgICAgICAgICAgY2FzZSBcImRlYnVnXCI6XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy50b0RlYnVnKCk7XHJcbiAgICAgICAgICAgIGNhc2UgXCJjb2x1bW5zXCI6XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy50b0NvbHVtbnMoKTtcclxuICAgICAgICAgICAgZGVmYXVsdDpcclxuICAgICAgICAgICAgICAgIHRocm93IEVycm9yKFwiVW5zdXBwb3J0ZWQgZW5jb2Rpbmc6IFwiK2VuY29kaW5nKTtcclxuICAgICAgICB9XHJcbiAgICB9O1xyXG5cclxuICAgIC8vIGx4aXYtZW1iZWRkYW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jKCkpICE9PSBudWxsKSB7XHJcbiAgICAgICAgICAgICAgICBkc3QoYW91dFsoYj4+MikmMHgzZl0pO1xyXG4gICAgICAgICAgICAgICAgdCA9IChiJjB4Myk8PDQ7XHJcbiAgICAgICAgICAgICAgICBpZiAoKGIgPSBzcmMoKSkgIT09IG51bGwpIHtcclxuICAgICAgICAgICAgICAgICAgICB0IHw9IChiPj40KSYweGY7XHJcbiAgICAgICAgICAgICAgICAgICAgZHN0KGFvdXRbKHR8KChiPj40KSYweGYpKSYweDNmXSk7XHJcbiAgICAgICAgICAgICAgICAgICAgdCA9IChiJjB4Zik8PDI7XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKChiID0gc3JjKCkpICE9PSBudWxsKVxyXG4gICAgICAgICAgICAgICAgICAgICAgICBkc3QoYW91dFsodHwoKGI+PjYpJjB4MykpJjB4M2ZdKSxcclxuICAgICAgICAgICAgICAgICAgICAgICAgZHN0KGFvdXRbYiYweDNmXSk7XHJcbiAgICAgICAgICAgICAgICAgICAgZWxzZVxyXG4gICAgICAgICAgICAgICAgICAgICAgICBkc3QoYW91dFt0JjB4M2ZdKSxcclxuICAgICAgICAgICAgICAgICAgICAgICAgZHN0KDYxKTtcclxuICAgICAgICAgICAgICAgIH0gZWxzZVxyXG4gICAgICAgICAgICAgICAgICAgIGRzdChhb3V0W3QmMHgzZl0pLFxyXG4gICAgICAgICAgICAgICAgICAgIGRzdCg2MSksXHJcbiAgICAgICAgICAgICAgICAgICAgZHN0KDYxKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH07XHJcblxyXG4gICAgICAgIC8qKlxyXG4gICAgICAgICAqIERlY29kZXMgYmFzZTY0IGNoYXIgY29kZXMgdG8gYnl0ZXMuXHJcbiAgICAgICAgICogQHBhcmFtIHshZnVuY3Rpb24oKTpudW1iZXJ8bnVsbH0gc3JjIENoYXJhY3RlcnMgc291cmNlIGFzIGEgZnVuY3Rpb24gcmV0dXJuaW5nIHRoZSBuZXh0IGNoYXIgY29kZSByZXNwZWN0aXZlbHlcclxuICAgICAgICAgKiAgYG51bGxgIGlmIHRoZXJlIGFyZSBubyBtb3JlIGNoYXJhY3RlcnMgbGVmdC5cclxuICAgICAgICAgKiBAcGFyYW0geyFmdW5jdGlvbihudW1iZXIpfSBkc3QgQnl0ZXMgZGVzdGluYXRpb24gYXMgYSBmdW5jdGlvbiBzdWNjZXNzaXZlbHkgY2FsbGVkIHdpdGggdGhlIG5leHQgYnl0ZS5cclxuICAgICAgICAgKiBAdGhyb3dzIHtFcnJvcn0gSWYgYSBjaGFyYWN0ZXIgY29kZSBpcyBpbnZhbGlkXHJcbiAgICAgICAgICovXHJcbiAgICAgICAgbHhpdi5kZWNvZGUgPSBmdW5jdGlvbihzcmMsIGRzdCkge1xyXG4gICAgICAgICAgICB2YXIgYywgdDEsIHQyO1xyXG4gICAgICAgICAgICBmdW5jdGlvbiBmYWlsKGMpIHtcclxuICAgICAgICAgICAgICAgIHRocm93IEVycm9yKFwiSWxsZWdhbCBjaGFyYWN0ZXIgY29kZTogXCIrYyk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgd2hpbGUgKChjID0gc3JjKCkpICE9PSBudWxsKSB7XHJcbiAgICAgICAgICAgICAgICB0MSA9IGFpbltjXTtcclxuICAgICAgICAgICAgICAgIGlmICh0eXBlb2YgdDEgPT09ICd1bmRlZmluZWQnKSBmYWlsKGMpO1xyXG4gICAgICAgICAgICAgICAgaWYgKChjID0gc3JjKCkpICE9PSBudWxsKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgdDIgPSBhaW5bY107XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKHR5cGVvZiB0MiA9PT0gJ3VuZGVmaW5lZCcpIGZhaWwoYyk7XHJcbiAgICAgICAgICAgICAgICAgICAgZHN0KCh0MTw8Mik+Pj4wfCh0MiYweDMwKT4+NCk7XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKChjID0gc3JjKCkpICE9PSBudWxsKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHQxID0gYWluW2NdO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAodHlwZW9mIHQxID09PSAndW5kZWZpbmVkJylcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjID09PSA2MSkgYnJlYWs7IGVsc2UgZmFpbChjKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgZHN0KCgodDImMHhmKTw8NCk+Pj4wfCh0MSYweDNjKT4+Mik7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgoYyA9IHNyYygpKSAhPT0gbnVsbCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdDIgPSBhaW5bY107XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodHlwZW9mIHQyID09PSAndW5kZWZpbmVkJylcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYyA9PT0gNjEpIGJyZWFrOyBlbHNlIGZhaWwoYyk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkc3QoKCh0MSYweDMpPDw2KT4+PjB8dDIpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgfTtcclxuXHJcbiAgICAgICAgLyoqXHJcbiAgICAgICAgICogVGVzdHMgaWYgYSBzdHJpbmcgaXMgdmFsaWQgYmFzZTY0LlxyXG4gICAgICAgICAqIEBwYXJhbSB7c3RyaW5nfSBzdHIgU3RyaW5nIHRvIHRlc3RcclxuICAgICAgICAgKiBAcmV0dXJucyB7Ym9vbGVhbn0gYHRydWVgIGlmIHZhbGlkLCBvdGhlcndpc2UgYGZhbHNlYFxyXG4gICAgICAgICAqL1xyXG4gICAgICAgIGx4aXYudGVzdCA9IGZ1bmN0aW9uKHN0cikge1xyXG4gICAgICAgICAgICByZXR1cm4gL14oPz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ZE9mZnNldD0tMWBcclxuICAgICAqIEBleGFtcGxlIGB8YCBjb250YWlucyB6ZXJvIGJ5dGVzIHdpdGggYG9mZnNldD1saW1pdD0wLCBtYXJrZWRPZmZzZXQ9LTFgXHJcbiAgICAgKi9cclxuICAgIEJ5dGVCdWZmZXJQcm90b3R5cGUudG9EZWJ1ZyA9IGZ1bmN0aW9uKGNvbHVtbnMpIHtcclxuICAgICAgICB2YXIgaSA9IC0xLFxyXG4gICAgICAgICAgICBrID0gdGhpcy5idWZmZXIuYnl0ZUxlbmd0aCxcclxuICAgICAgICAgICAgYixcclxuICAgICAgICAgICAgaGV4ID0gXCJcIixcclxuICAgICAgICAgICAgYXNjID0gXCJcIixcclxuICAgICAgICAgICAgb3V0ID0gXCJcIjtcclxuICAgICAgICB3aGlsZSAoaTxrKSB7XHJcbiAgICAgICAgICAgIGlmIChpICE9PSAtMSkge1xyXG4gICAgICAgICAgICAgICAgYiA9IHRoaXMudmlld1tpXTtcclxuICAgICAgICAgICAgICAgIGlmIChiIDwgMHgxMCkgaGV4ICs9IFwiMFwiK2IudG9TdHJpbmcoMTYpLnRvVXBwZXJDYXNlKCk7XHJcbiAgICAgICAgICAgICAgICBlbHNlIGhleCArPSBiLnRvU3RyaW5nKDE2KS50b1VwcGVyQ2FzZSgpO1xyXG4gICAgICAgICAgICAgICAgaWYgKGNvbHVtbnMpXHJcbiAgICAgICAgICAgICAgICAgICAgYXNjICs9IGIgPiAzMiAmJiBiIDwgMTI3ID8gU3RyaW5nLmZyb21DaGFyQ29kZShiKSA6ICcuJztcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICArK2k7XHJcbiAgICAgICAgICAgIGlmIChjb2x1bW5zKSB7XHJcbiAgICAgICAgICAgICAgICBpZiAoaSA+IDAgJiYgaSAlIDE2ID09PSAwICYmIGkgIT09IGspIHtcclxuICAgICAgICAgICAgICAgICAgICB3aGlsZSAoaGV4Lmxlbmd0aCA8IDMqMTYrMykgaGV4ICs9IFwiIFwiO1xyXG4gICAgICAgICAgICAgICAgICAgIG91dCArPSBoZXgrYXNjK1wiXFxuXCI7XHJcbiAgICAgICAgICAgICAgICAgICAgaGV4ID0gYXNjID0gXCJcIjtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBpZiAoaSA9PT0gdGhpcy5vZmZzZXQgJiYgaSA9PT0gdGhpcy5saW1pdClcclxuICAgICAgICAgICAgICAgIGhleCArPSBpID09PSB0aGlzLm1hcmtlZE9mZnNldCA/IFwiIVwiIDogXCJ8XCI7XHJcbiAgICAgICAgICAgIGVsc2UgaWYgKGkgPT09IHRoaXMub2Zmc2V0KVxyXG4gICAgICAgICAgICAgICAgaGV4ICs9IGkgPT09IHRoaXMubWFya2VkT2Zmc2V0ID8gXCJbXCIgOiBcIjxcIjtcclxuICAgICAgICAgICAgZWxzZSBpZiAoaSA9PT0gdGhpcy5saW1pdClcclxuICAgICAgICAgICAgICAgIGhleCArPSBpID09PSB0aGlzLm1hcmtlZE9mZnNldCA/IFwiXVwiIDogXCI+XCI7XHJcbiAgICAgICAgICAgIGVsc2VcclxuICAgICAgICAgICAgICAgIGhleCArPSBpID09PSB0aGlzLm1hcmtlZE9mZnNldCA/IFwiJ1wiIDogKGNvbHVtbnMgfHwgKGkgIT09IDAgJiYgaSAhPT0gaykgPyBcIiBcIiA6IFwiXCIpO1xyXG4gICAgICAgIH1cclxuICAgICAgICBpZiAoY29sdW1ucyAmJiBoZXggIT09IFwiIFwiKSB7XHJcbiAgICAgICAgICAgIHdoaWxlIChoZXgubGVuZ3RoIDwgMyoxNiszKVxyXG4gICAgICAgICAgICAgICAgaGV4ICs9IFwiIFwiO1xyXG4gICAgICAgICAgICBvdXQgKz0gaGV4ICsgYXNjICsgXCJcXG5cIjtcclxuICAgICAgICB9XHJcbiAgICAgICAgcmV0dXJuIGNvbHVtbnMgPyBvdXQgOiBoZXg7XHJcbiAgICB9O1xyXG5cclxuICAgIC8qKlxyXG4gICA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Ly8gUmVxdWlyZSBzeW1ib2wgbmV4dFxyXG4gICAgICAgICAgICBobyA9IGZhbHNlLCBobSA9IGZhbHNlLCBobCA9IGZhbHNlLCAvLyBBbHJlYWR5IGhhcyBvZmZzZXQgKGhvKSwgbWFya2VkT2Zmc2V0IChobSksIGxpbWl0IChobCk/XHJcbiAgICAgICAgICAgIGZhaWwgPSBmYWxzZTtcclxuICAgICAgICB3aGlsZSAoaTxrKSB7XHJcbiAgICAgICAgICAgIHN3aXRjaCAoY2ggPSBzdHIuY2hhckF0KGkrKykpIHtcclxuICAgICAgICAgICAgICAgIGNhc2UgJyEnOlxyXG4gICAgICAgICAgICAgICAgICAgIGlmICghbm9Bc3NlcnQpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGhvIHx8IGhtIHx8IGhsKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmYWlsID0gdHJ1ZTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGhvID0gaG0gPSBobCA9IHRydWU7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIGJiLm9mZnNldCA9IGJiLm1hcmtlZE9mZnNldCA9IGJiLmxpbWl0ID0gajtcclxuICAgICAgICAgICAgICAgICAgICBycyA9IGZhbHNlO1xyXG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xyXG4gICAgICAgICAgICAgICAgY2FzZSAnfCc6XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKCFub0Fzc2VydCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoaG8gfHwgaGwpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZhaWwgPSB0cnVlO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgaG8gPSBobCA9IHRydWU7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIGJiLm9mZnNldCA9IGJiLmxpbWl0ID0gajtcclxuICAgICAgICAgICAgICAgICAgICBycyA9IGZhbHNlO1xyXG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xyXG4gICAgICAgICAgICAgICAgY2FzZSAnWyc6XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKCFub0Fzc2VydCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoaG8gfHwgaG0pIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZhaWwgPSB0cnVlO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgaG8gPSBobSA9IHRydWU7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIGJiLm9mZnNldCA9IGJiLm1hcmtlZE9mZnNldCA9IGo7XHJcbiAgICAgICAgICAgICAgICAgICAgcnMgPSBmYWxzZTtcclxuICAgICAgICAgICAgICAgICAgICBicmVhaztcclxuICAgICAgICAgICAgICAgIGNhc2UgJzwnOlxyXG4gICAgICAgICAgICAgICAgICAgIGlmICghbm9Bc3NlcnQpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGhvKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmYWlsID0gdHJ1ZTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGhvID0gdHJ1ZTtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgYmIub2Zmc2V0ID0gajtcclxuICAgICAgICAgICAgICAgICAgICBycyA9IGZhbHNlO1xyXG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xyXG4gICAgICAgICAgICAgICAgY2FzZSAnXSc6XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKCFub0Fzc2VydCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoaGwgfHwgaG0pIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZhaWwgPSB0cnVlO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgaGwgPSBobSA9IHRydWU7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIGJiLmxpbWl0ID0gYmIubWFya2VkT2Zmc2V0ID0gajtcclxuICAgICAgICAgICAgICAgICAgICBycyA9IGZhbHNlO1xyXG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xyXG4gICAgICAgICAgICAgICAgY2FzZSAnPic6XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKCFub0Fzc2VydCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoaGwpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZhaWwgPSB0cnVlO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgaGwgPSB0cnVlO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICBiYi5saW1pdCA9IGo7XHJcbiAgICAgICAgICAgICAgICAgICAgcnMgPSBmYWxzZTtcclxuICAgICAgICAgICAgICAgICAgICBicmVhaztcclxuICAgICAgICAgICAgICAgIGNhc2UgXCInXCI6XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKCFub0Fzc2VydCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoaG0pIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZhaWwgPSB0cnVlO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgaG0gPSB0cnVlO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICBiYi5tYXJrZWRPZmZzZXQgPSBqO1xyXG4gICAgICAgICAgICAgICAgICAgIHJzID0gZmFsc2U7XHJcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XHJcbiAgICAgICAgICAgICAgICBjYXNlICcgJzpcclxuICAgICAgICAgICAgICAgICAgICBycyA9IGZhbHNlO1xyXG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xyXG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcclxuICAgICAgICAgICAgICAgICAgICBpZiAoIW5vQXNzZXJ0KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChycykge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZmFpbCA9IHRydWU7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICBiID0gcGFyc2VJbnQoY2grc3RyLmNoYXJBdChpKyspLCAxNik7XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKCFub0Fzc2VydCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoaXNOYU4oYikgfHwgYiA8IDAgfHwgYiA+IDI1NSlcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IFR5cGVFcnJvcihcIklsbGVnYWwgc3RyOiBOb3QgYSBkZWJ1ZyBlbmNvZGVkIHN0cmluZ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hcmUgbm8gbW9yZSBjb2RlIHBvaW50cyBsZWZ0IG9yIGEgc2luZ2xlIG51bWVyaWMgY29kZSBwb2ludC5cclxuICAgICAgICAgKiBAcGFyYW0geyFmdW5jdGlvbihudW1iZXIpfSBkc3QgQnl0ZXMgZGVzdGluYXRpb24gYXMgYSBmdW5jdGlvbiBzdWNjZXNzaXZlbHkgY2FsbGVkIHdpdGggdGhlIG5leHQgYnl0ZVxyXG4gICAgICAgICAqL1xyXG4gICAgICAgIHV0ZnguZW5jb2RlVVRGOCA9IGZ1bmN0aW9uKHNyYywgZHN0KSB7XHJcbiAgICAgICAgICAgIHZhciBjcCA9IG51bGw7XHJcbiAgICAgICAgICAgIGlmICh0eXBlb2Ygc3JjID09PSAnbnVtYmVyJylcclxuICAgICAgICAgICAgICAgIGNwID0gc3JjLFxyXG4gICAgICAgICAgICAgICAgc3JjID0gZnVuY3Rpb24oKSB7IHJldHVybiBudWxsOyB9O1xyXG4gICAgICAgICAgICB3aGlsZSAoY3AgIT09IG51bGwgfHwgKGNwID0gc3JjKCkpICE9PSBudWxsKSB7XHJcbiAgICAgICAgICAgICAgICBpZiAoY3AgPCAweDgwKVxyXG4gICAgICAgICAgICAgICAgICAgIGRzdChjcCYweDdGKTtcclxuICAgICAgICAgICAgICAgIGVsc2UgaWYgKGNwIDwgMHg4MDApXHJcbiAgICAgICAgICAgICAgICAgICAgZHN0KCgoY3A+PjYpJjB4MUYpfDB4QzApLFxyXG4gICAgICAgICAgICAgICAgICAgIGRzdCgoY3AmMHgzRil8MHg4MCk7XHJcbiAgICAgICAgICAgICAgICBlbHNlIGlmIChjcCA8IDB4MTAwMDApXHJcbiAgICAgICAgICAgICAgICAgICAgZHN0KCgoY3A+PjEyKSYweDBGKXwweEUwKSxcclxuICAgICAgICAgICAgICAgICAgICBkc3QoKChjcD4+NikmMHgzRil8MHg4MCksXHJcbiAgICAgICAgICAgICAgICAgICAgZHN0KChjcCYweDNGKXwweDgwKTtcclxuICAgICAgICAgICAg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W5nIGJ5dGVzLlxyXG4gICAgICAgICAqL1xyXG4gICAgICAgIHV0ZnguZGVjb2RlVVRGOCA9IGZ1bmN0aW9uKHNyYywgZHN0KSB7XHJcbiAgICAgICAgICAgIHZhciBhLCBiLCBjLCBkLCBmYWlsID0gZnVuY3Rpb24oYikge1xyXG4gICAgICAgICAgICAgICAgYiA9IGIuc2xpY2UoMCwgYi5pbmRleE9mKG51bGwpKTtcclxuICAgICAgICAgICAgICAgIHZhciBlcnIgPSBFcnJvcihiLnRvU3RyaW5nKCkpO1xyXG4gICAgICAgICAgICAgICAgZXJyLm5hbWUgPSBcIlRydW5jYXRlZEVycm9yXCI7XHJcbiAgICAgICAgICAgICAgICBlcnJbJ2J5dGVzJ10gPSBiO1xyXG4gICAgICAgICAgICAgICAgdGhyb3cgZXJyO1xyXG4gICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICB3aGlsZSAoKGEgPSBzcmMoKSkgIT09IG51bGwpIHtcclxuICAgICAgICAgICAgICAgIGlmICgoYSYweDgwKSA9PT0gMClcclxuICAgICAgICAgICAgICAgICAgICBkc3QoYSk7XHJcbiAgICAgICAgICAgICAgICBlbHNlIGlmICgoYSYweEUwKSA9PT0gMHhDMClcclxuICAgICAgICAgICAgICAgICAgICAoKGIgPSBzcmMoKSkgPT09IG51bGwpICYmIGZhaWwoW2EsIGJdKSxcclxuICAgICAgICAgICAgICAgICAgICBkc3QoKChhJjB4MUYpPDw2KSB8IChiJjB4M0YpKTtcclxuICAgICAgICAgICAgICAgIGVsc2UgaWYgKChhJjB4RjApID09PSAweEUwKVxyXG4gICAgICAgICAgICAgICAgICAgICgoYj1zcmMoKSkgPT09IG51bGwgfHwgKGM9c3JjKCkpID09PSBudWxsKSAmJiBmYWlsKFthLCBiLCBjXSksXHJcbiAgICAgICAgICAgICAgICAgICAgZHN0KCgoYSYweDBGKTw8MTIpIHwgKChiJjB4M0YpPDw2KSB8IChjJjB4M0YpKTtcclxuICAgICAgICAgICAgICAgIGVsc2U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cbiAgICAgICAgICAgIHdoaWxlICh0cnVlKSB7XHJcbiAgICAgICAgICAgICAgICBpZiAoKGMxID0gYzIgIT09IG51bGwgPyBjMiA6IHNyYygpKSA9PT0gbnVsbClcclxuICAgICAgICAgICAgICAgICAgICBicmVhaztcclxuICAgICAgICAgICAgICAgIGlmIChjMSA+PSAweEQ4MDAgJiYgYzEgPD0gMHhERkZGKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKChjMiA9IHNyYygpKSAhPT0gbnVsbCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoYzIgPj0gMHhEQzAwICYmIGMyIDw9IDB4REZGRikge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZHN0KChjMS0weEQ4MDApKjB4NDAwK2MyLTB4REMwMCsweDEwMDAwKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMyID0gbnVsbDsgY29udGludWU7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBkc3QoYzEpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmIChjMiAhPT0gbnVsbCkgZHN0KGMyKTtcclxuICAgICAgICB9O1xyXG5cclxuICAgICAgICAvKipcclxuICAgICAgICAgKiBDb252ZXJ0cyBVVEY4IGNvZGUgcG9pbnRzIHRvIFVURjE2IGNoYXJhY3RlcnMuXHJcbiAgICAgICAgICogQHBhcmFtIHsoIWZ1bmN0aW9uKCk6bnVtYmVyfG51bGwpIHwgbnVtYmVyfSBzcmMgQ29kZSBwb2ludHMgc291cmNlLCBlaXRoZXIgYXMgYSBmdW5jdGlvbiByZXR1cm5pbmcgdGhlIG5leHQgY29kZSBwb2ludFxyXG4gICAgICAgICAqICByZXNwZWN0aXZlbHkgYG51bGxgIGlmIHRoZXJlIGFyZSBubyBtb3JlIGNvZGUgcG9pbnRzIGxlZnQgb3IgYSBzaW5nbGUgbnVtZXJpYyBjb2RlIHBvaW50LlxyXG4gICAgICAgICAqIEBwYXJhbSB7IWZ1bmN0aW9uKG51bWJlcil9IGRzdCBDaGFyYWN0ZXJzIGRlc3RpbmF0aW9uIGFzIGEgZnVuY3Rpb24gc3VjY2Vzc2l2ZWx5IGNhbGxlZCB3aXRoIGVhY2ggY29udmVydGVkIGNoYXIgY29kZS5cclxuICAgICAgICAgKiBAdGhyb3dzIHtSYW5nZUVycm9yfSBJZiBhIGNvZGUgcG9pbnQgaXMgb3V0IG9mIHJhbmdlXHJcbiAgICAgICAgICovXHJcbiAgICAgICAgdXRmeC5VVEY4dG9VVEYxNiA9IGZ1bmN0aW9uKHNyYywgZHN0KSB7XHJcbiAgICAgICAgICAgIHZhciBjcCA9IG51bGw7XHJcbiAgICAgICAgICAgIGlmICh0eXBlb2Ygc3JjID09PSAnbnVtYmVyJylcclxuICAgICAgICAgICAgICAgIGNwID0gc3JjLCBzcmMgPSBmdW5jdGlvbigpIHsgcmV0dXJuIG51bGw7IH07XHJcbiAgICAgICAgICAgIHdoaWxlIChjcCAhPT0gbnVsbCB8fCAoY3AgPSBzcmMoKSkgIT09IG51bGwpIHtcclxuICAgICAgICAgICAgICAgIGlmIChjcCA8PSAweEZGRkYpXHJcbiAgICAgICAgICAgICAgICAgICAgZHN0KGNwKTtcclxuICAgICAgICAgICAgICAgIGVsc2VcclxuICAgICAgICAgICAgICAgICAgICBjcCAtPSAweDEwMDAwLFxyXG4gICAgICAgICAgICAgICAgICAgIGRzdCgoY3A+PjEwKSsweEQ4MDApLFxyXG4gICAgICAgICAgICAgICAgICAgIGRzdCgoY3AlMHg0MDApKzB4REMwMCk7XHJcbiAgICAgICAgICAgICAgICBjcCA9IG51bGw7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9O1xyXG5cclxuICAgICAgICAvKipcclxuICAgICAgICAgKiBDb252ZXJ0cyBhbmQgZW5jb2RlcyBVVEYxNiBjaGFyYWN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bWVudHMubGVuZ3RoID09PSAwKSB7XG4gICAgICAgICAgdGhpcy5fZXZlbnRzID0gb2JqZWN0Q3JlYXRlKG51bGwpO1xuICAgICAgICAgIHRoaXMuX2V2ZW50c0NvdW50ID0gMDtcbiAgICAgICAgfSBlbHNlIGlmIChldmVudHNbdHlwZV0pIHtcbiAgICAgICAgICBpZiAoLS10aGlzLl9ldmVudHNDb3VudCA9PT0gMClcbiAgICAgICAgICAgIHRoaXMuX2V2ZW50cyA9IG9iamVjdENyZWF0ZShudWxsKTtcbiAgICAgICAgICBlbHNlXG4gICAgICAgICAgICBkZWxldGUgZXZlbnRzW3R5cGVdO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiB0aGlzO1xuICAgICAgfVxuXG4gICAgICAvLyBlbWl0IHJlbW92ZUxpc3RlbmVyIGZvciBhbGwgbGlzdGVuZXJzIG9uIGFsbCBldmVudHNcbiAgICAgIGlmIChhcmd1bWVudHMubGVuZ3RoID09PSAwKSB7XG4gICAgICAgIHZhciBrZXlzID0gb2JqZWN0S2V5cyhldmVudHMpO1xuICAgICAgICB2YXIga2V5O1xuICAgICAgICBmb3IgKGkgPSAwOyBpIDwga2V5cy5sZW5ndGg7ICsraSkge1xuICAgICAgICAgIGtleSA9IGtleXNbaV07XG4gICAgICAgICAgaWYgKGtleSA9PT0gJ3JlbW92ZUxpc3RlbmVyJykgY29udGludWU7XG4gICAgICAgICAgdGhpcy5yZW1vdmVBbGxMaXN0ZW5lcnMoa2V5KTtcbiAgICAgICAgfVxuICAgICAgICB0aGlzLnJlbW92ZUFsbExpc3RlbmVycygncmVtb3ZlTGlzdGVuZXInKTtcbiAgICAgICAgdGhpcy5fZXZlbnRzID0gb2JqZWN0Q3JlYXRlKG51bGwpO1xuICAgICAgICB0aGlzLl9ldmVudHNDb3VudCA9IDA7XG4gICAgICAgIHJldHVybiB0aGlzO1xuICAgICAgfVxuXG4gICAgICBsaXN0ZW5lcnMgPSBldmVudHNbdHlwZV07XG5cbiAgICAg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V2ZXJzZSkge1xuICAgICAgdmFyIHRoaXMkMSQxID0gdGhpcztcblxuICAgICAgdmFyIGl0ZXJhdGlvbnMgPSAwO1xuICAgICAgdGhpcy5fcm9vdCAmJlxuICAgICAgICB0aGlzLl9yb290Lml0ZXJhdGUoZnVuY3Rpb24gKGVudHJ5KSB7XG4gICAgICAgICAgaXRlcmF0aW9ucysrO1xuICAgICAgICAgIHJldHVybiBmbihlbnRyeVsxXSwgZW50cnlbMF0sIHRoaXMkMSQxKTtcbiAgICAgICAgfSwgcmV2ZXJzZSk7XG4gICAgICByZXR1cm4gaXRlcmF0aW9ucztcbiAgICB9O1xuXG4gICAgTWFwLnByb3RvdHlwZS5fX2Vuc3VyZU93bmVyID0gZnVuY3Rpb24gX19lbnN1cmVPd25lciAob3duZXJJRCkge1xuICAgICAgaWYgKG93bmVySUQgPT09IHRoaXMuX19vd25lcklEKSB7XG4gICAgICAgIHJldHVybiB0aGlzO1xuICAgICAgfVxuICAgICAgaWYgKCFvd25lcklEKSB7XG4gICAgICAgIGlmICh0aGlzLnNpemUgPT09IDApIHtcbiAgICAgICAgICByZXR1cm4gZW1wdHlNYXAoKTtcbiAgICAgICAgfVxuICAgICAgICB0aGlzLl9fb3duZXJJRCA9IG93bmVySUQ7XG4gICAgICAgIHRoaXMuX19hbHRlcmVkID0gZmFsc2U7XG4gICAgICAgIHJldHVybiB0aGlzO1xuICAgICAgfVxuICAgICAgcmV0dXJuIG1ha2VNYXAodGhpcy5zaXplLCB0aGlzLl9yb290LCBvd25lcklELCB0aGlzLl9faGFzaCk7XG4gICAgfTtcblxuICAgIHJldHVybiBNYXA7XG4gIH0oS2V5ZWRDb2xsZWN0aW9uKSk7XG5cbiAgTWFwLmlzTWFwID0gaXNNYXA7XG5cbiAgdmFyIE1hcFByb3RvdHlwZSA9IE1hcC5wcm90b3R5cGU7XG4gIE1hcFByb3RvdHlwZVtJU19NQVBfU1lNQk9MXSA9IHRydWU7XG4gIE1hcFByb3RvdHlwZVtERUx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5kZXgpIHtcbiAgICAgICAgICAgIHJldHVybiBtYXBJdGVyYXRvclZhbHVlKFxuICAgICAgICAgICAgICB0eXBlLFxuICAgICAgICAgICAgICBub2RlLmVudHJpZXNbdGhpcy5fcmV2ZXJzZSA/IG1heEluZGV4IC0gaW5kZXggOiBpbmRleF1cbiAgICAgICAgICAgICk7XG4gICAgICAgICAgfVxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgIG1heEluZGV4ID0gbm9kZS5ub2Rlcy5sZW5ndGggLSAxO1xuICAgICAgICAgIGlmIChpbmRleCA8PSBtYXhJbmRleCkge1xuICAgICAgICAgICAgdmFyIHN1Yk5vZGUgPSBub2RlLm5vZGVzW3RoaXMuX3JldmVyc2UgPyBtYXhJbmRleCAtIGluZGV4IDogaW5kZXhdO1xuICAgICAgICAgICAgaWYgKHN1Yk5vZGUpIHtcbiAgICAgICAgICAgICAgaWYgKHN1Yk5vZGUuZW50cnkpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gbWFwSXRlcmF0b3JWYWx1ZSh0eXBlLCBzdWJOb2RlLmVudHJ5KTtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICBzdGFjayA9IHRoaXMuX3N0YWNrID0gbWFwSXRlcmF0b3JGcmFtZShzdWJOb2RlLCBzdGFjayk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBjb250aW51ZTtcbiAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgc3RhY2sgPSB0aGlzLl9zdGFjayA9IHRoaXMuX3N0YWNrLl9fcHJldjtcbiAgICAgIH1cbiAgICAgIHJldHVybiBpdGVyYXRvckRvbmUoKTtcbiAgICB9O1xuXG4gICAgcmV0dXJuIE1hcEl0ZXJhdG9yO1xuICB9KEl0ZXJhdG9yKSk7XG5cbiAgZnVuY3Rpb24gbWFwSXRlcmF0b3JWYWx1ZSh0eXBlLCBlbnRyeSkge1xuICAgIHJldHVybiBpdGVyYXRvclZhbHVlKHR5cGUsIGVudHJ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oaW5kZXggPj0gMCAmJiBpbmRleCA8IHRoaXMuc2l6ZSkge1xuICAgICAgICBpbmRleCArPSB0aGlzLl9vcmlnaW47XG4gICAgICAgIHZhciBub2RlID0gbGlzdE5vZGVGb3IodGhpcywgaW5kZXgpO1xuICAgICAgICByZXR1cm4gbm9kZSAmJiBub2RlLmFycmF5W2luZGV4ICYgTUFTS107XG4gICAgICB9XG4gICAgICByZXR1cm4gbm90U2V0VmFsdWU7XG4gICAgfTtcblxuICAgIC8vIEBwcmFnbWEgTW9kaWZpY2F0aW9uXG5cbiAgICBMaXN0LnByb3RvdHlwZS5zZXQgPSBmdW5jdGlvbiBzZXQgKGluZGV4LCB2YWx1ZSkge1xuICAgICAgcmV0dXJuIHVwZGF0ZUxpc3QodGhpcywgaW5kZXgsIHZhbHVlKTtcbiAgICB9O1xuXG4gICAgTGlzdC5wcm90b3R5cGUucmVtb3ZlID0gZnVuY3Rpb24gcmVtb3ZlIChpbmRleCkge1xuICAgICAgcmV0dXJuICF0aGlzLmhhcyhpbmRleClcbiAgICAgICAgPyB0aGlzXG4gICAgICAgIDogaW5kZXggPT09IDBcbiAgICAgICAgPyB0aGlzLnNoaWZ0KClcbiAgICAgICAgOiBpbmRleCA9PT0gdGhpcy5zaXplIC0gMVxuICAgICAgICA/IHRoaXMucG9wKClcbiAgICAgICAgOiB0aGlzLnNwbGljZShpbmRleCwgMSk7XG4gICAgfTtcblxuICAgIExpc3QucHJvdG90eXBlLmluc2VydCA9IGZ1bmN0aW9uIGluc2VydCAoaW5kZXgsIHZhbHVlKSB7XG4gICAgICByZXR1cm4gdGhpcy5zcGxpY2UoaW5kZXgsIDAsIHZhbHVlKTtcbiAgICB9O1xuXG4gICAgTGlzdC5wcm90b3R5cGUuY2xlYXIgPSBmdW5jdGlvbiBjbGVhciAoKSB7XG4gICAgICBpZiAodGhpcy5zaXplID09PSAwKSB7XG4gICAgICAgIHJldHVybiB0aGlzO1xuICAgICAgfVxuICAgICAgaWYgKHRoaXMuX19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KSAhPT0gRE9ORSkge1xuICAgICAgICBpZiAoZm4odmFsdWUsIHJldmVyc2UgPyAtLWluZGV4IDogaW5kZXgrKywgdGhpcykgPT09IGZhbHNlKSB7XG4gICAgICAgICAgYnJlYWs7XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICAgIHJldHVybiBpbmRleDtcbiAgICB9O1xuXG4gICAgTGlzdC5wcm90b3R5cGUuX19lbnN1cmVPd25lciA9IGZ1bmN0aW9uIF9fZW5zdXJlT3duZXIgKG93bmVySUQpIHtcbiAgICAgIGlmIChvd25lcklEID09PSB0aGlzLl9fb3duZXJJRCkge1xuICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgIH1cbiAgICAgIGlmICghb3duZXJJRCkge1xuICAgICAgICBpZiAodGhpcy5zaXplID09PSAwKSB7XG4gICAgICAgICAgcmV0dXJuIGVtcHR5TGlzdCgpO1xuICAgICAgICB9XG4gICAgICAgIHRoaXMuX19vd25lcklEID0gb3duZXJJRDtcbiAgICAgICAgdGhpcy5fX2FsdGVyZWQgPSBmYWxzZTtcbiAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgICB9XG4gICAgICByZXR1cm4gbWFrZUxpc3QoXG4gICAgICAgIHRoaXMuX29yaWdpbixcbiAgICAgICAgdGhpcy5fY2FwYWNpdHksXG4gICAgICAgIHRoaXMuX2xldmVsLFxuICAgICAgICB0aGlzLl9yb290LFxuICAgICAgICB0aGlzLl90YWlsLFxuICAgICAgICBvd25lcklELFxuICAgICAgICB0aGlzLl9faGFzaFxuICAgICAgKTtcbiAgICB9O1xuXG4gICAgcmV0dXJuIExpc3Q7XG4gIH0oSW5kZXhlZENvbGxlY3Rpb24pKTtcblxuICBMaXN0LmlzTGlzdCA9IGlzTGlzdDtcblxuICB2YXIgTGlzdFByb3RvdHlwZSA9IExpc3QucHJvdG90eXBlO1xuICBMaXN0UHJvdG90eXBlW0lTX0xJU1RfU1lNQk9MXSA9IHRydWU7XG4gIExpc3RQcm90b3R5cGVbREVMR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iBsZWZ0IC0gb2Zmc2V0O1xuICAgICAgdmFyIHRvID0gcmlnaHQgLSBvZmZzZXQ7XG4gICAgICBpZiAodG8gPiBTSVpFKSB7XG4gICAgICAgIHRvID0gU0laRTtcbiAgICAgIH1cbiAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7XG4gICAgICAgIGlmIChmcm9tID09PSB0bykge1xuICAgICAgICAgIHJldHVybiBET05FO1xuICAgICAgICB9XG4gICAgICAgIHZhciBpZHggPSByZXZlcnNlID8gLS10byA6IGZyb20rKztcbiAgICAgICAgcmV0dXJuIGFycmF5ICYmIGFycmF5W2lkeF07XG4gICAgICB9O1xuICAgIH1cblxuICAgIGZ1bmN0aW9uIGl0ZXJhdGVOb2RlKG5vZGUsIGxldmVsLCBvZmZzZXQpIHtcbiAgICAgIHZhciB2YWx1ZXM7XG4gICAgICB2YXIgYXJyYXkgPSBub2RlICYmIG5vZGUuYXJyYXk7XG4gICAgICB2YXIgZnJvbSA9IG9mZnNldCA+IGxlZnQgPyAwIDogKGxlZnQgLSBvZmZzZXQpID4+IGxldmVsO1xuICAgICAgdmFyIHRvID0gKChyaWdodCAtIG9mZnNldCkgPj4gbGV2ZWwpICsgMTtcbiAgICAgIGlmICh0byA+IFNJWkUpIHtcbiAgICAgICAgdG8gPSBTSVpFO1xuICAgICAgfVxuICAgICAgcmV0dXJuIGZ1bmN0aW9uICgpIHtcbiAgICAgICAgd2hpbGUgKHRydWUpIHtcbiAgICAgICAgICBpZiAodmFsdWVzKSB7XG4gICAgICAgICAgICB2YXIgdmFsdWUgPSB2YWx1ZXMoKTtcbiAgICAgICAgICAgIGlmICh2YWx1ZSAhPT0gRE9ORSkge1xuICAgICAgICAgICAgICByZXR1cm4gdmFsdWU7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB2YWx1ZXMgPSBudWxsO1xuICAgICAgICAgIH1cbiAgICAgICAgICBpZiAoZnJvbSA9PT0gdG8pIHtcbiAgICAgICAgICAgIHJldHVybiBET05FO1x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tcbiAgICAgIGlmIChpdGVyLnNpemUgPT09IDApIHtcbiAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgICB9XG4gICAgICBpZiAodGhpcy5zaXplID09PSAwICYmIGlzU3RhY2soaXRlcikpIHtcbiAgICAgICAgcmV0dXJuIGl0ZXI7XG4gICAgICB9XG4gICAgICBhc3NlcnROb3RJbmZpbml0ZShpdGVyLnNpemUpO1xuICAgICAgdmFyIG5ld1NpemUgPSB0aGlzLnNpemU7XG4gICAgICB2YXIgaGVhZCA9IHRoaXMuX2hlYWQ7XG4gICAgICBpdGVyLl9faXRlcmF0ZShmdW5jdGlvbiAodmFsdWUpIHtcbiAgICAgICAgbmV3U2l6ZSsrO1xuICAgICAgICBoZWFkID0ge1xuICAgICAgICAgIHZhbHVlOiB2YWx1ZSxcbiAgICAgICAgICBuZXh0OiBoZWFkLFxuICAgICAgICB9O1xuICAgICAgfSwgLyogcmV2ZXJzZSAqLyB0cnVlKTtcbiAgICAgIGlmICh0aGlzLl9fb3duZXJJRCkge1xuICAgICAgICB0aGlzLnNpemUgPSBuZXdTaXplO1xuICAgICAgICB0aGlzLl9oZWFkID0gaGVhZDtcbiAgICAgICAgdGhpcy5fX2hhc2ggPSB1bmRlZmluZWQ7XG4gICAgICAgIHRoaXMuX19hbHRlcmVkID0gdHJ1ZTtcbiAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgICB9XG4gICAgICByZXR1cm4gbWFrZVN0YWNrKG5ld1NpemUsIGhlYWQpO1xuICAgIH07XG5cbiAgICBTdGFjay5wcm90b3R5cGUucG9wID0gZnVuY3Rpb24gcG9wICgpIHtcbiAgICAgIHJldHVybiB0aGlzLnNsaWNlKDEpO1xuICAgIH07XG5cbiAgICBTdGFjay5wcm90b3R5cGUuY2xlYXIgPSBmdW5jdGlvbiBjbGVhciAoKSB7XG4gICAgICBpZiAodGhpcy5zaXplID09PSAwKSB7XG4gICAgICAgIHJldHVybiB0aGlzO1xuICAgICAgfVxuICAgICAgaWYg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5jdGlvbiAodiwgaykgeyByZXR1cm4gZm4odiwgaywgdGhpcyQxJDEpOyB9LFxuICAgICAgICAgIHJldmVyc2VcbiAgICAgICAgKTtcbiAgICAgIH1cbiAgICAgIHZhciBpdGVyYXRpb25zID0gMDtcbiAgICAgIHZhciBub2RlID0gdGhpcy5faGVhZDtcbiAgICAgIHdoaWxlIChub2RlKSB7XG4gICAgICAgIGlmIChmbihub2RlLnZhbHVlLCBpdGVyYXRpb25zKyssIHRoaXMpID09PSBmYWxzZSkge1xuICAgICAgICAgIGJyZWFrO1xuICAgICAgICB9XG4gICAgICAgIG5vZGUgPSBub2RlLm5leHQ7XG4gICAgICB9XG4gICAgICByZXR1cm4gaXRlcmF0aW9ucztcbiAgICB9O1xuXG4gICAgU3RhY2sucHJvdG90eXBlLl9faXRlcmF0b3IgPSBmdW5jdGlvbiBfX2l0ZXJhdG9yICh0eXBlLCByZXZlcnNlKSB7XG4gICAgICBpZiAocmV2ZXJzZSkge1xuICAgICAgICByZXR1cm4gbmV3IEFycmF5U2VxKHRoaXMudG9BcnJheSgpKS5fX2l0ZXJhdG9yKHR5cGUsIHJldmVyc2UpO1xuICAgICAgfVxuICAgICAgdmFyIGl0ZXJhdGlvbnMgPSAwO1xuICAgICAgdmFyIG5vZGUgPSB0aGlzLl9oZWFkO1xuICAgICAgcmV0dXJuIG5ldyBJdGVyYXRvcihmdW5jdGlvbiAoKSB7XG4gICAgICAgIGlmIChub2RlKSB7XG4gICAgICAgICAgdmFyIHZhbHVlID0gbm9kZS52YWx1ZTtcbiAgICAgICAgICBub2RlID0gbm9kZS5uZXh0O1xuICAgICAgICAgIHJldHVybiBpdGVyYXRvclZhbHVlKHR5cGUsIGl0ZXJhdGlvbnMrKywgdmFsdWUpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiBpdGVyYXRvckRvbmUoKTtcbiAgICAgIH0pO1xuICAgIH07XG5cbiAgICByZXR1cm4gU3RhY2s7XG4gIH0oSW5kZXhlZENvbGxlY3R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tZW50cyk7XG4gIH1cblxuICBmdW5jdGlvbiBkZWZhdWx0TmVnQ29tcGFyYXRvcihhLCBiKSB7XG4gICAgcmV0dXJuIGEgPCBiID8gMSA6IGEgPiBiID8gLTEgOiAwO1xuICB9XG5cbiAgZnVuY3Rpb24gaGFzaENvbGxlY3Rpb24oY29sbGVjdGlvbikge1xuICAgIGlmIChjb2xsZWN0aW9uLnNpemUgPT09IEluZmluaXR5KSB7XG4gICAgICByZXR1cm4gMDtcbiAgICB9XG4gICAgdmFyIG9yZGVyZWQgPSBpc09yZGVyZWQoY29sbGVjdGlvbik7XG4gICAgdmFyIGtleWVkID0gaXNLZXllZChjb2xsZWN0aW9uKTtcbiAgICB2YXIgaCA9IG9yZGVyZWQgPyAxIDogMDtcbiAgICB2YXIgc2l6ZSA9IGNvbGxlY3Rpb24uX19pdGVyYXRlKFxuICAgICAga2V5ZWRcbiAgICAgICAgPyBvcmRlcmVkXG4gICAgICAgICAgPyBmdW5jdGlvbiAodiwgaykge1xuICAgICAgICAgICAgICBoID0gKDMxICogaCArIGhhc2hNZXJnZShoYXNoKHYpLCBoYXNoKGspKSkgfCAwO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIDogZnVuY3Rpb24gKHYsIGspIHtcbiAgICAgICAgICAgICAgaCA9IChoICsgaGFzaE1lcmdlKGhhc2godiksIGhhc2goaykpKSB8IDA7XG4gICAgICAgICAgICB9XG4gICAgICAgIDogb3JkZXJlZFxuICAgICAgICA/IGZ1bmN0aW9uICh2KSB7XG4gICAgICAgICAgICBoID0gKDMxICogaCArIGhhc2godikpIHwgMDtcbiAgICAgICAgICB9XG4gICAgICAgIDogZnVuY3Rpb24gKHYpIHtcbiAgICAgICAgICAgIGggPSAoaCArIGhhc2godikpIHwgMDtcbiAgICAgICAgICB9XG4gICAgKTtcbiAgICByZXR1cm4gbXVybXVySGFzaE9mU2l6ZShzaXplLCBoKTtcbiAgfVxuXG4gIGZ1bmN0aW9uIG11cm11ckhhc2hPZlNpemUo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JuKFxuICAgICAgICAgICAgICAgICdDYW5ub3QgZGVmaW5lICcgK1xuICAgICAgICAgICAgICAgICAgcmVjb3JkTmFtZSh0aGlzKSArXG4gICAgICAgICAgICAgICAgICAnIHdpdGggcHJvcGVydHkgXCInICtcbiAgICAgICAgICAgICAgICAgIHByb3BOYW1lICtcbiAgICAgICAgICAgICAgICAgICdcIiBzaW5jZSB0aGF0IHByb3BlcnR5IG5hbWUgaXMgcGFydCBvZiB0aGUgUmVjb3JkIEFQSS4nXG4gICAgICAgICAgICAgICk7XG4gICAgICAgICAgICAvKiBlc2xpbnQtZW5hYmxlIG5vLWNvbnNvbGUgKi9cbiAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgc2V0UHJvcChSZWNvcmRUeXBlUHJvdG90eXBlLCBwcm9wTmFtZSk7XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICB9XG4gICAgICB0aGlzLl9fb3duZXJJRCA9IHVuZGVmaW5lZDtcbiAgICAgIHRoaXMuX3ZhbHVlcyA9IExpc3QoKS53aXRoTXV0YXRpb25zKGZ1bmN0aW9uIChsKSB7XG4gICAgICAgIGwuc2V0U2l6ZSh0aGlzJDEkMS5fa2V5cy5sZW5ndGgpO1xuICAgICAgICBLZXllZENvbGxlY3Rpb24odmFsdWVzKS5mb3JFYWNoKGZ1bmN0aW9uICh2LCBrKSB7XG4gICAgICAgICAgbC5zZXQodGhpcyQxJDEuX2luZGljZXNba10sIHYgPT09IHRoaXMkMSQxLl9kZWZhdWx0VmFsdWVzW2tdID8gdW5kZWZpbmVkIDogdik7XG4gICAgICAgIH0pO1xuICAgICAgfSk7XG4gICAgICByZXR1cm4gdGhpcztcbiAgICB9O1xuXG4gICAgdmFyIFJlY29yZFR5cGVQcm90b3R5cGUgPSAoUmVjb3JkVHlwZS5wcm90b3R5cGUgPVxuICAgICAgT2JqZWN0LmNyZWF0ZShSZWNvcmRQcm90b3R5cGUpKTtcbiAgICBSZWNvcmRUeXBlUHJvdG90eX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ZTtcblxuICAgIHJldHVybiBfcmVnZW5lcmF0b3JSdW50aW1lLndyYXAoZnVuY3Rpb24gX2NhbGxlZSQoX2NvbnRleHQpIHtcbiAgICAgIHdoaWxlICgxKSB7XG4gICAgICAgIHN3aXRjaCAoX2NvbnRleHQucHJldiA9IF9jb250ZXh0Lm5leHQpIHtcbiAgICAgICAgICBjYXNlIDA6XG4gICAgICAgICAgICBzaXplID0gX3JlZi5zaXplO1xuICAgICAgICAgICAgaSA9IDA7XG4gICAgICAgICAgICBfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uID0gdHJ1ZTtcbiAgICAgICAgICAgIF9kaWRJdGVyYXRvckVycm9yID0gZmFsc2U7XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gNDtcbiAgICAgICAgICAgIF9pdGVyYXRvciA9IF9hc3luY0l0ZXJhdG9yKHNvdXJjZSk7XG5cbiAgICAgICAgICBjYXNlIDY6XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gODtcbiAgICAgICAgICAgIHJldHVybiBfYXdhaXRBc3luY0dlbmVyYXRvcihfaXRlcmF0b3IubmV4dCgpKTtcblxuICAgICAgICAgIGNhc2UgODpcbiAgICAgICAgICAgIF9zdGVwID0gX2NvbnRleHQuc2VudDtcbiAgICAgICAgICAgIF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gPSBfc3RlcC5kb25lO1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDEyO1xuICAgICAgICAgICAgcmV0dXJuIF9hd2FpdEFzeW5jR2VuZXJhdG9yKF9zdGVwLnZhbHVlKTtcblxuICAgICAgICAgIGNhc2UgMTI6XG4gICAgICAgICAgICBfdmFsdWUgPSBfY29udGV4dC5zZW50O1xuXG4gICAgICAgICAgICBpZiAoX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbikge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMjU7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB2YWx1ZSA9IF92YWx1ZTtcblxuICAgICAgICAgICAgaWYgKCEoaSA9PT0gc2l6ZSkpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDE5O1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDE4O1xuICAgICAgICAgICAgcmV0dXJuIHNwbGl0O1xuXG4gICAgICAgICAgY2FzZSAxODpcbiAgICAgICAgICAgIGkgPSAwO1xuXG4gICAgICAgICAgY2FzZSAxOTpcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyMTtcbiAgICAgICAgICAgIHJldHVybiB2YWx1ZTtcblxuICAgICAgICAgIGNhc2UgMjE6XG4gICAgICAgICAgICBpKys7XG5cbiAgICAgICAgICBjYXNlIDIyOlxuICAgICAgICAgICAgX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiA9IHRydWU7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gNjtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSAyNTpcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAzMTtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSAyNzpcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAyNztcbiAgICAgICAgICAgIF9jb250ZXh0LnQwID0gX2NvbnRleHRbXCJjYXRjaFwiXSg0KTtcbiAgICAgICAgICAgIF9kaWRJdGVyYXRvckVycm9yID0gdHJ1ZTtcbiAgICAgICAgICAgIF9pdGVyYXRvckVycm9yID0gX2NvbnRleHQudDA7XG5cbiAgICAgICAgICBjYXNlIDMxOlxuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDMxO1xuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDMyO1xuXG4gICAgICAgICAgICBpZiAoISghX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiAmJiBfaXRlcmF0b3JbXCJyZXR1cm5cIl0gIT0gbnVsbCkpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDM2O1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDM2O1xuICAgICAgICAgICAgcmV0dXJuIF9hd2FpdEFzeW5jR2VuZXJhdG9yKF9pdGVyYXRvcltcInJldHVyblwiXSgpKTtcblxuICAgICAgICAgIGNhc2UgMzY6XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMzY7XG5cbiAgICAgICAgICAgIGlmICghX2RpZEl0ZXJhdG9yRXJyb3IpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDM5O1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdGhyb3cgX2l0ZXJhdG9yRXJyb3I7XG5cbiAgICAgICAgICBjYXNlIDM5OlxuICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0LmZpbmlzaCgzNik7XG5cbiAgICAgICAgICBjYXNlIDQwOlxuICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0LmZpbmlzaCgzMSk7XG5cbiAgICAgICAgICBjYXNlIDQxOlxuICAgICAgICAgIGNhc2UgXCJlbmRcIjpcbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dC5zdG9wKCk7XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICB9LCBfY2FsbGVlLCBudWxsLCBbWzQsIDI3LCAzMSwgNDFdLCBbMzIsLCAzNiwgNDBdXSk7XG4gIH0pKTtcbiAgcmV0dXJuIF9hc3luY0JhdGNoU3BsaXRlcmF0b3IuYXBwbHkodGhpcywgYXJndW1lbnRzKTtcbn1cblxuZnVuY3Rpb24gX19hc3luY0JhdGNoKHNvdXJjZSwgc2l6ZSkge1xuICByZXR1cm4gX19hc3luY1Nw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yKHNwbGl0LCBfcmVmLCBzb3VyY2UpIHtcbiAgdmFyIHNpemUsIGksIF9pdGVyYXRvciwgX3N0ZXAsIHZhbHVlO1xuXG4gIHJldHVybiBfcmVnZW5lcmF0b3JSdW50aW1lLndyYXAoZnVuY3Rpb24gYmF0Y2hTcGxpdGVyYXRvciQoX2NvbnRleHQpIHtcbiAgICB3aGlsZSAoMSkge1xuICAgICAgc3dpdGNoIChfY29udGV4dC5wcmV2ID0gX2NvbnRleHQubmV4dCkge1xuICAgICAgICBjYXNlIDA6XG4gICAgICAgICAgc2l6ZSA9IF9yZWYuc2l6ZTtcbiAgICAgICAgICBpID0gMDtcbiAgICAgICAgICBfaXRlcmF0b3IgPSBfY3JlYXRlRm9yT2ZJdGVyYXRvckhlbHBlcihzb3VyY2UpO1xuICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAzO1xuXG4gICAgICAgICAgX2l0ZXJhdG9yLnMoKTtcblxuICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgaWYgKChfc3RlcCA9IF9pdGVyYXRvci5uKCkpLmRvbmUpIHtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxNjtcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIHZhbHVlID0gX3N0ZXAudmFsdWU7XG5cbiAgICAgICAgICBpZiAoIShpID09PSBzaXplKSkge1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDExO1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgX2NvbnRleHQubmV4dCA9IDEwO1xuICAgICAgICAgIHJldHVybiBzcGxpdDtcblxuICAgICAgICBjYXNlIDEwOlxuICAgICAgICAgIGkgPSAwO1xuXG4gICAgICAgIGNhc2UgMTE6XG4gICAgICAgICAgX2NvbnRleHQubmV4dCA9IDEzO1xuICAgICAgICAgIHJldHVybiB2YWx1ZTtcblxuICAgICAgICBjYXNlIDEzOlxuICAgICAgICAg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uICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgIF9jb250ZXh0LnQwID0gX2NvbnRleHQuc2VudDtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA4O1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICBjYXNlIDc6XG4gICAgICAgICAgICBfY29udGV4dC50MCA9IHNvdXJjZTtcblxuICAgICAgICAgIGNhc2UgODpcbiAgICAgICAgICAgIF9zb3VyY2UgPSBfY29udGV4dC50MDtcbiAgICAgICAgICAgIGlkeCA9IGF0IDwgMCA/IF9zb3VyY2UubGVuZ3RoICsgYXQgOiBhdDtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxMjtcbiAgICAgICAgICAgIHJldHVybiBfYXdhaXRBc3luY0dlbmVyYXRvcihfX2FzeW5jUGVla2VyYXRlKF9zb3VyY2UpKTtcblxuICAgICAgICAgIGNhc2UgMTI6XG4gICAgICAgICAgICBwZWVrciA9IF9jb250ZXh0LnNlbnQ7XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMTM7XG5cbiAgICAgICAgICBjYXNlIDE0OlxuICAgICAgICAgICAgaWYgKHBlZWtyLmRvbmUpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDI0O1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgaWYgKCEocGVla3IuaW5kZXggPT09IGlkeCkpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDE4O1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDE4O1xuICAgICAgICAgICAgcmV0dXJuIHNwbGl0O1xuXG4gICAgICAgICAgY2FzZSAxODpcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyMDtcbiAgICAgICAgICAgIHJldHVybiBwZWVrci52YWx1ZTtcblxuICAgICAgICAgIG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gX2F3YWl0QXN5bmNHZW5lcmF0b3IoX3N0ZXAudmFsdWUpO1xuXG4gICAgICAgICAgY2FzZSAxMzpcbiAgICAgICAgICAgIF92YWx1ZSA9IF9jb250ZXh0Mi5zZW50O1xuXG4gICAgICAgICAgICBpZiAoX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbikge1xuICAgICAgICAgICAgICBfY29udGV4dDIubmV4dCA9IDMwO1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdmFsdWUgPSBfdmFsdWU7XG4gICAgICAgICAgICBfY29udGV4dDIudDAgPSAhc3BsYXQ7XG5cbiAgICAgICAgICAgIGlmICghX2NvbnRleHQyLnQwKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Mi5uZXh0ID0gMjE7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBfY29udGV4dDIubmV4dCA9IDIwO1xuICAgICAgICAgICAgcmV0dXJuIF9hd2FpdEFzeW5jR2VuZXJhdG9yKHByZWRpY2F0ZSh2YWx1ZSwgaSsrKSk7XG5cbiAgICAgICAgICBjYXNlIDIwOlxuICAgICAgICAgICAgX2NvbnRleHQyLnQwID0gX2NvbnRleHQyLnNlbnQ7XG5cbiAgICAgICAgICBjYXNlIDIxOlxuICAgICAgICAgICAgaWYgKCFfY29udGV4dDIudDApIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQyLm5leHQgPSAyNTtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIF9jb250ZXh0Mi5uZXh0ID0gMjQ7XG4gICAgICAgICAgICByZXR1cm4gc3BsaXQ7XG5cbiAgICAgICAgICBjYXNlIDI0OlxuICAgICAgICAgICAgc3BsYXQgPSB0cnVlO1xuXG4gICAgICAgICAgY2FzZSAyNTpcbiAgICAgICAgICAgIF9jb250ZXh0Mi5uZXh0ID0gMjc7XG4gICAgICAgICAgICByZXR1cm4gdmFsdWU7XG5cbiAgICAgICAgICBjYXNlIDI3OlxuICAgICAgICAgICAgX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiA9IHRydWU7XG4gICAgICAgICAgICBfY29udGV4dDIubmV4dCA9IDc7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgIGNhc2UgMzA6XG4gICAgICAgICAgICBfY29udGV4dDIubmV4dCA9IDM2O1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICBjYXNlIDMyOlxuICAgICAgICAgICAgX2NvbnRleHQyLnByZXYgPSAzMjtcbiAgICAgICAgICAgIF9jb250ZXh0Mi50MSA9IF9jb250ZXh0MltcImNhdGNoXCJdKDUpO1xuICAgICAgICAgICAgX2RpZEl0ZXJhdG9yRXJyb3IgPSB0cnVlO1xuICAgICAgICAgICAgX2l0ZXJhdG9yRXJyb3IgPSBfY29udGV4dDIudDE7XG5cbiAgICAgICAgICBjYXNlIDM2OlxuICAgICAgICAgICAgX2NvbnRleHQyLnByZXYgPSAzNjtcbiAgICAgICAgICAgIF9jb250ZXh0Mi5wcmV2ID0gMzc7XG5cbiAgICAgICAgICAgIGlmICghKCFfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uICYmIF9pdGVyYXRvcltcInJldHVyblwiXSAhPSBudWxsKSkge1xuICAgICAgICAgICAgICBfY29udGV4dDIubmV4dCA9IDQxO1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgX2NvbnRleHQyLm5leHQgPSA0MTtcbiAgICAgICAgICAgIHJldHVybiBfYXdhaXRBc3luY0dlbmVyYXRvcihfaXRlcmF0b3JbXCJyZXR1cm5cIl0oKSk7XG5cbiAgICAgICAgICBjYXNlIDQxOlxuICAgICAgICAgICAgX2NvbnRleHQyLnByZXYgPSA0MTtcblxuICAgICAgICAgICAgaWYgKCFfZGlkSXRlcmF0b3JFcnJvcikge1xuICAgICAgICAgICAgIC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pdGNoIChfY29udGV4dC5wcmV2ID0gX2NvbnRleHQubmV4dCkge1xuICAgICAgICBjYXNlIDA6XG4gICAgICAgICAgYXQgPSBfcmVmLmF0O1xuICAgICAgICAgIF9zb3VyY2UgPSBhdCA8IDAgPyBfX3RvQXJyYXkoc291cmNlKSA6IHNvdXJjZTtcbiAgICAgICAgICBpZHggPSBhdCA8IDAgPyBfc291cmNlLmxlbmd0aCArIGF0IDogYXQ7XG4gICAgICAgICAgcGVla3IgPSBfX3BlZWtlcmF0ZShfc291cmNlKTtcbiAgICAgICAgICBfY29udGV4dC5wcmV2ID0gNDtcblxuICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgaWYgKHBlZWtyLmRvbmUpIHtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxNDtcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIGlmICghKHBlZWtyLmluZGV4ID09PSBpZHgpKSB7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gOTtcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA5O1xuICAgICAgICAgIHJldHVybiBzcGxpdDtcblxuICAgICAgICBjYXNlIDk6XG4gICAgICAgICAgX2NvbnRleHQubmV4dCA9IDExO1xuICAgICAgICAgIHJldHVybiBwZWVrci52YWx1ZTtcblxuICAgICAgICBjYXNlIDExOlxuICAgICAgICAgIHBlZWtyLmFkdmFuY2UoKTtcbiAgICAgICAgICBfY29udGV4dC5uZXh0ID0gNTtcbiAgICAgICAgICBicmVhaztcblxuICAgICAgICBjYXNlIDE0OlxuICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAxNDtcbiAgICAgICAgICBwZWVrcltcInJldHVyblwiXSgpO1xuICAgICAgICAgIHJldHVybiBfY29udGV4dC5maW5pc2goMTQpO1xuXG4gICAgICAgIGNhc2UgMTc6XG4gICAgICAgIGNhc2UgXCJl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ICBfY29udGV4dDIubmV4dCA9IDEyO1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgX2NvbnRleHQyLm5leHQgPSAxMTtcbiAgICAgICAgICByZXR1cm4gc3BsaXQ7XG5cbiAgICAgICAgY2FzZSAxMTpcbiAgICAgICAgICBzcGxhdCA9IHRydWU7XG5cbiAgICAgICAgY2FzZSAxMjpcbiAgICAgICAgICBfY29udGV4dDIubmV4dCA9IDE0O1xuICAgICAgICAgIHJldHVybiB2YWx1ZTtcblxuICAgICAgICBjYXNlIDE0OlxuICAgICAgICAgIF9jb250ZXh0Mi5uZXh0ID0gNjtcbiAgICAgICAgICBicmVhaztcblxuICAgICAgICBjYXNlIDE2OlxuICAgICAgICAgIF9jb250ZXh0Mi5uZXh0ID0gMjE7XG4gICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgY2FzZSAxODpcbiAgICAgICAgICBfY29udGV4dDIucHJldiA9IDE4O1xuICAgICAgICAgIF9jb250ZXh0Mi50MCA9IF9jb250ZXh0MltcImNhdGNoXCJdKDQpO1xuXG4gICAgICAgICAgX2l0ZXJhdG9yLmUoX2NvbnRleHQyLnQwKTtcblxuICAgICAgICBjYXNlIDIxOlxuICAgICAgICAgIF9jb250ZXh0Mi5wcmV2ID0gMjE7XG5cbiAgICAgICAgICBfaXRlcmF0b3IuZigpO1xuXG4gICAgICAgICAgcmV0dXJuIF9jb250ZXh0Mi5maW5pc2goMjEpO1xuXG4gICAgICAgIGNhc2UgMjQ6XG4gICAgICAgIGNhc2UgXCJlbmRcIjpcbiAgICAgICAgICByZXR1cm4gX2NvbnRleHQyLnN0b3AoKTtcbiAgICAgIH1cbiAgICB9XG4gIH0sIF9tYXJrZWQyLCBudWxsLCBbWzQsIDE4LCAyMSwgMjRdXSk7XG59XG5cbmV4cG9ydHMuY29uZGl0aW9uU3RyYXRlZ3kgPSBjb25kaXRpb25TdHJhdGVneTtcblxuZnVuY3Rpb24gX19iaXNlY3Q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NCeUNvbXBhcmlzb24oX3gsIF94Mikge1xuICByZXR1cm4gX2FzeW5jQnlDb21wYXJpc29uLmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7XG59XG5cbmZ1bmN0aW9uIF9hc3luY0J5Q29tcGFyaXNvbigpIHtcbiAgX2FzeW5jQnlDb21wYXJpc29uID0gX3dyYXBBc3luY0dlbmVyYXRvciggLyojX19QVVJFX18qL19yZWdlbmVyYXRvclJ1bnRpbWUubWFyayhmdW5jdGlvbiBfY2FsbGVlKF9yZWYsIGFsbCkge1xuICAgIHZhciBjb21wYXJlLFxuICAgICAgICBjYW5kaWRhdGUsXG4gICAgICAgIF9sZW4sXG4gICAgICAgIHBlZWtycyxcbiAgICAgICAgX2tleSxcbiAgICAgICAgX2l0ZXJhdG9yLFxuICAgICAgICBfc3RlcCxcbiAgICAgICAgcGVla3IsXG4gICAgICAgIF9hcmdzID0gYXJndW1lbnRzO1xuXG4gICAgcmV0dXJuIF9yZWdlbmVyYXRvclJ1bnRpbWUud3JhcChmdW5jdGlvbiBfY2FsbGVlJChfY29udGV4dCkge1xuICAgICAgd2hpbGUgKDEpIHtcbiAgICAgICAgc3dpdGNoIChfY29udGV4dC5wcmV2ID0gX2NvbnRleHQubmV4dCkge1xuICAgICAgICAgIGNhc2UgMDpcbiAgICAgICAgICAgIGNvbXBhcmUgPSBfcmVmLmNvbXBhcmU7XG5cbiAgICAgICAgICAgIGZvciAoX2xlbiA9IF9hcmdzLmxlbmd0aCwgcGVla3JzID0gbmV3IEFycmF5KF9sZW4gPiAyID8gX2xlbiAtIDIgOiAwKSwgX2tleSA9IDI7IF9rZXkgPCBfbGVuOyBfa2V5KyspIHtcbiAgICAgICAgICAgICAgcGVla3JzW19rZXkgLSAyXSA9IF9hcmdzW19rZXldO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgaWYgKGFsbC5kb25lKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxMjtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGNhbmRpZGF0ZSA9IGFsbC52YWx1ZTtcbiAgICAgICAgICAgIF9pdGVyYXRvciA9IF9jcmVhdGVGb3JPZkl0ZXJhdG9ySGVscGVyKHBlZWtycyk7XG5cbiAgICAgICAgICAgIHRyeSB7XG4gICAgICAgICAgICAgIGZvciAoX2l0ZXJhdG9yLnMoKTsgIShfc3RlcCA9IF9pdGVyYXRvci5uKCkpLmRvbmU7KSB7XG4gICAgICAgICAgICAgICAgcGVla3IgPSBfc3RlcC52YWx1ZTtcblxuICAgICAgICAgICAgICAgIGlmICghcGVla3IuZG9uZSAmJiBjb21wYXJlKHBlZWtyLnZhbHVlLCBjYW5kaWRhdGUudmFsdWUpIDwgMCkge1xuICAgICAgICAgICAgICAgICAgY2FuZGlkYXRlID0gcGVla3I7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9IGNhdGNoIChlcnIpIHtcbiAgICAgICAgICAgICAgX2l0ZXJhdG9yLmUoZXJyKTtcbiAgICAgICAgICAgIH0gZmluYWxseSB7XG4gICAgICAgICAgICAgIF9pdGVyYXRvci5mKCk7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA4O1xuICAgICAgICAgICAgcmV0dXJuIGNhbmRpZGF0ZS52YWx1ZTtcblxuICAgICAgICAgIGNhc2UgODpcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxMDtcbiAgICAgICAgICAgIHJldHVybiBfYXdhaXRBc3luY0dlbmVyYXRvcihjYW5kaWRhdGUuYWR2YW5jZSgpKTtcblxuICAgICAgICAgIGNhc2UgMTA6XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMjtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSAxMjpcbiAgICAgICAgICBjYXNlIFw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GVyYXRvci5uKCkpLmRvbmU7KSB7XG4gICAgICAgICAgICAgIHBlZWtyID0gX3N0ZXAudmFsdWU7XG5cbiAgICAgICAgICAgICAgaWYgKCFwZWVrci5kb25lICYmIGNvbXBhcmUocGVla3IudmFsdWUsIGNhbmRpZGF0ZS52YWx1ZSkgPCAwKSB7XG4gICAgICAgICAgICAgICAgY2FuZGlkYXRlID0gcGVla3I7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9IGNhdGNoIChlcnIpIHtcbiAgICAgICAgICAgIF9pdGVyYXRvci5lKGVycik7XG4gICAgICAgICAgfSBmaW5hbGx5IHtcbiAgICAgICAgICAgIF9pdGVyYXRvci5mKCk7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgX2NvbnRleHQubmV4dCA9IDg7XG4gICAgICAgICAgcmV0dXJuIGNhbmRpZGF0ZS52YWx1ZTtcblxuICAgICAgICBjYXNlIDg6XG4gICAgICAgICAgY2FuZGlkYXRlLmFkdmFuY2UoKTtcbiAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMjtcbiAgICAgICAgICBicmVhaztcblxuICAgICAgICBjYXNlIDExOlxuICAgICAgICBjYXNlIFwiZW5kXCI6XG4gICAgICAgICAgcmV0dXJuIF9jb250ZXh0LnN0b3AoKTtcbiAgICAgIH1cbiAgICB9XG4gIH0sIF9tYXJrZWQpO1xufVxuXG5mdW5jdGlvbiBfX2NvbGxhdGUoc291cmNlcywgY29tcGFyZSkge1xuICByZXR1cm4gX19pbnRlcmxlYXZlKHNvdXJjZXMsIGJ5Q29tcGFyaXNvbiwge1xuICAgIGNvbXBhcmU6IGNvbXBhcmVcbiAgfSk7XG59XG5cbmV4cG9ydHMuX19jb2xsYXRlID0gX19jb2xsYXRlO1xudmFyIGNvbGxhdGUgPSAvKiNfX1BVUkVfXyovaXRlcmFibGVDdXJyeShfX2NvbGxhdGUsIHtcbiAgdmFyaWFkaWM6IHRydWVcbn0pO1xuZXhwb3J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gPSBhcmd1bWVudHM7XG5cbiAgICByZXR1cm4gX3JlZ2VuZXJhdG9yUnVudGltZS53cmFwKGZ1bmN0aW9uIF9jYWxsZWUkKF9jb250ZXh0KSB7XG4gICAgICB3aGlsZSAoMSkge1xuICAgICAgICBzd2l0Y2ggKF9jb250ZXh0LnByZXYgPSBfY29udGV4dC5uZXh0KSB7XG4gICAgICAgICAgY2FzZSAwOlxuICAgICAgICAgICAgZm9yIChfbGVuID0gX2FyZ3MubGVuZ3RoLCBzb3VyY2VzID0gbmV3IEFycmF5KF9sZW4pLCBfa2V5ID0gMDsgX2tleSA8IF9sZW47IF9rZXkrKykge1xuICAgICAgICAgICAgICBzb3VyY2VzW19rZXldID0gX2FyZ3NbX2tleV07XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIF9pID0gMCwgX3NvdXJjZXMgPSBzb3VyY2VzO1xuXG4gICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgaWYgKCEoX2kgPCBfc291cmNlcy5sZW5ndGgpKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA4O1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgaXRlcmFibGUgPSBfc291cmNlc1tfaV07XG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuZGVsZWdhdGVZaWVsZChfYXN5bmNHZW5lcmF0b3JEZWxlZ2F0ZShfYXN5bmNJdGVyYXRvcihhc3luY0Vuc3VyZUl0ZXJhYmxlKGl0ZXJhYmxlKSksIF9hd2FpdEFzeW5jR2VuZXJhdG9yKSwgXCJ0MFwiLCA1KTtcblxuICAgICAgICAgIGNhc2UgNTpcbiAgICAgICAgICAgIF9pKys7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMjtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSA4OlxuICAgICAgICAgIGNhc2UgXCJlbmRcIjpcbiAgICAgICAgICAgIHJld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mYWxzZTtcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAyO1xuICAgICAgICAgICAgX2l0ZXJhdG9yID0gX2FzeW5jSXRlcmF0b3IoaXRlcmFibGUpO1xuXG4gICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDY7XG4gICAgICAgICAgICByZXR1cm4gX2l0ZXJhdG9yLm5leHQoKTtcblxuICAgICAgICAgIGNhc2UgNjpcbiAgICAgICAgICAgIF9zdGVwID0gX2NvbnRleHQuc2VudDtcbiAgICAgICAgICAgIF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gPSBfc3RlcC5kb25lO1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDEwO1xuICAgICAgICAgICAgcmV0dXJuIF9zdGVwLnZhbHVlO1xuXG4gICAgICAgICAgY2FzZSAxMDpcbiAgICAgICAgICAgIF92YWx1ZSA9IF9jb250ZXh0LnNlbnQ7XG5cbiAgICAgICAgICAgIGlmIChfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxNjtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIF8gPSBfdmFsdWU7XG5cbiAgICAgICAgICBjYXNlIDEzOlxuICAgICAgICAgICAgX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiA9IHRydWU7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gNDtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSAxNjpcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyMjtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSAxODpcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAxODtcbiAgICAgICAgICAgIF9jb250ZXh0LnQwID0gX2NvbnRleHRbXCJjYXRjaFwiXSgyKTtcbiAgICAgICAgICAgIF9kaWRJdGVyYXRvckVycm9yID0gdHJ1ZTtcbiAgICAgICAgICAgIF9pdGVyYXRvckVycm9yID0gX2NvbnRleHQudDA7XG5cbiAgICAgICAgICBjYXNlIDIyOlxuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDIyO1xuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDIzO1xuXG4gICAgICAgICAgICBpZiAoISghX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiAmJiBfaXRlcmF0b3JbXCJyZXR1cm5cIl0gIT0gbnVsbCkpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDI3O1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDI3O1xuICAgICAgICAgICAgcmV0dXJuIF9pdGVyYXRvcltcInJldHVyblwiXSgpO1xuXG4gICAgICAgICAgY2FzZSAyNzpcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAyNztcblxuICAgICAgICAgICAgaWYgKCFfZGlkSXRlcmF0b3JFcnJvcikge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMzA7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB0aHJvdyBfaXRlcmF0b3JFcnJvcjtcblxuICAgICAgICAgIGNhc2UgMzA6XG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuZmluaXNoKDI3KTtcblxuICAgICAgICAgIGNhc2UgMzE6XG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuZmluaXNoKDIyKTtcblxuICAgICAgICAgIGNhc2UgMzI6XG4gICAgICAgICAgY2FzZSBcImVuZFwiOlxuICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0LnN0b3AoKTtcbiAgICAgICAgfVxuICAgICAgfVxuICAgIH0sIF9jYWxsZWUsIG51bGwsIFtbMi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m4gX3JlZ2VuZXJhdG9yUnVudGltZS53cmFwKGZ1bmN0aW9uIF9fY3ljbGVUaW1lcyQoX2NvbnRleHQpIHtcbiAgICB3aGlsZSAoMSkge1xuICAgICAgc3dpdGNoIChfY29udGV4dC5wcmV2ID0gX2NvbnRleHQubmV4dCkge1xuICAgICAgICBjYXNlIDA6XG4gICAgICAgICAgYXJyID0gQXJyYXkuaXNBcnJheShzb3VyY2UpID8gc291cmNlIDogX190b0FycmF5KHNvdXJjZSk7XG5cbiAgICAgICAgICBpZiAoYXJyLmxlbmd0aCkge1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDM7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgICB9XG5cbiAgICAgICAgICByZXR1cm4gX2NvbnRleHQuYWJydXB0KFwicmV0dXJuXCIpO1xuXG4gICAgICAgIGNhc2UgMzpcbiAgICAgICAgICBpZiAoIW4tLSkge1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDc7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgICB9XG5cbiAgICAgICAgICByZXR1cm4gX2NvbnRleHQuZGVsZWdhdGVZaWVsZChhcnIsIFwidDBcIiwgNSk7XG5cbiAgICAgICAgY2FzZSA1OlxuICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAzO1xuICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgIGNhc2UgNzpcbiAgICAgICAgY2FzZSBcImVuZFwiOlxuICAgICAgICAgIHJldHVybiBfY29udGV4dC5zdG9wKCk7XG4gICAgICB9XG4gICAgfVxuICB9LCBfbWFya2VkKTtcbn1cblxuZXhwb3J0cy5fX2N5Y2xlVGltZXMgPSBfX2N5Y2xlVGltZXM7XG52YXIgY3ljbGVUaW1lcyA9IC8qI19fUFVSRV9fKi9pdGVyYWJsZUN1cnJ5KF9fY3ljbGVUaW1lcyk7XG5leHBvcnRzLmN5Y2xlVGltZXMgPSBjeWNsZVRpbWVzOyIsInZhciBfcmVxdWlyZS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1xuXG4gICAgICAgICAgICBpZiAoIV9fZXZlcnkodmFsdWVzLCBmdW5jdGlvbiAodmFsdWUpIHtcbiAgICAgICAgICAgICAgcmV0dXJuIHR5cGVvZiB2YWx1ZSAhPT0gJ3N0cmluZycgJiYgaXNJdGVyYWJsZSh2YWx1ZSk7XG4gICAgICAgICAgICB9KSkge1xuICAgICAgICAgICAgICBfY29udGV4dDIubmV4dCA9IDQwO1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiA9IHRydWU7XG4gICAgICAgICAgICBfZGlkSXRlcmF0b3JFcnJvciA9IGZhbHNlO1xuICAgICAgICAgICAgX2NvbnRleHQyLnByZXYgPSA0O1xuICAgICAgICAgICAgX2l0ZXJhdG9yID0gX2FzeW5jSXRlcmF0b3IoX19hc3luY1ppcEFsbChfX21hcCh2YWx1ZXMsIGFzeW5jSXRlcmFibGVPckVtcHR5KSwgemlwQWxsQ29uZmlnKSk7XG5cbiAgICAgICAgICBjYXNlIDY6XG4gICAgICAgICAgICBfY29udGV4dDIubmV4dCA9IDg7XG4gICAgICAgICAgICByZXR1cm4gX2l0ZXJhdG9yLm5leHQoKTtcblxuICAgICAgICAgIGNhc2UgODpcbiAgICAgICAgICAgIF9zdGVwID0gX2NvbnRleHQyLnNlbnQ7XG4gICAgICAgICAgICBfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uID0gX3N0ZXAuZG9uZTtcbiAgICAgICAgICAgIF9jb250ZXh0Mi5uZXh0ID0gMTI7XG4gICAgICAgICAgICByZXR1cm4gX3N0ZXAudmFsdWU7XG5cbiAgICAgICAgICBjYXNlIDEyOlxuICAgICAgICAgICAgX3ZhbHVlID0gX2NvbnRleHQyLnNlbnQ7XG5cbiAgICAgICAgICAgIGlmIChfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Mi5uZXh0ID0gMjI7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBzdGVwVmFsdWVzID0gX3ZhbHVlO1xuICAgICAgICAgICAgX2NvbnRleHQyLm5leHQgPSAxNztcbiAgICAgICAgICAgIHJldHVybiBfYXN5bmNEZWVwRXF1YWwoc3RlcFZhbHVlcywgc2FtZSwgaXNJdGVyYWJsZSwgZGVwdGggKyAxKTtcblxuICAgICAgICAgIGNhc2UgMTc6XG4gICAgICAgICAgICBpZiAoX2NvbnRleHQyLnNlbnQpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQyLm5leHQgPSAxOTtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dDIuYWJydXB0KFwicmV0dXJuXCIsIGZhbHNlKTtcblxuICAgICAgICAgIGNhc2UgMTk6XG4gICAgICAgICAgICBfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uID0gdHJ1ZTtcbiAgICAgICAgICAgIF9jb250ZXh0Mi5uZXh0ID0gNjtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSAyMjpcbiAgICAgICAgICAgIF9jb250ZXh0Mi5uZXh0ID0gMjg7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgIGNhc2UgMjQ6XG4gICAgICAgICAgICBfY29udGV4dDIucHJldiA9IDI0O1xuICAgICAgICAgICAgX2NvbnRleHQyLnQwID0gX2NvbnRleHQyW1wiY2F0Y2hcIl0oNCk7XG4gICAgICAgICAgICBfZGlkSXRlcmF0b3JFcnJvciA9IHRydWU7XG4gICAgICAgICAgICBfaXRlcmF0b3JFcnJvciA9IF9jb250ZXh0Mi50MDtcblxuICAgICAgICAgIGNhc2UgMjg6XG4gICAgICAgICAgICBfY29udGV4dDIucHJldiA9IDI4O1xuICAgICAgICAgICAgX2NvbnRleHQyLnByZXYgPSAyOTtcblxuICAgICAgICAgICAgaWYgKCEoIV9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gJiYgX2l0ZXJhdG9yW1wicmV0dXJuXCJdICE9IG51bGwpKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Mi5uZXh0ID0gMzM7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBfY29udGV4dDIubmV4dCA9IDMzO1xuICAgICAgICAgICAgcmV0dXJuIF9pdGVyYXRvcltcInJldHVyblwiXSgpO1xuXG4gICAgICAgICAgY2FzZSAzMzpcbiAgICAgICAgICAgIF9jb250ZXh0Mi5wcmV2ID0gMzM7XG5cbiAgICAgICAgICAgIGlmICghX2RpZEl0ZXJhdG9yRXJyb3IpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQyLm5leHQgPSAzNjtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHRocm93IF9pdGVyYXRvckVycm9yO1xuXG4gICAgICAgICAgY2FzZSAzNjpcbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dDIuZmluaXNoKDMzKTtcblxuICAgICAgICAgIGNhc2UgMzc6XG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQyLmZpbmlzaCgyOCk7XG5cbiAgICAgICAgICBjYXNlIDM4OlxuICAgICAgICAgICAgX2NvbnRleHQyLm5leHQgPSA1ODtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSA0MDpcbiAgICAgICAgICAgIGZpcnN0VmFsdWUgPSB2YWx1ZXNbMF07XG4gICAgICAgICAgICBfaXRlcmF0b3IyID0gX2NyZWF0ZUZvck9mSXRlcmF0b3JIZWxwZXIoX19zbGljZUZyb21TdGFydCh2YWx1ZXMsIDEpKTtcbiAgICAgICAgICAgIF9jb250ZXh0Mi5wcmV2ID0gNDI7XG5cbiAgICAgICAgICAgIF9pdGVyYXRvcjIucygpO1xuXG4gICAgICAgICAgY2FzZSA0NDpcbiAgICAgICAgICAgIGlmICgoX3N0ZXAyID0gX2l0ZXJhdG9yMi5uKCkpLmRvbmUpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQyLm5leHQgPSA1MDtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHZhbHVlID0gX3N0ZXAyLnZhbHVlO1xuXG4gICAgICAgICAgICBpZiAoc2FtZSh2YWx1ZSwgZmlyc3RWYWx1ZSwgZGVwdGgpKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Mi5uZXh0ID0gNDg7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQyLmFicnVwdChcInJldHVyblwiLCBmYWxzZSk7XG5cbiAgICAgICAgICBjYXNlIDQ4OlxuICAgICAgICAgICAgX2NvbnRleHQyLm5leHQgPSA0NDtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSA1MDpcbiAgICAgICAgICAgIF9jb250ZXh0Mi5uZXh0ID0gNTU7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgIGNhc2UgNTI6XG4gICAgICAgICAgICBfY29udGV4dDIucHJldiA9IDUyO1xuICAgICAgICAgICAgX2NvbnRleHQyLnQxID0gX2NvbnRleHQyW1wiY2F0Y2hcIl0oNDIpO1xuXG4gICAgICAgICAgICBfaXRlcmF0b3IyLmUoX2NvbnRleHQyLnQxKTtcblxuICAgICAgICAgIGNhc2UgNTU6XG4gICAgICAgICAgICBfY29udGV4dDIucHJldiA9IDU1O1xuXG4gICAgICAgICAgICBfaXRlcmF0b3IyLmYoKTtcblxuICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0Mi5maW5pc2goNTUpO1xuXG4gICAgICAgICAgY2FzZSA1ODpcbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dDIuYWJydXB0KFwicmV0dXJu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3JFcnJvciA9IGZhbHNlO1xuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDQ7XG4gICAgICAgICAgICBfaXRlcmF0b3IgPSBfYXN5bmNJdGVyYXRvcihzb3VyY2UpO1xuXG4gICAgICAgICAgY2FzZSA2OlxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDg7XG4gICAgICAgICAgICByZXR1cm4gX2F3YWl0QXN5bmNHZW5lcmF0b3IoX2l0ZXJhdG9yLm5leHQoKSk7XG5cbiAgICAgICAgICBjYXNlIDg6XG4gICAgICAgICAgICBfc3RlcCA9IF9jb250ZXh0LnNlbnQ7XG4gICAgICAgICAgICBfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uID0gX3N0ZXAuZG9uZTtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxMjtcbiAgICAgICAgICAgIHJldHVybiBfYXdhaXRBc3luY0dlbmVyYXRvcihfc3RlcC52YWx1ZSk7XG5cbiAgICAgICAgICBjYXNlIDEyOlxuICAgICAgICAgICAgX3ZhbHVlID0gX2NvbnRleHQuc2VudDtcblxuICAgICAgICAgICAgaWYgKF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24pIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDI5O1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdmFsdWUgPSBfdmFsdWU7XG5cbiAgICAgICAgICAgIGlmIChkcm9wKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyMDtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxODtcbiAgICAgICAgICAgIHJldHVybiB2YWx1ZTtcblxuICAgICAgICAgIGNhc2UgMTg6XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMjY7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgIGNhc2UgMjA6XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMjI7XG4gICAgICAgICAgICByZXR1cm4gX2F3YWl0QXN5bmNHZW5lcmF0b3IocHJlZGljYXRlKHZhbHVlLCBjKyspKTtcblxuICAgICAgICAgIGNhc2UgMjI6XG4gICAgICAgICAgICBkcm9wID0gX2NvbnRleHQuc2VudDtcblxuICAgICAgICAgICAgaWYgKGRyb3ApIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDI2O1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDI2O1xuICAgICAgICAgICAgcmV0dXJuIHZhbHVlO1xuXG4gICAgICAgICAgY2FzZSAyNjpcbiAgICAgICAgICAgIF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gPSB0cnVlO1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDY7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgIGNhc2UgMjk6XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMzU7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgIGNhc2UgMzE6XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMzE7XG4gICAgICAgICAgICBfY29udGV4dC50MCA9IF9jb250ZXh0W1wiY2F0Y2hcIl0oNCk7XG4gICAgICAgICAgICBfZGlkSXRlcmF0b3JFcnJvciA9IHRydWU7XG4gICAgICAgICAgICBfaXRlcmF0b3JFcnJvciA9IF9jb250ZXh0LnQwO1xuXG4gICAgICAgICAgY2FzZSAzNTpcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAzNTtcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAzNjtcblxuICAgICAgICAgICAgaWYgKCEoIV9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gJiYgX2l0ZXJhdG9yW1wicmV0dXJuXCJdICE9IG51bGwpKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA0MDtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA0MDtcbiAgICAgICAgICAgIHJldHVybiBfYXdhaXRBc3luY0dlbmVyYXRvcihfaXRlcmF0b3JbXCJyZXR1cm5cIl0oKSk7XG5cbiAgICAgICAgICBjYXNlIDQwOlxuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDQwO1xuXG4gICAgICAgICAgICBpZiAoIV9kaWRJdGVyYXRvckVycm9yKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA0MztcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHRocm93IF9pdGVyYXRvckVycm9yO1xuXG4gICAgICAgICAgY2FzZSA0MzpcbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dC5maW5pc2goNDApO1xuXG4gICAgICAgICAgY2FzZSA0NDpcbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dC5maW5pc2goMzUpO1xuXG4gICAgICAgICAgY2FzZSA0NTpcbiAgICAgICAgICBjYXNlIFwiZW5kXCI6XG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuc3RvcCgpO1xuICAgICAgICB9XG4gICAgICB9XG4gICAgfSwgX2NhbGxlZSwgbnVsbCwgW1s0LCAzMSwgMzUsIDQ1XSwgWzM2LCwgNDAsIDQ0XV0pO1xuICB9KSk7XG4gIHJldHVybiBfYXN5bmNEcm9wV2hpbGUuYXBwbHkodGhpcywgYXJndW1lbnRzKTtcbn1cblxudmFyIGFzeW5jRHJvcFdoaWxlID0gLyojX19QVVJFX18qL2FzeW5jSXRlcmFibGVDdXJyeShfX2FzeW5jRHJvcFdoaWxlKTtcbmV4cG9ydHMuYXN5bmNEcm9wV2hpbGUgPSBhc3luY0Ryb3BXaGlsZTsiLCJ2YXI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IGlmIChkcm9wKSB7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTI7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgICB9XG5cbiAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTA7XG4gICAgICAgICAgcmV0dXJuIHZhbHVlO1xuXG4gICAgICAgIGNhc2UgMTA6XG4gICAgICAgICAgX2NvbnRleHQubmV4dCA9IDE2O1xuICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgIGNhc2UgMTI6XG4gICAgICAgICAgZHJvcCA9IHByZWRpY2F0ZSh2YWx1ZSwgYysrKTtcblxuICAgICAgICAgIGlmIChkcm9wKSB7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTY7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgICB9XG5cbiAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTY7XG4gICAgICAgICAgcmV0dXJuIHZhbHVlO1xuXG4gICAgICAgIGNhc2UgMTY6XG4gICAgICAgICAgX2NvbnRleHQubmV4dCA9IDU7XG4gICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgY2FzZSAxODpcbiAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMjM7XG4gICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgY2FzZSAyMDpcbiAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMjA7XG4gICAgICAgICAgX2NvbnRleHQudDAgPSBfY29udGV4dFtcImNhdGNoXCJdKDMpO1xuXG4gICAgICAgICAgX2l0ZXJhdG9yLmUoX2NvbnRleHQudDApO1xuXG4gICAgICAgIGNhc2UgMjM6XG4gICAgICAgICAgX2NvbnRleHQucHJldiA9IDIzO1xuXG4gICAgICAgICAgX2l0ZXJhdG9yLmYoKTtcblxuICAgICAgICAgIHJldHVybiBfY29udGV4dC5maW5pc2goMjMpO1xuXG4gICAgICAgIGNhc2UgMjY6XG4gICAgICAgIGNhc2UgXCJlbmRcIjpcbiAgICAgICAgICByZXR1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G9yKF9zdGVwLnZhbHVlKTtcblxuICAgICAgICAgIGNhc2UgMTE6XG4gICAgICAgICAgICBfdmFsdWUgPSBfY29udGV4dC5zZW50O1xuXG4gICAgICAgICAgICBpZiAoX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbikge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMjA7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB2YWx1ZSA9IF92YWx1ZTtcblxuICAgICAgICAgICAgaWYgKCEoaSsrID49IG4pKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxNztcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxNztcbiAgICAgICAgICAgIHJldHVybiB2YWx1ZTtcblxuICAgICAgICAgIGNhc2UgMTc6XG4gICAgICAgICAgICBfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uID0gdHJ1ZTtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA1O1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICBjYXNlIDIwOlxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDI2O1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICBjYXNlIDIyOlxuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDIyO1xuICAgICAgICAgICAgX2NvbnRleHQudDAgPSBfY29udGV4dFtcImNhdGNoXCJdKDMpO1xuICAgICAgICAgICAgX2RpZEl0ZXJhdG9yRXJyb3IgPSB0cnVlO1xuICAgICAgICAgICAgX2l0ZXJhdG9yRXJyb3IgPSBfY29udGV4dC50MDtcblxuICAgICAgICAgIGNhc2UgMjY6XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMjY7XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMjc7XG5cbiAgICAgICAgICAgIGlmICghKCFfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uICYmIF9pdGVyYXRvcltcInJldHVyblwiXSAhPSBudWxsKSkge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMzE7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMzE7XG4gICAgICAgICAgICByZXR1cm4gX2F3YWl0QXN5bmNHZW5lcmF0b3IoX2l0ZXJhdG9yW1wicmV0dXJuXCJdKCkpO1xuXG4gICAgICAgICAgY2FzZSAzMTpcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAzMTtcblxuICAgICAgICAgICAgaWYgKCFfZGlkSXRlcmF0b3JFcnJvcikge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMzQ7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB0aHJvdyBfaXRlcmF0b3JFcnJvcjtcblxuICAgICAgICAgIGNhc2UgMzQ6XG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuZmluaXNoKDMxKTtcblxuICAgICAgICAgIGNhc2UgMzU6XG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuZmluaXNoKDI2KTtcblxuICAgICAgICAgIGNhc2UgMzY6XG4gICAgICAgICAgY2FzZSBcImVuZFwiOlxuICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0LnN0b3AoKTtcbiAgICAgICAgfVxuICAgICAgfVxuICAgIH0sIF9jYWxsZWUsIG51bGwsIFtbMywgMjIsIDI2LCAzNl0sIFsyNywsIDMxLCAzNV1dKTtcbiAgfSkpO1xuICByZXR1cm4gX2FzeW5jRHJvcC5hcHBseSh0aGlzLCBhcmd1bWVudHMpO1xufVxuXG52YXIgYXN5bmNEcm9wID0gLyojX19QVVJFX18qL2FzeW5jSXRlcmFibGVDdXJyeShfX2FzeW5jR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WYgKCEoaSsrID49IG4pKSB7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gOTtcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA5O1xuICAgICAgICAgIHJldHVybiB2YWx1ZTtcblxuICAgICAgICBjYXNlIDk6XG4gICAgICAgICAgX2NvbnRleHQubmV4dCA9IDQ7XG4gICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgY2FzZSAxMTpcbiAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTY7XG4gICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgY2FzZSAxMzpcbiAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMTM7XG4gICAgICAgICAgX2NvbnRleHQudDAgPSBfY29udGV4dFtcImNhdGNoXCJdKDIpO1xuXG4gICAgICAgICAgX2l0ZXJhdG9yLmUoX2NvbnRleHQudDApO1xuXG4gICAgICAgIGNhc2UgMTY6XG4gICAgICAgICAgX2NvbnRleHQucHJldiA9IDE2O1xuXG4gICAgICAgICAgX2l0ZXJhdG9yLmYoKTtcblxuICAgICAgICAgIHJldHVybiBfY29udGV4dC5maW5pc2goMTYpO1xuXG4gICAgICAgIGNhc2UgMTk6XG4gICAgICAgIGNhc2UgXCJlbmRcIjpcbiAgICAgICAgICByZXR1cm4gX2NvbnRleHQuc3RvcCgpO1xuICAgICAgfVxuICAgIH1cbiAgfSwgX21hcmtlZCwgbnVsbCwgW1syLCAxMywgMTYsIDE5XV0pO1xufVxuXG5leHBvcnRzLl9fZHJvcCA9IF9fZHJvcDtcbnZhciBkcm9wID0gLyojX19QVVJFX18qL2l0ZXJhYmxlQ3VycnkoX19kcm9wKTtcbmV4cG9ydHMuZHJvcCA9IGRyb3A7IiwidmFyIF9yZXF1aXJlID0gcmVxdWlyZSgnLi4vLi4vaW50ZXJuYWwvYXN5bmMtaXRlcmFibGUuanMnKSxcbiAgICBhc3luY0l0ZXJhYmxl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HVuZGVmaW5lZCA/IF9hcmdzWzFdIDogT2JqZWN0LmlzO1xuXG4gICAgICAgICAgICBpZiAoIShpdGVyYWJsZXMubGVuZ3RoIDw9IDEpKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAzO1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0LmFicnVwdChcInJldHVyblwiLCB0cnVlKTtcblxuICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgIF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gPSB0cnVlO1xuICAgICAgICAgICAgX2RpZEl0ZXJhdG9yRXJyb3IgPSBmYWxzZTtcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSA1O1xuICAgICAgICAgICAgX2l0ZXJhdG9yID0gX2FzeW5jSXRlcmF0b3IoX19hc3luY1ppcEFsbChpdGVyYWJsZXMsIHppcEFsbENvbmZpZykpO1xuXG4gICAgICAgICAgY2FzZSA3OlxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDk7XG4gICAgICAgICAgICByZXR1cm4gX2l0ZXJhdG9yLm5leHQoKTtcblxuICAgICAgICAgIGNhc2UgOTpcbiAgICAgICAgICAgIF9zdGVwID0gX2NvbnRleHQuc2VudDtcbiAgICAgICAgICAgIF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gPSBfc3RlcC5kb25lO1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDEzO1xuICAgICAgICAgICAgcmV0dXJuIF9zdGVwLnZhbHVlO1xuXG4gICAgICAgICAgY2FzZSAxMzpcbiAgICAgICAgICAgIF92YWx1ZSA9IF9jb250ZXh0LnNlbnQ7XG5cbiAgICAgICAgICAgIGlmIChfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAzNztcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHN0ZXBWYWx1ZXMgPSBfdmFsdWU7XG4gICAgICAgICAgICBmaXJzdFZhbHVlID0gc3RlcFZhbHVlc1swXTtcbiAgICAgICAgICAgIF9pdGVyYXRvcjIgPSBfY3JlYXRlRm9yT2ZJdGVyYXRvckhlbHBlcihfX3NsaWNlRnJvbVN0YXJ0KHN0ZXBWYWx1ZXMsIDEpKTtcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAxODtcblxuICAgICAgICAgICAgX2l0ZXJhdG9yMi5zKCk7XG5cbiAgICAgICAgICBjYXNlIDIwOlxuICAgICAgICAgICAgaWYgKChfc3RlcDIgPSBfaXRlcmF0b3IyLm4oKSkuZG9uZSkge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMjY7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB2YWx1ZSA9IF9zdGVwMi52YWx1ZTtcblxuICAgICAgICAgICAgaWYgKHNhbWUodmFsdWUsIGZpcnN0VmFsdWUpKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyNDtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dC5hYnJ1cHQoXCJyZXR1cm5cIiwgZmFsc2UpO1xuXG4gICAgICAgICAgY2FzZSAyNDpcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyMDtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSAyNjpcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAzMTtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSAyODpcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAyODtcbiAgICAgICAgICAgIF9jb250ZXh0LnQwID0gX2NvbnRleHRbXCJjYXRjaFwiXSgxOCk7XG5cbiAgICAgICAgICAgIF9pdGVyYXRvcjIuZShfY29udGV4dC50MCk7XG5cbiAgICAgICAgICBjYXNlIDMxOlxuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDMxO1xuXG4gICAgICAgICAgICBfaXRlcmF0b3IyLmYoKTtcblxuICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0LmZpbmlzaCgzMSk7XG5cbiAgICAgICAgICBjYXNlIDM0OlxuICAgICAgICAgICAgX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiA9IHRydWU7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gNztcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSAzNzpcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA0MztcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSAzOTpcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAzOTtcbiAgICAgICAgICAgIF9jb250ZXh0LnQxID0gX2NvbnRleHRbXCJjYXRjaFwiXSg1KTtcbiAgICAgICAgICAgIF9kaWRJdGVyYXRvckVycm9yID0gdHJ1ZTtcbiAgICAgICAgICAgIF9pdGVyYXRvckVycm9yID0gX2NvbnRleHQudDE7XG5cbiAgICAgICAgICBjYXNlIDQzOlxuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDQzO1xuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDQ0O1xuXG4gICAgICAgICAgICBpZiAoISghX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiAmJiBfaXRlcmF0b3JbXCJyZXR1cm5cIl0gIT0gbnVsbCkpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDQ4O1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDQ4O1xuICAgICAgICAgICAgcmV0dXJuIF9pdGVyYXRvcltcInJldHVyblwiXSgpO1xuXG4gICAgICAgICAgY2FzZSA0ODpcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSA0ODtcblxuICAgICAgICAgICAgaWYgKCFfZGlkSXRlcmF0b3JFcnJvcikge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gNTE7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB0aHJvdyBfaXRlcmF0b3JFcnJvcjtcblxuICAgICAgICAgIGNhc2UgNTE6XG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuZmluaXNoKDQ4KTtcblxuICAgICAgICAgIGNhc2UgNTI6XG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuZmluaXNoKDQzKTtcblxuICAgICAgICAgIGNhc2UgNTM6XG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuYWJydXB0KFwicmV0dXJuXCIsIHRydWUpO1xuXG4gICAgICAgICAgY2FzZSA1NDpcbiAgICAgICAgICBjYXNlIFwiZW5kXCI6XG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuc3RvcCgpO1xuICAgICAgICB9XG4gICAgICB9XG4gICAgfSwgX2NhbGxlZSwgbnVsbCwgW1s1LCAzOSwgNDMsIDUzXSwgWzE4LCAyOCwgMzEsIDM0XSwgWzQ0LCwgNDgsIDUyXV0pO1xuICB9KSk7XG4gIHJldHVybiBfYXN5bmNFcXVhbC5hcHBseSh0aGlzLCBhcmd1bWVudHMpO1xufVxuXG5leHBvcnRzLl9fYXN5bmNFcXVhbCA9IF9fYXN5bmNFcXVhbDtcbnZhciBhc3luY0VxdWFsID0gLyojX19QVVJFX18qL2FzeW5jSXRlcmFibGVDdXJyeShfX2FzeW5jRXF1YWwsIHtcbiAgbWluQXJnczogMCxcbiAgbWF4QXJnczogMSxcbiAgdmFyaWFkaWM6IHRydWUsXG4gIHJlZHVjZXM6IHRydWVcbn0pO1xuZXhwb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AgICAgICAgICAgX2NvbnRleHQucHJldiA9IDM7XG4gICAgICAgICAgICBfaXRlcmF0b3IgPSBfYXN5bmNJdGVyYXRvcihpdGVyYWJsZSk7XG5cbiAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gNztcbiAgICAgICAgICAgIHJldHVybiBfaXRlcmF0b3IubmV4dCgpO1xuXG4gICAgICAgICAgY2FzZSA3OlxuICAgICAgICAgICAgX3N0ZXAgPSBfY29udGV4dC5zZW50O1xuICAgICAgICAgICAgX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiA9IF9zdGVwLmRvbmU7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTE7XG4gICAgICAgICAgICByZXR1cm4gX3N0ZXAudmFsdWU7XG5cbiAgICAgICAgICBjYXNlIDExOlxuICAgICAgICAgICAgX3ZhbHVlID0gX2NvbnRleHQuc2VudDtcblxuICAgICAgICAgICAgaWYgKF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24pIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDIxO1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdmFsdWUgPSBfdmFsdWU7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTY7XG4gICAgICAgICAgICByZXR1cm4gcHJlZGljYXRlKHZhbHVlLCBjKyspO1xuXG4gICAgICAgICAgY2FzZSAxNjpcbiAgICAgICAgICAgIGlmIChfY29udGV4dC5zZW50KSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxODtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dC5hYnJ1cHQoXCJyZXR1cm5cIiwgZmFsc2UpO1xuXG4gICAgICAgICAgY2FzZSAxODpcbiAgICAgICAgICAgIF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gPSB0cnVlO1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDU7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgIGNhc2UgMjE6XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMjc7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgIGNhc2UgMjM6XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMjM7XG4gICAgICAgICAgICBfY29udGV4dC50MCA9IF9jb250ZXh0W1wiY2F0Y2hcIl0oMyk7XG4gICAgICAgICAgICBfZGlkSXRlcmF0b3JFcnJvciA9IHRydWU7XG4gICAgICAgICAgICBfaXRlcmF0b3JFcnJvciA9IF9jb250ZXh0LnQwO1xuXG4gICAgICAgICAgY2FzZSAyNzpcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAyNztcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAyODtcblxuICAgICAgICAgICAgaWYgKCEoIV9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gJiYgX2l0ZXJhdG9yW1wicmV0dXJuXCJdICE9IG51bGwpKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAzMjtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAzMjtcbiAgICAgICAgICAgIHJldHVybiBfaXRlcmF0b3JbXCJyZXR1cm5cIl0oKTtcblxuICAgICAgICAgIGNhc2UgMzI6XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMzI7XG5cbiAgICAgICAgICAgIGlmICghX2RpZEl0ZXJhdG9yRXJyb3IpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDM1O1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdGhyb3cgX2l0ZXJhdG9yRXJyb3I7XG5cbiAgICAgICAgICBjYX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AgICAgcmV0dXJuIF9hd2FpdEFzeW5jR2VuZXJhdG9yKF9pdGVyYXRvci5uZXh0KCkpO1xuXG4gICAgICAgICAgY2FzZSA3OlxuICAgICAgICAgICAgX3N0ZXAgPSBfY29udGV4dC5zZW50O1xuICAgICAgICAgICAgX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiA9IF9zdGVwLmRvbmU7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTE7XG4gICAgICAgICAgICByZXR1cm4gX2F3YWl0QXN5bmNHZW5lcmF0b3IoX3N0ZXAudmFsdWUpO1xuXG4gICAgICAgICAgY2FzZSAxMTpcbiAgICAgICAgICAgIF92YWx1ZSA9IF9jb250ZXh0LnNlbnQ7XG5cbiAgICAgICAgICAgIGlmIChfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyMjtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHZhbHVlID0gX3ZhbHVlO1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDE2O1xuICAgICAgICAgICAgcmV0dXJuIF9hd2FpdEFzeW5jR2VuZXJhdG9yKHByZWRpY2F0ZSh2YWx1ZSwgYysrKSk7XG5cbiAgICAgICAgICBjYXNlIDE2OlxuICAgICAgICAgICAgaWYgKCFfY29udGV4dC5zZW50KSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxOTtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxOTtcbiAgICAgICAgICAgIHJldHVybiB2YWx1ZTtcblxuICAgICAgICAgIGNhc2UgMTk6XG4gICAgICAgICAgICBfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uID0gdHJ1ZTtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA1O1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICBjYXNlIDIyOlxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDI4O1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICBjYXNlIDI0OlxuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDI0O1xuICAgICAgICAgICAgX2NvbnRleHQudDAgPSBfY29udGV4dFtcImNhdGNoXCJdKDMpO1xuICAgICAgICAgICAgX2RpZEl0ZXJhdG9yRXJyb3IgPSB0cnVlO1xuICAgICAgICAgICAgX2l0ZXJhdG9yRXJyb3IgPSBfY29udGV4dC50MDtcblxuICAgICAgICAgIGNhc2UgMjg6XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMjg7XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMjk7XG5cbiAgICAgICAgICAgIGlmICghKCFfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uICYmIF9pdGVyYXRvcltcInJldHVyblwiXSAhPSBudWxsKSkge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMzM7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMzM7XG4gICAgICAgICAgICByZXR1cm4gX2F3YWl0QXN5bmNHZW5lcmF0b3IoX2l0ZXJhdG9yW1wicmV0dXJuXCJdKCkpO1xuXG4gICAgICAgICAgY2FzZSAzMzpcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAzMztcblxuICAgICAgICAgICAgaWYgKCFfZGlkSXRlcmF0b3JFcnJvcikge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMzY7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB0aHJvdyBfaXRlcmF0b3JFcnJvcjtcblxuICAgICAgICAgIGNhc2UgMzY6XG4gICAgICAgICAgICByZXR1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SB7XG4gICAgICBzd2l0Y2ggKF9jb250ZXh0LnByZXYgPSBfY29udGV4dC5uZXh0KSB7XG4gICAgICAgIGNhc2UgMDpcbiAgICAgICAgICBjID0gMDtcbiAgICAgICAgICBfaXRlcmF0b3IgPSBfY3JlYXRlRm9yT2ZJdGVyYXRvckhlbHBlcihzb3VyY2UpO1xuICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAyO1xuXG4gICAgICAgICAgX2l0ZXJhdG9yLnMoKTtcblxuICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgaWYgKChfc3RlcCA9IF9pdGVyYXRvci5uKCkpLmRvbmUpIHtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxMTtcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIHZhbHVlID0gX3N0ZXAudmFsdWU7XG5cbiAgICAgICAgICBpZiAoIXByZWRpY2F0ZSh2YWx1ZSwgYysrKSkge1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDk7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgICB9XG5cbiAgICAgICAgICBfY29udGV4dC5uZXh0ID0gOTtcbiAgICAgICAgICByZXR1cm4gdmFsdWU7XG5cbiAgICAgICAgY2FzZSA5OlxuICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA0O1xuICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgIGNhc2UgMTE6XG4gICAgICAgICAgX2NvbnRleHQubmV4dCA9IDE2O1xuICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgIGNhc2UgMTM6XG4gICAgICAgICAgX2NvbnRleHQucHJldiA9IDEzO1xuICAgICAgICAgIF9jb250ZXh0LnQwID0gX2NvbnRleHRbXCJjYXRjaFwiXSgyKTtcblxuICAgICAgICAgIF9pdGVyYXRvci5lKF9jb250ZXh0LnQwKTtcblxuICAgICAgICBjYXNlIDE2OlxuICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAxNj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xuICAgICAgICAgICAgX3ZhbHVlID0gX2NvbnRleHQuc2VudDtcblxuICAgICAgICAgICAgaWYgKF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24pIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDIxO1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdmFsdWUgPSBfdmFsdWU7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTY7XG4gICAgICAgICAgICByZXR1cm4gZnVuYyh2YWx1ZSwgYysrKTtcblxuICAgICAgICAgIGNhc2UgMTY6XG4gICAgICAgICAgICBpZiAoIV9jb250ZXh0LnNlbnQpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDE4O1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0LmFicnVwdChcInJldHVyblwiLCB2YWx1ZSk7XG5cbiAgICAgICAgICBjYXNlIDE4OlxuICAgICAgICAgICAgX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiA9IHRydWU7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gNTtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSAyMTpcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyNztcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSAyMzpcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAyMztcbiAgICAgICAgICAgIF9jb250ZXh0LnQwID0gX2NvbnRleHRbXCJjYXRjaFwiXSgzKTtcbiAgICAgICAgICAgIF9kaWRJdGVyYXRvckVycm9yID0gdHJ1ZTtcbiAgICAgICAgICAgIF9pdGVyYXRvckVycm9yID0gX2NvbnRleHQudDA7XG5cbiAgICAgICAgICBjYXNlIDI3OlxuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDI3O1xuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDI4O1xuXG4gICAgICAgICAgICBpZiAoISghX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiAmJiBfaXRlcmF0b3JbXCJyZXR1cm5cIl0gIT0gbnVsbCkpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDMyO1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDMyO1xuICAgICAgICAgICAgcmV0dXJuIF9pdGVyYXRvcltcInJldHVyblwiXSgpO1xuXG4gICAgICAgICAgY2FzZSAzMjpcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAzMjtcblxuICAgICAgICAgICAgaWYgKCFfZGlkSXRlcmF0b3JFcnJvcikge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMzU7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB0aHJvdyBfaXRlcmF0b3JFcnJvcjtcblxuICAgICAgICAgIGNhc2UgMzU6XG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuZmluaXNoKDMyKTtcblxuICAgICAgICAgIGNhc2UgMzY6XG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuZmluaXNoKDI3KTtcblxuICAgICAgICAgIGNhc2UgMzc6XG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuYWJydXB0KFwicmV0dXJuXCIsIG5vdEZvdW5kVmFsdWUpO1xuXG4gICAgICAgICAgY2FzZSAzODpcbiAgICAgICAgICBjYXNlIFwiZW5kXCI6XG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuc3RvcCgpO1xuICAgICAgICB9XG4gICAgICB9XG4gICAgfSwgX2NhbGxlZSwgbnVsbCwgW1szLCAyMywgMjcsIDM3XSwgWzI4LCwgMzIsIDM2XV0pO1xuICB9KSk7XG4gIH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gX3JlZ2VuZXJhdG9yUnVudGltZS53cmFwKGZ1bmN0aW9uIF9jYWxsZWUkKF9jb250ZXh0KSB7XG4gICAgICB3aGlsZSAoMSkge1xuICAgICAgICBzd2l0Y2ggKF9jb250ZXh0LnByZXYgPSBfY29udGV4dC5uZXh0KSB7XG4gICAgICAgICAgY2FzZSAwOlxuICAgICAgICAgICAgaXRlciA9IGl0ZXJhYmxlW1N5bWJvbC5hc3luY0l0ZXJhdG9yXSgpO1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDM7XG4gICAgICAgICAgICByZXR1cm4gaXRlci5uZXh0KCk7XG5cbiAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICBfeWllbGQkaXRlciRuZXh0ID0gX2NvbnRleHQuc2VudDtcbiAgICAgICAgICAgIHZhbHVlID0gX3lpZWxkJGl0ZXIkbmV4dC52YWx1ZTtcbiAgICAgICAgICAgIGRvbmUgPSBfeWllbGQkaXRlciRuZXh0LmRvbmU7XG5cbiAgICAgICAgICAgIGlmICghZG9uZSkge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gODtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dC5hYnJ1cHQoXCJyZXR1cm5cIiwgd2hlbkVtcHR5KTtcblxuICAgICAgICAgIGNhc2UgODpcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxMDtcbiAgICAgICAgICAgIHJldHVybiBhc3luY0NhbGxSZXR1cm4oaXRlcik7XG5cbiAgICAgICAgICBjYXNlIDEwOlxuICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0LmFicnVwdChcInJldHVyblwiLCB2YWx1ZSk7XG5cbiAgICAgICAgICBjYXNlIDExOlxuICAgICAgICAgIGNhc2UgXCJlbmRcIjpcbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dC5zdG9wKCk7XG4gICAgICAgIH1cbiAgICAgIH1cb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gICAgICAgICBfY29udGV4dC5uZXh0ID0gMTA7XG4gICAgICAgICAgICByZXR1cm4gX2F3YWl0QXN5bmNHZW5lcmF0b3IoX3N0ZXAudmFsdWUpO1xuXG4gICAgICAgICAgY2FzZSAxMDpcbiAgICAgICAgICAgIF92YWx1ZSA9IF9jb250ZXh0LnNlbnQ7XG5cbiAgICAgICAgICAgIGlmIChfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxNztcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHZhbHVlID0gX3ZhbHVlO1xuICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0LmRlbGVnYXRlWWllbGQoX2FzeW5jR2VuZXJhdG9yRGVsZWdhdGUoX2FzeW5jSXRlcmF0b3IodmFsdWUpLCBfYXdhaXRBc3luY0dlbmVyYXRvciksIFwidDBcIiwgMTQpO1xuXG4gICAgICAgICAgY2FzZSAxNDpcbiAgICAgICAgICAgIF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gPSB0cnVlO1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDQ7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgIGNhc2UgMTc6XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMjM7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgIGNhc2UgMTk6XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMTk7XG4gICAgICAgICAgICBfY29udGV4dC50MSA9IF9jb250ZXh0W1wiY2F0Y2hcIl0oMik7XG4gICAgICAgICAgICBfZGlkSXRlcmF0b3JFcnJvciA9IHRydWU7XG4gICAgICAgICAgICBfaXRlcmF0b3JFcnJvciA9IF9jb250ZXh0LnQxO1xuXG4gICAgICAgICAgY2FzZSAyMzpcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAyMztcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAyNDtcblxuICAgICAgICAgICAgaWYgKCEoIV9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gJiYgX2l0ZXJhdG9yW1wicmV0dXJuXCJdICE9IG51bGwpKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyODtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyODtcbiAgICAgICAgICAgIHJldHVybiBfYXdhaXRBc3luY0dlbmVyYXRvcihfaXRlcmF0b3JbXCJyZXR1cm5cIl0oKSk7XG5cbiAgICAgICAgICBjYXNlIDI4OlxuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDI4O1xuXG4gICAgICAgICAgICBpZiAoIV9kaWRJdGVyYXRvckVycm9yKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAzMTtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHRocm93IF9pdGVyYXRvckVycm9yO1xuXG4gICAgICAgICAgY2FzZSAzMTpcbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dC5maW5pc2goMjgpO1xuXG4gICAgICAgICAgY2FzZSAzMjpcbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dC5maW5pc2goMjMpO1xuXG4gICAgICAgICAgY2FzZSAzMzpcbiAgICAgICAgICBjYXNlIFwiZW5kXCI6XG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuc3RvcCgpO1xuICAgICAgICB9XG4gICAgICB9XG4gICAgfSwgX2NhbGxlZSwgbnVsbCwgW1syLCAxOSwgMjMsIDMzXSwgWzI0LCwgMjgsIDMyXV0pO1xuICB9KSk7XG4gIHJldHVybiBfYXN5bmNGbGF0TWFwLmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7XG59XG5cbnZhciBhc3luY0ZsYXRNYXAg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BfaXRlcmF0b3IubigpKS5kb25lKSB7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gODtcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIHZhbHVlID0gX3N0ZXAudmFsdWU7XG4gICAgICAgICAgcmV0dXJuIF9jb250ZXh0LmRlbGVnYXRlWWllbGQodmFsdWUsIFwidDBcIiwgNik7XG5cbiAgICAgICAgY2FzZSA2OlxuICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAzO1xuICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgIGNhc2UgODpcbiAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTM7XG4gICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgY2FzZSAxMDpcbiAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMTA7XG4gICAgICAgICAgX2NvbnRleHQudDEgPSBfY29udGV4dFtcImNhdGNoXCJdKDEpO1xuXG4gICAgICAgICAgX2l0ZXJhdG9yLmUoX2NvbnRleHQudDEpO1xuXG4gICAgICAgIGNhc2UgMTM6XG4gICAgICAgICAgX2NvbnRleHQucHJldiA9IDEzO1xuXG4gICAgICAgICAgX2l0ZXJhdG9yLmYoKTtcblxuICAgICAgICAgIHJldHVybiBfY29udGV4dC5maW5pc2goMTMpO1xuXG4gICAgICAgIGNhc2UgMTY6XG4gICAgICAgIGNhc2UgXCJlbmRcIjpcbiAgICAgICAgICByZXR1cm4gX2NvbnRleHQuc3RvcCgpO1xuICAgICAgfVxuICAgIH1cbiAgfSwgX21hcmtlZCwgbnVsbCwgW1sxLCAxMCwgMTMsIDE2XV0pO1xufVxuXG5leHBvcnRzLl9fZmxhdE1hcCA9IF9fZmxhdE1hcDtcbnZhciBmbGF0TWFwID0gLyojX19QVVJFX18qL2l0ZXJhYmxlQ3VycnkoX19mbGF0TWFwKTtcbmV4cG9ydHMuZmxhdE1hcCA9IGZsYXRNYXA7IiwidmFyIF9yZWdlbmVyYXRvclJ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4gICAgICAgICAgY2FzZSA2OlxuICAgICAgICAgICAgX3N0ZXAgPSBfY29udGV4dC5zZW50O1xuICAgICAgICAgICAgX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiA9IF9zdGVwLmRvbmU7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTA7XG4gICAgICAgICAgICByZXR1cm4gX2F3YWl0QXN5bmNHZW5lcmF0b3IoX3N0ZXAudmFsdWUpO1xuXG4gICAgICAgICAgY2FzZSAxMDpcbiAgICAgICAgICAgIF92YWx1ZSA9IF9jb250ZXh0LnNlbnQ7XG5cbiAgICAgICAgICAgIGlmIChfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyNztcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHZhbHVlID0gX3ZhbHVlO1xuICAgICAgICAgICAgX2NvbnRleHQudDAgPSBjdXJyZW50RGVwdGggPCBkZXB0aDtcblxuICAgICAgICAgICAgaWYgKCFfY29udGV4dC50MCkge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTg7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTc7XG4gICAgICAgICAgICByZXR1cm4gX2F3YWl0QXN5bmNHZW5lcmF0b3Ioc2hvdWxkRmxhdCh2YWx1ZSkpO1xuXG4gICAgICAgICAgY2FzZSAxNzpcbiAgICAgICAgICAgIF9jb250ZXh0LnQwID0gX2NvbnRleHQuc2VudDtcblxuICAgICAgICAgIGNhc2UgMTg6XG4gICAgICAgICAgICBpZiAoIV9jb250ZXh0LnQwKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyMjtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dC5kZWxlZ2F0ZVlpZWxkKF9hc3luY0dlbmVyYXRvckRlbGVnYXRlKF9hc3luY0l0ZXJhdG9yKGFzeW5jRmxhdEludGVybmFsKHNob3VsZEZsYXQsIGRlcHRoLCBjdXJyZW50RGVwdGggKyAxLCB2YWx1ZSkpLCBfYXdhaXRBc3luY0dlbmVyYXRvciksIFwidDFcIiwgMjApO1xuXG4gICAgICAgICAgY2FzZSAyMDpcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyNDtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSAyMjpcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyNDtcbiAgICAgICAgICAgIHJldHVybiB2YWx1ZTtcblxuICAgICAgICAgIGNhc2UgMjQ6XG4gICAgICAgICAgICBfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uID0gdHJ1ZTtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA0O1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICBjYXNlIDI3OlxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDMzO1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICBjYXNlIDI5OlxuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDI5O1xuICAgICAgICAgICAgX2NvbnRleHQudDIgPSBfY29udGV4dFtcImNhdGNoXCJdKDIpO1xuICAgICAgICAgICAgX2RpZEl0ZXJhdG9yRXJyb3IgPSB0cnVlO1xuICAgICAgICAgICAgX2l0ZXJhdG9yRXJyb3IgPSBfY29udGV4dC50MjtcblxuICAgICAgICAgIGNhc2UgMzM6XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMzM7XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMzQ7XG5cbiAgICAgICAgICAgIGlmICghKCFfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uICYmIF9pdGVyYXRvcltcInJldHVyblwiXSAhPSBudWxsKSkge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMzg7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMzg7XG4gICAgICAgICAgICByZXR1cm4gX2F3YWl0QXN5bmNHZW5lcmF0b3IoX2l0ZXJhdG9yW1wicmV0dXJuXCJdKCkpO1xuXG4gICAgICAgICAgY2FzZSAzODpcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAzODtcblxuICAgICAgICAgICAgaWYgKCFfZGlkSXRlcmF0b3JFcnJvcikge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gNDE7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB0aHJvdyBfaXRlcmF0b3JFcnJvcjtcblxuICAgICAgICAgIGNhc2UgNDE6XG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuZmluaXNoKDM4KTtcblxuICAgICAgICAgIGNhc2UgNDI6XG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuZmluaXNoKDMzKTtcblxuICAgICAgICAgIGNhc2UgNDM6XG4gICAgICAgICAgY2FzZSBcImVuZFwiOlxuICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0LnN0b3AoKTtcbiAgICAgICAgfVxuICAgICAgfVxuICAgIH0sIF9jYWxsZWUsIG51bGwsIFtbMiwgMjksIDMzLCA0M10sIFszNCwsIDM4LCA0Ml1dKTtcbiAgfSkpO1xuICByZXR1cm4gX2FzeW5jRmxhdEludGVybmFsLmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7XG59XG5cbmZ1bmN0aW9uIF9fYXN5bmNGbGF0KHNvdXJjZSkge1xuICB2YXIgZGVwdGggPSBhcmd1bWVudHMubGVuZ3RoID4gMSAmJiBhcmd1bWVudHNbMV0gIT09IHVuZGVmaW5lZC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EZsYXQsIGRlcHRoLCBjdXJyZW50RGVwdGggKyAxLCB2YWx1ZSksIFwidDBcIiwgNyk7XG5cbiAgICAgICAgY2FzZSA3OlxuICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxMTtcbiAgICAgICAgICBicmVhaztcblxuICAgICAgICBjYXNlIDk6XG4gICAgICAgICAgX2NvbnRleHQubmV4dCA9IDExO1xuICAgICAgICAgIHJldHVybiB2YWx1ZTtcblxuICAgICAgICBjYXNlIDExOlxuICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAzO1xuICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgIGNhc2UgMTM6XG4gICAgICAgICAgX2NvbnRleHQubmV4dCA9IDE4O1xuICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgIGNhc2UgMTU6XG4gICAgICAgICAgX2NvbnRleHQucHJldiA9IDE1O1xuICAgICAgICAgIF9jb250ZXh0LnQxID0gX2NvbnRleHRbXCJjYXRjaFwiXSgxKTtcblxuICAgICAgICAgIF9pdGVyYXRvci5lKF9jb250ZXh0LnQxKTtcblxuICAgICAgICBjYXNlIDE4OlxuICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAxODtcblxuICAgICAgICAgIF9pdGVyYXRvci5mKCk7XG5cbiAgICAgICAgICByZXR1cm4gX2NvbnRleHQuZmluaXNoKDE4KTtcblxuICAgICAgICBjYXNlIDIxOlxuICAgICAgICBjYXNlIFwiZW5kXCI6XG4gICAgICAgICAgcmV0dXJuIF9jb250ZXh0LnN0b3AoKTtcbiAgICAgIH1cbiAgICB9XG4gIH0sIF9tYXJrZWQsIG51bGwsIFtbMSwgMTUsIDE4LCAyMV1dKTtcbn1cblxuZnVuY3Rpb24gX19mbGF0KHNvdXJjZSkge1xuICB2YXIgZGVwdGggPSBhcmd1bWVudHMubGVuZ3RoID4gMSAmJiBhcmd1bWVudHNbMV0gIT09IHVuZGVmaW5lZCA/IGFyZ3VtZW50c1sxXSA6IDE7XG4gIHZhciBzaG91b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yA9IDA7XG4gICAgICAgICAgICBfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uID0gdHJ1ZTtcbiAgICAgICAgICAgIF9kaWRJdGVyYXRvckVycm9yID0gZmFsc2U7XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMztcbiAgICAgICAgICAgIF9pdGVyYXRvciA9IF9hc3luY0l0ZXJhdG9yKGl0ZXJhYmxlKTtcblxuICAgICAgICAgIGNhc2UgNTpcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA3O1xuICAgICAgICAgICAgcmV0dXJuIF9pdGVyYXRvci5uZXh0KCk7XG5cbiAgICAgICAgICBjYXNlIDc6XG4gICAgICAgICAgICBfc3RlcCA9IF9jb250ZXh0LnNlbnQ7XG4gICAgICAgICAgICBfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uID0gX3N0ZXAuZG9uZTtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxMTtcbiAgICAgICAgICAgIHJldHVybiBfc3RlcC52YWx1ZTtcblxuICAgICAgICAgIGNhc2UgMTE6XG4gICAgICAgICAgICBfdmFsdWUgPSBfY29udGV4dC5zZW50O1xuXG4gICAgICAgICAgICBpZiAoX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbikge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTk7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB2YWx1ZSA9IF92YWx1ZTtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxNjtcbiAgICAgICAgICAgIHJldHVybiBjYWxsYmFjayh2YWx1ZSwgYysrKTtcblxuICAgICAgICAgIGNhc2UgMTY6XG4gICAgICAgICAgICBfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uID0gdHJ1ZTtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA1O1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICBjYXNlIDE5OlxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDI1O1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICBjYXNlIDIxOlxuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDIxO1xuICAgICAgICAgICAgX2NvbnRleHQudDAgPSBfY29udGV4dFtcImNhdGNoXCJdKDMpO1xuICAgICAgICAgICAgX2RpZEl0ZXJhdG9yRXJyb3IgPSB0cnVlO1xuICAgICAgICAgICAgX2l0ZXJhdG9yRXJyb3IgPSBfY29udGV4dC50MDtcblxuICAgICAgICAgIGNhc2UgMjU6XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMjU7XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMjY7XG5cbiAgICAgICAgICAgIGlmICghKCFfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uICYmIF9pdGVyYXRvcltcInJldHVyblwiXSAhPSBudWxsKSkge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMzA7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMzA7XG4gICAgICAgICAgICByZXR1cm4gX2l0ZXJhdG9yW1wicmV0dXJuXCJdKCk7XG5cbiAgICAgICAgICBjYXNlIDMwOlxuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDMwO1xuXG4gICAgICAgICAgICBpZiAoIV9kaWRJdGVyYXRvckVycm9yKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAzMztcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHRocm93IF9pdGVyYXRvckVycm9yO1xuXG4gICAgICAgICAgY2FzZSAzMzpcbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dC5maW5pc2goMzApO1xuXG4gICAgICAgICAgY2FzZSAzNDpcbiAgICAgICA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bmVyYXRvciggLyojX19QVVJFX18qL19yZWdlbmVyYXRvclJ1bnRpbWUubWFyayhmdW5jdGlvbiBfY2FsbGVlKHNvdXJjZSkge1xuICAgICAgICB2YXIgZXhjaGFuZ2U7XG4gICAgICAgIHJldHVybiBfcmVnZW5lcmF0b3JSdW50aW1lLndyYXAoZnVuY3Rpb24gX2NhbGxlZSQoX2NvbnRleHQpIHtcbiAgICAgICAgICB3aGlsZSAoMSkge1xuICAgICAgICAgICAgc3dpdGNoIChfY29udGV4dC5wcmV2ID0gX2NvbnRleHQubmV4dCkge1xuICAgICAgICAgICAgICBjYXNlIDA6XG4gICAgICAgICAgICAgICAgZXhjaGFuZ2UgPSBuZXcgQXN5bmNFeGNoYW5nZShhc3luY0Vuc3VyZUl0ZXJhYmxlKHNvdXJjZSlbU3ltYm9sLmFzeW5jSXRlcmF0b3JdKCkpO1xuICAgICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAzO1xuICAgICAgICAgICAgICAgIHJldHVybiBfZ2V0KF9nZXRQcm90b3R5cGVPZihBc3luY0ZvcmtlcmF0b3IpLCBcImZyb21cIiwgdGhpcykuY2FsbCh0aGlzLCBleGNoYW5nZS5mb3JrKCksIGV4Y2hhbmdlKTtcblxuICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0LmFicnVwdChcInJldHVyblwiLCBfY29udGV4dC5zZW50KTtcblxuICAgICAgICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgICAgIGNhc2UgXCJlbmRcIjpcbiAgICAgICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuc3RvcCgpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cbiAgICAgICAgfSwgX2NhbGxlZSwgdGhpcyk7XG4gICAgICB9KSk7XG5cbiAgICAgIGZ1bmN0aW9uIGZyb20oX3gpIHtcbiAgICAgICAgcmV0dXJuIF9mcm9tLmFwcGx5KHRoaXMsIGFyZ3VtZW50c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gICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgaWYgKCEoaSA8IG4pKSB7XG4gICAgICAgICAgICAgICAgICBfY29udGV4dDIubmV4dCA9IDk7XG4gICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBfY29udGV4dDIubmV4dCA9IDU7XG4gICAgICAgICAgICAgICAgcmV0dXJuIF9nZXQoX2dldFByb3RvdHlwZU9mKEFzeW5jRm9ya2VyYXRvci5wcm90b3R5cGUpLCBcImFkdmFuY2VcIiwgdGhpcykuY2FsbCh0aGlzKTtcblxuICAgICAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICAgICAgdGhpc1tfXS5leGNoYW5nZS5hZHZhbmNlKCk7XG5cbiAgICAgICAgICAgICAgY2FzZSA2OlxuICAgICAgICAgICAgICAgIGkrKztcbiAgICAgICAgICAgICAgICBfY29udGV4dDIubmV4dCA9IDI7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICAgICAgY2FzZSA5OlxuICAgICAgICAgICAgICAgIHJldHVybiBfY29udGV4dDIuYWJydXB0KFwicmV0dXJuXCIsIHRoaXMpO1xuXG4gICAgICAgICAgICAgIGNhc2UgMTA6XG4gICAgICAgICAgICAgIGNhc2UgXCJlbmRcIjpcbiAgICAgICAgICAgICAgICByZXR1cm4gX2NvbnRleHQyLnN0b3AoKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgIH0sIF9jYWxsZWUyLCB0aGlzKTtcbiAgICAgIH0pKTtcblxuICAgICAgZnVuY3Rpb24gYWR2YW5jZSgpIHtcbiAgICAgICAgcmV0dXJuIF9hZHZhbmNlLmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7XG4gICAgICB9XG5cbiAgICAgIHJldHVybiBhZHZhbmNlO1xuICAgIH0oKVxuICB9LCB7XG4gICAga2V5OiBcImZvcmtcIixcbiAgICB2YWx1ZTogZnVuY3Rpb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2ggKF9jb250ZXh0LnByZXYgPSBfY29udGV4dC5uZXh0KSB7XG4gICAgICAgICAgY2FzZSAwOlxuICAgICAgICAgICAgc2FtZSA9IF9hcmdzLmxlbmd0aCA+IDIgJiYgX2FyZ3NbMl0gIT09IHVuZGVmaW5lZCA/IF9hcmdzWzJdIDogT2JqZWN0LmlzO1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDM7XG4gICAgICAgICAgICByZXR1cm4gYXN5bmNTZXFzVG9BcnJheShzZXFzKTtcblxuICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgIHNlcXNBcnIgPSBfY29udGV4dC5zZW50O1xuXG4gICAgICAgICAgICBpZiAoc2Vxc0Fyci5sZW5ndGgpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDY7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuYWJydXB0KFwicmV0dXJuXCIsIGZhbHNlKTtcblxuICAgICAgICAgIGNhc2UgNjpcbiAgICAgICAgICAgIGlmICghc2Vxc0Fyci5maW5kKGZ1bmN0aW9uIChzZXEpIHtcbiAgICAgICAgICAgICAgcmV0dXJuICFzZXEubGVuZ3RoO1xuICAgICAgICAgICAgfSkpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDg7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuYWJydXB0KFwicmV0dXJuXCIsIHRydWUpO1xuXG4gICAgICAgICAgY2FzZSA4OlxuICAgICAgICAgICAgbWF4TWF0Y2hMZW5ndGggPSBzZXFzQXJyLnJlZHVjZShmdW5jdGlvbiAobWF4LCBfcmVmKSB7XG4gICAgICAgICAgICAgIHZhciBsZW5ndGggPSBfcmVmLmxlbmd0aDtcbiAgICAgICAgICAgICAgcmV0dXJuIE1hdGgubWF4KG1heCwgbGVuZ3RoKTtcbiAgICAgICAgICAgIH0sIDEpO1xuICAgICAgICAgICAgX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiA9IHRydWU7XG4gICAgICAgICAgICBfZGlkSXRlcmF0b3JFcnJvciA9IGZhbHNlO1xuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDExO1xuICAgICAgICAgICAgX2l0ZXJhdG9yID0gX2FzeW5jSXRlcmF0b3IoX19hc3luY1dpbmRvd0FoZWFkKGl0ZXJhYmxlLCBtYXhNYXRjaExlbmd0aCkpO1xuXG4gICAgICAgICAgY2FzZSAxMzpcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxNTtcbiAgICAgICAgICAgIHJldHVybiBfaXRlcmF0b3IubmV4dCgpO1xuXG4gICAgICAgICAgY2FzZSAxNTpcbiAgICAgICAgICAgIF9zdGVwID0gX2NvbnRleHQuc2VudDtcbiAgICAgICAgICAgIF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gPSBfc3RlcC5kb25lO1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDE5O1xuICAgICAgICAgICAgcmV0dXJuIF9zdGVwLnZhbHVlO1xuXG4gICAgICAgICAgY2FzZSAxOTpcbiAgICAgICAgICAgIF92YWx1ZSA9IF9jb250ZXh0LnNlbnQ7XG5cbiAgICAgICAgICAgIGlmIChfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyNztcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGJ1ZmZlciA9IF92YWx1ZTtcblxuICAgICAgICAgICAgaWYgKCFfX3N0YXJ0c1dpdGhBbnlTZXEoYnVmZmVyLCBzZXFzQXJyLCBzYW1lKSkge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMjQ7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuYWJydXB0KFwicmV0dXJuXCIsIHRydWUpO1xuXG4gICAgICAgICAgY2FzZSAyNDpcbiAgICAgICAgICAgIF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gPSB0cnVlO1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDEzO1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICBjYXNlIDI3OlxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDMzO1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICBjYXNlIDI5OlxuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDI5O1xuICAgICAgICAgICAgX2NvbnRleHQudDAgPSBfY29udGV4dFtcImNhdGNoXCJdKDExKTtcbiAgICAgICAgICAgIF9kaWRJdGVyYXRvckVycm9yID0gdHJ1ZTtcbiAgICAgICAgICAgIF9pdGVyYXRvckVycm9yID0gX2NvbnRleHQudDA7XG5cbiAgICAgICAgICBjYXNlIDMzOlxuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDMzO1xuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDM0O1xuXG4gICAgICAgICAgICBpZiAoISghX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiAmJiBfaXRlcmF0b3JbXCJyZXR1cm5cIl0gIT0gbnVsbCkpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDM4O1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDM4O1xuICAgICAgICAgICAgcmV0dXJuIF9pdGVyYXRvcltcInJldHVyblwiXSgpO1xuXG4gICAgICAgICAgY2FzZSAzODpcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAzODtcblxuICAgICAgICAgICAgaWYgKCFfZGlkSXRlcmF0b3JFcnJvcikge1xuICAgICAgICAgIC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W5jSW5jbHVkZXMgPSBfYXN5bmNUb0dlbmVyYXRvciggLyojX19QVVJFX18qL19yZWdlbmVyYXRvclJ1bnRpbWUubWFyayhmdW5jdGlvbiBfY2FsbGVlKGl0ZXJhYmxlLCB2YWx1ZSkge1xuICAgIHZhciBzYW1lLFxuICAgICAgICBfYXJncyA9IGFyZ3VtZW50cztcbiAgICByZXR1cm4gX3JlZ2VuZXJhdG9yUnVudGltZS53cmFwKGZ1bmN0aW9uIF9jYWxsZWUkKF9jb250ZXh0KSB7XG4gICAgICB3aGlsZSAoMSkge1xuICAgICAgICBzd2l0Y2ggKF9jb250ZXh0LnByZXYgPSBfY29udGV4dC5uZXh0KSB7XG4gICAgICAgICAgY2FzZSAwOlxuICAgICAgICAgICAgc2FtZSA9IF9hcmdzLmxlbmd0aCA+IDIgJiYgX2FyZ3NbMl0gIT09IHVuZGVmaW5lZCA/IF9hcmdzWzJdIDogT2JqZWN0LmlzO1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDM7XG4gICAgICAgICAgICByZXR1cm4gX19hc3luY0ZpbmRPcihpdGVyYWJsZSwgbm9uZSwgZnVuY3Rpb24gKHYpIHtcbiAgICAgICAgICAgICAgcmV0dXJuIHNhbWUodmFsdWUsIHYpO1xuICAgICAgICAgICAgfSk7XG5cbiAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICBfY29udGV4dC50MCA9IF9jb250ZXh0LnNlbnQ7XG4gICAgICAgICAgICBfY29udGV4dC50MSA9IG5vbmU7XG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuYWJydXB0KFwicmV0dXJuXCIsIF9jb250ZXh0LnQwICE9PSBfY29udGV4dC50MSk7XG5cbiAgICAgICAgICBjYXNlIDY6XG4gICAgICAgICAgY2FzZSBcImVuZFwiOlxuICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0LnN0b3AoKTtcbiAgICAgICAgfVxuICAgICAgfVxuICAgIH0sIF9jYWxsZWUpO1xuICB9KSk7XG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VdKCk7XG5cbiAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgIHRoaXMuaW5kZXgrKztcblxuICAgICAgICAgICAgICAgIGlmICghd2FzRG9uZSAmJiBidWZmZXIuZG9uZSkge1xuICAgICAgICAgICAgICAgICAgdGhpcy51cGRhdGVOb3REb25lKCk7XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgIGNhc2UgNTpcbiAgICAgICAgICAgICAgY2FzZSBcImVuZFwiOlxuICAgICAgICAgICAgICAgIHJldHVybiBfY29udGV4dDMuc3RvcCgpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cbiAgICAgICAgfSwgX2NhbGxlZTMsIHRoaXMpO1xuICAgICAgfSkpO1xuXG4gICAgICBmdW5jdGlvbiBhZHZhbmNlQnVmZmVyKF94KSB7XG4gICAgICAgIHJldHVybiBfYWR2YW5jZUJ1ZmZlci5hcHBseSh0aGlzLCBhcmd1bWVudHMpO1xuICAgICAgfVxuXG4gICAgICByZXR1cm4gYWR2YW5jZUJ1ZmZlcjtcbiAgICB9KClcbiAgfV0pO1xuXG4gIHJldHVybiBBc3luY0lucHV0U3VtbWFyeUludGVybmFsO1xufSgpO1xuXG52YXIgQXN5bmNJbnB1dFN1bW1hcnkgPSAvKiNfX1BVUkVfXyovZnVuY3Rpb24gKCkge1xuICBmdW5jdGlvbiBBc3luY0lucHV0U3VtbWFyeShpbnRlcm5hbCkge1xuICAgIF9jbGFzc0NhbGxDaGVjayh0aGlzLCBBc3luY0lucHV0U3VtbWFyeSk7XG5cbiAgICB0aGlzW19dID0gaW50ZXJuYWw7XG4gIH1cblxuICBfY3JlYXRlQ2xhc3MoQXN5bmNJbnB1dFN1bW1hcnksIFt7XG4gICAga2V5OiBcImFkdmFuY2VcIixcbiAgICB2YWx1ZTogZnVuY3Rpb24gYWR2YW5jZSgpIHtcbiAgICAgIHRocm93IG5ldyBFcnJvcignYWR2YW5jZSgpIGlzIG5vdCBzdXBwb3J0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m9wdGlvbnMsIGlucHV0U3VtbWFyeSA9IHRoaXMuaW5wdXRTdW1tYXJ5O1xuICAgICAgICAgICAgICAgIF9jb250ZXh0NC5uZXh0ID0gNDtcbiAgICAgICAgICAgICAgICByZXR1cm4gX19hc3luY1RvQXJyYXkoX19hc3luY01hcCh0aGlzLnNvdXJjZXMsIGZ1bmN0aW9uIChzb3VyY2UpIHtcbiAgICAgICAgICAgICAgICAgIHJldHVybiBBc3luY1N1bW1hcml6ZWRQZWVrZXJhdG9yLmZyb20oc291cmNlLCBpbnB1dFN1bW1hcnkpO1xuICAgICAgICAgICAgICAgIH0pKTtcblxuICAgICAgICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgICAgICAgdGhpcy5idWZmZXJzID0gX2NvbnRleHQ0LnNlbnQ7XG4gICAgICAgICAgICAgICAgdGhpcy5pdGVyYXRvciA9IHN0cmF0ZWd5LmFwcGx5KHZvaWQgMCwgW29wdGlvbnMsIG5ldyBBc3luY0lucHV0U3VtbWFyeShpbnB1dFN1bW1hcnkpXS5jb25jYXQoX3RvQ29uc3VtYWJsZUFycmF5KHRoaXMuYnVmZmVycykpKTtcbiAgICAgICAgICAgICAgICBfY29udGV4dDQubmV4dCA9IDg7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGlucHV0U3VtbWFyeS5pbml0KHRoaXMuYnVmZmVycyk7XG5cbiAgICAgICAgICAgICAgY2FzZSA4OlxuICAgICAgICAgICAgICBjYXNlIFwiZW5kXCI6XG4gICAgICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0NC5zdG9wKCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuICAgICAgICB9LCBfY2FsbGVlNCwgdGhpcyk7XG4gICAgICB9KSk7XG5cbiAgICAgIGZ1bmN0aW9uIGluaXQoKSB7XG4gICAgICAgIHJldHVybiBfaW5pdC5hcHBseSh0aGlzLCBhcmd1bWVudHMpO1xuICAgICAgfVxuXG4gICAgICByZXR1cm4gaW5pdDtcbiAgICB9KClcbiAgfSwge1xuICAgIGtleTogXCJyZXR1cm5CdWZmZXJzXCIsXG4gICAgdmFsdWU6IGZ1bmN0aW9uICgpIHtcbiAgICAgIHZhciBfcmV0dXJuQnVmZmVycyA9IF9hc3luY1RvR2VuZXJhdG9yKCAvKiNfX1BVUkVfXyovX3JlZ2VuZXJhdG9yUnVudGltZS5tYXJrKGZ1bmN0aW9uIF9jYWxsZWU1KCkge1xuICAgICAgICByZXR1cm4gX3JlZ2VuZXJhdG9yUnVudGltZS53cmFwKGZ1bmN0aW9uIF9jYWxsZWU1JChfY29udGV4dDUpIHtcbiAgICAgICAgICB3aGlsZSAoMSkge1xuICAgICAgICAgICAgc3dpdGNoIChfY29udGV4dDUucHJldiA9IF9jb250ZXh0NS5uZXh0KSB7XG4gICAgICAgICAgICAgIGNhc2UgMDpcbiAgICAgICAgICAgICAgICBfY29udGV4dDUubmV4dCA9IDI7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGFzeW5jUGFyYWxsZWxFYWNoKHRoaXMuYnVmZmVycywgZnVuY3Rpb24gKGJ1ZmZlcikge1xuICAgICAgICAgICAgICAgICAgcmV0dXJuIGJ1ZmZlcltcInJldHVyblwiXSgpO1xuICAgICAgICAgICAgICAgIH0pO1xuXG4gICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgY2FzZSBcImVuZFwiOlxuICAgICAgICAgICAgICAgIHJldHVybiBfY29udGV4dDUuc3RvcCgpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cbiAgICAgICAgfSwgX2NhbGxlZTUsIHRoaXMpO1xuICAgICAgfSkpO1xuXG4gICAgICBmdW5jdGlvbiByZXR1cm5CdWZmZXJzKCkge1xuICAgICAgICByZXR1cm4gX3JldHVybkJ1ZmZlcnMuYXBwbHkodGhpcywgYXJndW1lbnRzKTtcbiAgICAgIH1cblxuICAgICAgcmV0dXJuIHJldHVybkJ1ZmZlcnM7XG4gICAgfSgpXG4gIH0sIHtcbiAgICBrZXk6IFwibmV4dFwiLFxuICAgIHZhbHVlOiBmdW5jdGlvbiAoKSB7XG4gICAgICB2YXIgX25leHQgPSBfYXN5bmNUb0dlbmVyYXRvciggLyojX19QVVJFX18qL19yZWdlbmVyYXRvclJ1bnRpbWUubWFyayhmdW5jdGlvbiBfY2FsbGVlNigpIHtcbiAgICAgICAgdmFyIHN0ZXA7XG4gICAgICAgIHJldHVybiBfcmVnZW5lcmF0b3JSdW50aW1lLndyYXAoZnVuY3Rpb24gX2NhbGxlZTYkKF9jb250ZXh0Nikge1xuICAgICAgICAgIHdoaWxlICgxKSB7XG4gICAgICAgICAgICBzd2l0Y2ggKF9jb250ZXh0Ni5wcmV2ID0gX2NvbnRleHQ2Lm5leHQpIHtcbiAgICAgICAgICAgICAgY2FzZSAwOlxuICAgICAgICAgICAgICAgIGlmICh0aGlzLmluaXRpYWxpemVkKSB7XG4gICAgICAgICAgICAgICAgICBfY29udGV4dDYubmV4dCA9IDM7XG4gICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBfY29udGV4dDYubmV4dCA9IDM7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuaW5pdCgpO1xuXG4gICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICBfY29udGV4dDYubmV4dCA9IDU7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuaXRlcmF0b3IubmV4dCgpO1xuXG4gICAgICAgICAgICAgIGNhc2UgNTpcbiAgICAgICAgICAgICAgICBzdGVwID0gX2NvbnRleHQ2LnNlbnQ7XG5cbiAgICAgICAgICAgICAgICBpZiAoIXN0ZXAuZG9uZSkge1xuICAgICAgICAgICAgICAgICAgX2NvbnRleHQ2Lm5leHQgPSA5O1xuICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgX2NvbnRleHQ2Lm5leHQgPSA5O1xuICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnJldHVybkJ1ZmZlcnMoKTtcblxuICAgICAgICAgICAgICBjYXNlIDk6XG4gICAgICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0Ni5hYnJ1cHQoXCJyZXR1cm5cIiwgc3RlcCk7XG5cbiAgICAgICAgICAgICAgY2FzZSAxMDpcbiAgICAgICAgICAgICAgY2FzZSBcImVuZFwiOlxuICAgICAgICAgICAgICAgIHJldHVybiBfY29udGV4dDYuc3RvcCgpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cbiAgICAgICAgfSwgX2NhbGxlZTYsIHRoaXMpO1xuICAgICAgfSkpO1xuXG4gICAgICBmdW5jdGlvbiBuZXh0KCkge1xuICAgICAgICByZXR1cm4gX25leHQuYXBwbHkodGhpcywgYXJndW1lbnRzKTtcbiAgICAgIH1cblxuICAgICAgcmV0dXJuIG5leHQ7XG4gICAgfSgpXG4gIH0sIHtcbiAgICBrZXk6IFwicmV0dXJuXCIsXG4gICAgdmFsdWU6IGZ1bmN0aW9uICgpIHtcbiAgICAgIHZhciBfcmV0dXJuMiA9IF9hc3luY1RvR2VuZXJhdG9yKCAvKiNfX1BVUkVfXyovX3JlZ2VuZXJhdG9yUnVudGltZS5tYXJrKGZ1bmN0aW9uIF9jYWxsZWU3KCkge1xuICAgICAgICByZXR1cm4gX3JlZ2VuZXJhdG9yUnVudGltZS53cmFwKGZ1bmN0aW9uIF9jYWxsZWU3JChfY29udGV4dDcpIHtcbiAgICAgICAgICB3aGlsZSAoMSkge1xuICAgICAgICAgICAgc3dpdGNoIChfY29udGV4dDcucHJldiA9IF9jb250ZXh0Ny5uZXh0KSB7XG4gICAgICAgICAgICAgIGNhc2UgMDpcbiAgICAgICAgICAgICAgICBfY29udGV4dDcubmV4dCA9IDI7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGFzeW5jQ2FsbFJldHVybih0aGlzLml0ZXJhdG9yKTtcblxuICAgICAgICAgICAgICBjYXNlIDI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QucHJldiA9IDY7XG4gICAgICAgICAgICBfaXRlcmF0b3IgPSBfYXN5bmNJdGVyYXRvcihzb3VyY2UpO1xuXG4gICAgICAgICAgY2FzZSA4OlxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDEwO1xuICAgICAgICAgICAgcmV0dXJuIF9hd2FpdEFzeW5jR2VuZXJhdG9yKF9pdGVyYXRvci5uZXh0KCkpO1xuXG4gICAgICAgICAgY2FzZSAxMDpcbiAgICAgICAgICAgIF9zdGVwID0gX2NvbnRleHQuc2VudDtcbiAgICAgICAgICAgIF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gPSBfc3RlcC5kb25lO1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDE0O1xuICAgICAgICAgICAgcmV0dXJuIF9hd2FpdEFzeW5jR2VuZXJhdG9yKF9zdGVwLnZhbHVlKTtcblxuICAgICAgICAgIGNhc2UgMTQ6XG4gICAgICAgICAgICBfdmFsdWUgPSBfY29udGV4dC5zZW50O1xuXG4gICAgICAgICAgICBpZiAoX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbikge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMjU7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBzb3VyY2VWYWx1ZSA9IF92YWx1ZTtcblxuICAgICAgICAgICAgaWYgKGZpcnN0KSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxOTtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dC5kZWxlZ2F0ZVlpZWxkKF9hc3luY0dlbmVyYXRvckRlbGVnYXRlKF9hc3luY0l0ZXJhdG9yKHN1YnNlcV8pLCBfYXdhaXRBc3luY0dlbmVyYXRvciksIFwidDBcIiwgMTkpO1xuXG4gICAgICAgICAgY2FzZSAxOTpcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyMTtcbiAgICAgICAgICAgIHJldHVybiBzb3VyY2VWYWx1ZTtcblxuICAgICAgICAgIGNhc2UgMjE6XG4gICAgICAgICAgICBmaXJzdCA9IGZhbHNlO1xuXG4gICAgICAgICAgY2FzZSAyMjpcbiAgICAgICAgICAgIF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gPSB0cnVlO1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDg7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgIGNhc2UgMjU6XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMzE7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgIGNhc2UgMjc6XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMjc7XG4gICAgICAgICAgICBfY29udGV4dC50MSA9IF9jb250ZXh0W1wiY2F0Y2hcIl0oNik7XG4gICAgICAgICAgICBfZGlkSXRlcmF0b3JFcnJvciA9IHRydWU7XG4gICAgICAgICAgICBfaXRlcmF0b3JFcnJvciA9IF9jb250ZXh0LnQxO1xuXG4gICAgICAgICAgY2FzZSAzMTpcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAzMTtcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAzMjtcblxuICAgICAgICAgICAgaWYgKCEoIV9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gJiYgX2l0ZXJhdG9yW1wicmV0dXJuXCJdICE9IG51bGwpKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAzNjtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAzNjtcbiAgICAgICAgICAgIHJldHVybiBfYXdhaXRBc3luY0dlbmVyYXRvcihfaXRlcmF0b3JbXCJyZXR1cm5cIl0oKSk7XG5cbiAgICAgICAgICBjYXNlIDM2OlxuICAgICAgICAgICAg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3Vic2VxXywgXCJ0MFwiLCA5KTtcblxuICAgICAgICBjYXNlIDk6XG4gICAgICAgICAgX2NvbnRleHQubmV4dCA9IDExO1xuICAgICAgICAgIHJldHVybiBzb3VyY2VWYWx1ZTtcblxuICAgICAgICBjYXNlIDExOlxuICAgICAgICAgIGZpcnN0ID0gZmFsc2U7XG5cbiAgICAgICAgY2FzZSAxMjpcbiAgICAgICAgICBfY29udGV4dC5uZXh0ID0gNTtcbiAgICAgICAgICBicmVhaztcblxuICAgICAgICBjYXNlIDE0OlxuICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxOTtcbiAgICAgICAgICBicmVhaztcblxuICAgICAgICBjYXNlIDE2OlxuICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAxNjtcbiAgICAgICAgICBfY29udGV4dC50MSA9IF9jb250ZXh0W1wiY2F0Y2hcIl0oMyk7XG5cbiAgICAgICAgICBfaXRlcmF0b3IuZShfY29udGV4dC50MSk7XG5cbiAgICAgICAgY2FzZSAxOTpcbiAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMTk7XG5cbiAgICAgICAgICBfaXRlcmF0b3IuZigpO1xuXG4gICAgICAgICAgcmV0dXJuIF9jb250ZXh0LmZpbmlzaCgxOSk7XG5cbiAgICAgICAgY2FzZSAyMjpcbiAgICAgICAgY2FzZSBcImVuZFwiOlxuICAgICAgICAgIHJldHVybiBfY29udGV4dC5zdG9wKCk7XG4gICAgICB9XG4gICAgfVxuICB9LCBfbWFya2VkLCBudWxsLCBbWzMsIDE2LCAxOSwgMjJdXSk7XG59XG5cbmV4cG9ydHMuX19pbnRlcnBvc2VTZXEgPSBfX2ludGVycG9zZVNlcTtcbnZhciBpbnRlcnBvc2VTZXEgPSAvKiNfX1BVUkVfXyovaXRlcmFibGVDdXJyeShfX2ludGVycG9zZVNlcSk7XG5leHBvcnRzLmludGVycG9zZVNlcSA9IGludGVycG9zZVNlcTsiLCJ2YXIgX3JlcXVpcmUgPSByZXF1aXJlKCcuLi8u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bnRleHQubmV4dCA9IDM7XG4gICAgICAgICAgICByZXR1cm4gX19hc3luY1BlZWtlcmF0ZShpdGVyYWJsZSk7XG5cbiAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICBwZWVrciA9IF9jb250ZXh0LnNlbnQ7XG5cbiAgICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgICBpZiAocGVla3IuZG9uZSkge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTQ7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB2YWx1ZSA9IHBlZWtyLnZhbHVlO1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDg7XG4gICAgICAgICAgICByZXR1cm4gcGVla3IuYWR2YW5jZSgpO1xuXG4gICAgICAgICAgY2FzZSA4OlxuICAgICAgICAgICAgaWYgKCEoIXBlZWtyLmRvbmUgJiYgY29tcGFyZSh2YWx1ZSwgcGVla3IudmFsdWUpID4gMCkpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDEyO1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDExO1xuICAgICAgICAgICAgcmV0dXJuIHBlZWtyW1wicmV0dXJuXCJdKCk7XG5cbiAgICAgICAgICBjYXNlIDExOlxuICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0LmFicnVwdChcInJldHVyblwiLCBmYWxzZSk7XG5cbiAgICAgICAgICBjYXNlIDEyOlxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDQ7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgIGNhc2UgMTQ6XG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuYWJydXB0KFwicmV0dXJuXCIsIHRydWUpO1xuXG4gICAgICAgICAgY2FzZSAxNTpcbiAgICAgICAgICBjYXNlIFwiZW5kXCI6XG4gICAgICAgICA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Y29udGV4dC5uZXh0KSB7XG4gICAgICAgICAgY2FzZSAwOlxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDI7XG4gICAgICAgICAgICByZXR1cm4gX2F3YWl0QXN5bmNHZW5lcmF0b3IoX19hc3luY1RvQXJyYXkoc2VwYXJhdG9yU2VxKSk7XG5cbiAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICBfc2VwYXJhdG9yU2VxID0gX2NvbnRleHQuc2VudDtcbiAgICAgICAgICAgIGlzRmlyc3QgPSB0cnVlO1xuICAgICAgICAgICAgX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiA9IHRydWU7XG4gICAgICAgICAgICBfZGlkSXRlcmF0b3JFcnJvciA9IGZhbHNlO1xuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDY7XG4gICAgICAgICAgICBfaXRlcmF0b3IgPSBfYXN5bmNJdGVyYXRvcihzb3VyY2UpO1xuXG4gICAgICAgICAgY2FzZSA4OlxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDEwO1xuICAgICAgICAgICAgcmV0dXJuIF9hd2FpdEFzeW5jR2VuZXJhdG9yKF9pdGVyYXRvci5uZXh0KCkpO1xuXG4gICAgICAgICAgY2FzZSAxMDpcbiAgICAgICAgICAgIF9zdGVwID0gX2NvbnRleHQuc2VudDtcbiAgICAgICAgICAgIF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gPSBfc3RlcC5kb25lO1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDE0O1xuICAgICAgICAgICAgcmV0dXJuIF9hd2FpdEFzeW5jR2VuZXJhdG9yKF9zdGVwLnZhbHVlKTtcblxuICAgICAgICAgIGNhc2UgMTQ6XG4gICAgICAgICAgICBfdmFsdWUgPSBfY29udGV4dC5zZW50O1xuXG4gICAgICAgICAgICBpZiAoX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbikge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMjQ7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB2YWx1ZSA9IF92YWx1ZTtcblxuICAgICAgICAgICAgaWYgKGlzRmlyc3QpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDE5O1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0LmRlbGVnYXRlWWllbGQoX2FzeW5jR2VuZXJhdG9yRGVsZWdhdGUoX2FzeW5jSXRlcmF0b3IoX3NlcGFyYXRvclNlcSksIF9hd2FpdEFzeW5jR2VuZXJhdG9yKSwgXCJ0MFwiLCAxOSk7XG5cbiAgICAgICAgICBjYXNlIDE5OlxuICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0LmRlbGVnYXRlWWllbGQoX2FzeW5jR2VuZXJhdG9yRGVsZWdhdGUoX2FzeW5jSXRlcmF0b3IodmFsdWUpLCBfYXdhaXRBc3luY0dlbmVyYXRvciksIFwidDFcIiwgMjApO1xuXG4gICAgICAgICAgY2FzZSAyMDpcbiAgICAgICAgICAgIGlzRmlyc3QgPSBmYWxzZTtcblxuICAgICAgICAgIGNhc2UgMjE6XG4gICAgICAgICAgICBfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uID0gdHJ1ZTtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA4O1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICBjYXNlIDI0OlxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDMwO1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICBjYXNlIDI2OlxuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDI2O1xuICAgICAgICAgICAgX2NvbnRleHQudDIgPSBfY29udGV4dFtcImNhdGNoXCJdKDYpO1xuICAgICAgICAgICAgX2RpZEl0ZXJhdG9yRXJyb3IgPSB0cnVlO1xuICAgICAgICAgICAgX2l0ZXJhdG9yRXJyb3IgPSBfY29udGV4dC50MjtcblxuICAgICAgICAgIGNhc2UgMzA6XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMzA7XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMzE7XG5cbiAgICAgICAgICAgIGlmICghKCFfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uICYmIF9pdGVyYXRvcltcInJldHVyblwiXSAhPSBudWxsKSkge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMzU7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMzU7XG4gICAgICAgICAgICByZXR1cm4gX2F3YWl0QXN5bmNHZW5lcmF0b3IoX2l0ZXJhdG9yW1wicmV0dXJuXCJdKCkpO1xuXG4gICAgICAgICAgY2FzZSAzNTpcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAzNTtcblxuICAgICAgICAgICAgaWYgKCFfZGlkSXRlcmF0b3JFcnJvcikge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMzg7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB0aHJvdyBfaXRlcmF0b3JFcnJvcjtcblxuICAgICAgICAgIGNhc2UgMzg6XG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuZmluaXNoKDM1KTtcblxuICAgICAgICAgIGNhc2UgMzk6XG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuZmluaXNoKDMwKTtcblxuICAgICAgICAgIGNhc2UgNDA6XG4gICAgICAgICAgY2FzZSBcImVuZFwiOlxuICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0LnN0b3AoKTtcbiAgICAgICAgfVxuICAgICAgfVxuICAgIH0sIF9jYWxsZWUsIG51bGwsIFtbNiwgMjYsIDMwLCA0MF0sIFszMSwsIDM1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lxuICAgICAgICAgIF9zZXBhcmF0b3JTZXEgPSBfX3RvQXJyYXkoc2VwYXJhdG9yU2VxKTtcbiAgICAgICAgICBpc0ZpcnN0ID0gdHJ1ZTtcbiAgICAgICAgICBfaXRlcmF0b3IgPSBfY3JlYXRlRm9yT2ZJdGVyYXRvckhlbHBlcihzb3VyY2UpO1xuICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAzO1xuXG4gICAgICAgICAgX2l0ZXJhdG9yLnMoKTtcblxuICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgaWYgKChfc3RlcCA9IF9pdGVyYXRvci5uKCkpLmRvbmUpIHtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxMztcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIHZhbHVlID0gX3N0ZXAudmFsdWU7XG5cbiAgICAgICAgICBpZiAoaXNGaXJzdCkge1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDk7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgICB9XG5cbiAgICAgICAgICByZXR1cm4gX2NvbnRleHQuZGVsZWdhdGVZaWVsZChfc2VwYXJhdG9yU2VxLCBcInQwXCIsIDkpO1xuXG4gICAgICAgIGNhc2UgOTpcbiAgICAgICAgICByZXR1cm4gX2NvbnRleHQuZGVsZWdhdGVZaWVsZCh2YWx1ZSwgXCJ0MVwiLCAxMCk7XG5cbiAgICAgICAgY2FzZSAxMDpcbiAgICAgICAgICBpc0ZpcnN0ID0gZmFsc2U7XG5cbiAgICAgICAgY2FzZSAxMTpcbiAgICAgICAgICBfY29udGV4dC5uZXh0ID0gNTtcbiAgICAgICAgICBicmVhaztcblxuICAgICAgICBjYXNlIDEzOlxuICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxODtcbiAgICAgICAgICBicmVhaztcblxuICAgICAgICBjYXNlIDE1OlxuICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAxNTtcbiAgICAgICAg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F0b3JOb3JtYWxDb21wbGV0aW9uID0gX3N0ZXAuZG9uZTtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxMTtcbiAgICAgICAgICAgIHJldHVybiBfYXdhaXRBc3luY0dlbmVyYXRvcihfc3RlcC52YWx1ZSk7XG5cbiAgICAgICAgICBjYXNlIDExOlxuICAgICAgICAgICAgX3ZhbHVlID0gX2NvbnRleHQuc2VudDtcblxuICAgICAgICAgICAgaWYgKF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24pIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDE5O1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdmFsdWUgPSBfdmFsdWU7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTY7XG4gICAgICAgICAgICByZXR1cm4gZnVuYyh2YWx1ZSwgYysrKTtcblxuICAgICAgICAgIGNhc2UgMTY6XG4gICAgICAgICAgICBfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uID0gdHJ1ZTtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA1O1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICBjYXNlIDE5OlxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDI1O1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICBjYXNlIDIxOlxuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDIxO1xuICAgICAgICAgICAgX2NvbnRleHQudDAgPSBfY29udGV4dFtcImNhdGNoXCJdKDMpO1xuICAgICAgICAgICAgX2RpZEl0ZXJhdG9yRXJyb3IgPSB0cnVlO1xuICAgICAgICAgICAgX2l0ZXJhdG9yRXJyb3IgPSBfY29udGV4dC50MDtcblxuICAgICAgICAgIGNhc2UgMjU6XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMjU7XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMjY7XG5cbiAgICAgICAgICAgIGlmICghKCFfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uICYmIF9pdGVyYXRvcltcInJldHVyblwiXSAhPSBudWxsKSkge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMzA7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMzA7XG4gICAgICAgICAgICByZXR1cm4gX2F3YWl0QXN5bmNHZW5lcmF0b3IoX2l0ZXJhdG9yW1wicmV0dXJuXCJdKCkpO1xuXG4gICAgICAgICAgY2FzZSAzMDpcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAzMDtcblxuICAgICAgICAgICAgaWYgKCFfZGlkSXRlcmF0b3JFcnJvcikge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMzM7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB0aHJvdyBfaXRlcmF0b3JFcnJvcjtcblxuICAgICAgICAgIGNhc2UgMzM6XG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuZmluaXNoKDMwKTtcblxuICAgICAgICAgIGNhc2UgMzQ6XG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuZmluaXNoKDI1KTtcblxuICAgICAgICAgIGNhc2UgMzU6XG4gICAgICAgICAgY2FzZSBcImVuZFwiOlxuICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0LnN0b3AoKTtcbiAgICAgICAgfVxuICAgICAgfVxuICAgIH0sIF9jYWxsZWUsIG51bGwsIFtbMywgMjEsIDI1LCAzNV0sIFsyNiwsIDMwLCAzNF1dKTtcbiAgfSkpO1xuICByZXR1cm4gX2FzeW5jTWFwLmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7XG59XG5cbnZhciBhc3luY01hcCA9IC8qI19fUFVSRV9fKi9hc3luY0l0ZXJhYmxlQ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QgPSA4O1xuICAgICAgICAgIHJldHVybiBmdW5jKHZhbHVlLCBjKyspO1xuXG4gICAgICAgIGNhc2UgODpcbiAgICAgICAgICBfY29udGV4dC5uZXh0ID0gNDtcbiAgICAgICAgICBicmVhaztcblxuICAgICAgICBjYXNlIDEwOlxuICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxNTtcbiAgICAgICAgICBicmVhaztcblxuICAgICAgICBjYXNlIDEyOlxuICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAxMjtcbiAgICAgICAgICBfY29udGV4dC50MCA9IF9jb250ZXh0W1wiY2F0Y2hcIl0oMik7XG5cbiAgICAgICAgICBfaXRlcmF0b3IuZShfY29udGV4dC50MCk7XG5cbiAgICAgICAgY2FzZSAxNTpcbiAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMTU7XG5cbiAgICAgICAgICBfaXRlcmF0b3IuZigpO1xuXG4gICAgICAgICAgcmV0dXJuIF9jb250ZXh0LmZpbmlzaCgxNSk7XG5cbiAgICAgICAgY2FzZSAxODpcbiAgICAgICAgY2FzZSBcImVuZFwiOlxuICAgICAgICAgIHJldHVybiBfY29udGV4dC5zdG9wKCk7XG4gICAgICB9XG4gICAgfVxuICB9LCBfbWFya2VkLCBudWxsLCBbWzIsIDEyLCAxNSwgMThdXSk7XG59XG5cbmV4cG9ydHMuX19tYXAgPSBfX21hcDtcbnZhciBtYXAgPSAvKiNfX1BVUkVfXyovaXRlcmFibGVDdXJyeShfX21hcCk7XG5leHBvcnRzLm1hcCA9IG1hcDsiLCJ2YXIgX3JlcXVpcmUgPSByZXF1aXJlKCcuLi8uLi9pbnRlcm5hbC9hc3luYy1pdGVyYWJsZS5qcycpLFxuICAgIGFzeW5jRW5zdXJlSXRlcmFibGUgPSBfcmVxdWlyZS5hc3luY0Vuc3VyZUl0ZXJhYmxlO1xuXG52YXIgX3JlcXVpcmUyID0gcmVxdWlyZSgnLi4vLi4vaW50ZXJuYWwvYXN5bmMtcGVla2VyYXRvci5q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5pdGlhbCA9IF9hcmdzLmxlbmd0aCA+IDIgJiYgX2FyZ3NbMl0gIT09IHVuZGVmaW5lZCA/IF9hcmdzWzJdIDogdW5kZWZpbmVkO1xuICAgICAgICAgICAgYyA9IDA7XG4gICAgICAgICAgICByZXN1bHQgPSBpbml0aWFsO1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDU7XG4gICAgICAgICAgICByZXR1cm4gX19hc3luY1BlZWtlcmF0ZShpdGVyYWJsZSk7XG5cbiAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICBwZWVrciA9IF9jb250ZXh0LnNlbnQ7XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gNjtcblxuICAgICAgICAgICAgaWYgKCEoaW5pdGlhbCA9PT0gdW5kZWZpbmVkKSkge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTQ7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBpZiAoIXBlZWtyLmRvbmUpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDEwO1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdDYW5ub3QgcmVkdWNlOiBubyBpbml0aWFsIHZhbHVlIHNwZWNpZmllZCBhbmQgaXRlcmFibGUgd2FzIGVtcHR5Jyk7XG5cbiAgICAgICAgICBjYXNlIDEwOlxuICAgICAgICAgICAgcmVzdWx0ID0gcGVla3IudmFsdWU7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTM7XG4gICAgICAgICAgICByZXR1cm4gcGVla3IuYWR2YW5jZSgpO1xuXG4gICAgICAgICAgY2FzZSAxMzpcbiAgICAgICAgICAgIGMgPSAxO1xuXG4gICAgICAgICAgY2FzZSAxNDpcbiAgICAgICAgICAgIGlmIChwZWVrci5kb25lKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyMjtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxNztcbiAgICAgICAgICAgIHJldHVybiByZWR1Y2VyKHJlc3VsdCwgcGVla3IudmFsdWUsIGMrKyk7XG5cbiAgICAgICAgICBjYXNlIDE3OlxuICAgICAgICAgICAgcmVzdWx0ID0gX2NvbnRleHQuc2VudDtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyMDtcbiAgICAgICAgICAgIHJldHVybiBwZWVrci5hZHZhbmNlKCk7XG5cbiAgICAgICAgICBjYXNlIDIwOlxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDE0O1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICBjYXNlIDIyOlxuICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0LmFicnVwdChcInJldHVyblwiLCByZXN1bHQpO1xuXG4gICAgICAgICAgY2FzZSAyMzpcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAyMztcbiAgICAgICAgICAgIHBlZWtyW1wicmV0dXJuXCJdKCk7XG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuZmluaXNoKDIzKTtcblxuICAgICAgICAgIGNhc2UgMjY6XG4gICAgICAgICAgY2FzZSBcImVuZFwiOlxuICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0LnN0b3AoKTtcbiAgICAgICAgfVxuICAgICAgfVxuICAgIH0sIF9jYWxsZWUsIG51bGwsIFtbNiwsIDIzLCAyNl1dKTtcbiAgfSkpO1xuICByZXR1cm4gX2FzeW5jUmVkdWNlLmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7XG59XG5cbmV4cG9ydHMuX19hc3luY1JlZHVjZSA9IF9fYXN5bmNSZWR1Y2U7XG52YXIgYXN5bmNSZWR1Y2UgPSAvKiNfX1BVUkVfXyovYXN5bmNJdGVyYWJsZUN1cnJ5KF9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9yZWYuc3RlcDtcblxuICAgICAgICAgICAgZm9yIChfbGVuID0gX2FyZ3MubGVuZ3RoLCBwZWVrcnMgPSBuZXcgQXJyYXkoX2xlbiA+IDIgPyBfbGVuIC0gMiA6IDApLCBfa2V5ID0gMjsgX2tleSA8IF9sZW47IF9rZXkrKykge1xuICAgICAgICAgICAgICBwZWVrcnNbX2tleSAtIDJdID0gX2FyZ3NbX2tleV07XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHN0YXJ0ID0gc3RhcnQgJSBwZWVrcnMubGVuZ3RoO1xuICAgICAgICAgICAgaSA9IHN0YXJ0O1xuXG4gICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgaWYgKGFsbC5kb25lKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxNDtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHBlZWtyID0gcGVla3JzW2ldO1xuXG4gICAgICAgICAgICBpZiAocGVla3IuZG9uZSkge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTE7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gOTtcbiAgICAgICAgICAgIHJldHVybiBwZWVrci52YWx1ZTtcblxuICAgICAgICAgIGNhc2UgOTpcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxMTtcbiAgICAgICAgICAgIHJldHVybiBfYXdhaXRBc3luY0dlbmVyYXRvcihwZWVrci5hZHZhbmNlKCkpO1xuXG4gICAgICAgICAgY2FzZSAxMTpcbiAgICAgICAgICAgIGkgPSAoaSArIHN0ZXApICUgcGVla3JzLmxlbmd0aDtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA0O1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICBjYXNlIDE0OlxuICAgICAgICAgIGNhc2UgXCJlb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aCwgcGVla3JzID0gbmV3IEFycmF5KF9sZW4gPiAyID8gX2xlbiAtIDIgOiAwKSwgX2tleSA9IDI7IF9rZXkgPCBfbGVuOyBfa2V5KyspIHtcbiAgICAgICAgICAgIHBlZWtyc1tfa2V5IC0gMl0gPSBfYXJnc1tfa2V5XTtcbiAgICAgICAgICB9XG5cbiAgICAgICAgICBzdGFydCA9IHN0YXJ0ICUgcGVla3JzLmxlbmd0aDtcbiAgICAgICAgICBpID0gc3RhcnQ7XG5cbiAgICAgICAgY2FzZSA0OlxuICAgICAgICAgIGlmIChhbGwuZG9uZSkge1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDEzO1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgcGVla3IgPSBwZWVrcnNbaV07XG5cbiAgICAgICAgICBpZiAocGVla3IuZG9uZSkge1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDEwO1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgX2NvbnRleHQubmV4dCA9IDk7XG4gICAgICAgICAgcmV0dXJuIHBlZWtyLnZhbHVlO1xuXG4gICAgICAgIGNhc2UgOTpcbiAgICAgICAgICBwZWVrci5hZHZhbmNlKCk7XG5cbiAgICAgICAgY2FzZSAxMDpcbiAgICAgICAgICBpID0gKGkgKyBzdGVwKSAlIHBlZWtycy5sZW5ndGg7XG4gICAgICAgICAgX2NvbnRleHQubmV4dCA9IDQ7XG4gICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgY2FzZSAxMzpcbiAgICAgICAgY2FzZSBcImVuZFwiOlxuICAgICAgICAgIHJldHVybiBfY29udGV4dC5zdG9wKCk7XG4gICAgICB9XG4gICAgfVxuICB9LCBfbWFya2VkKTtcbn1cblxuZnVuY3Rpb24gX19yb3VuZFJvYmluKHNvdXJjZXMpIHtcbiAgdmFyIHN0ZXAgPSBhcmd1bWVudHMubGVuZ3RoID4gMSAm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gICAgICAgY2FzZSA4OlxuICAgICAgICAgICAgX3N0ZXAgPSBfY29udGV4dC5zZW50O1xuICAgICAgICAgICAgX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiA9IF9zdGVwLmRvbmU7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTI7XG4gICAgICAgICAgICByZXR1cm4gX3N0ZXAudmFsdWU7XG5cbiAgICAgICAgICBjYXNlIDEyOlxuICAgICAgICAgICAgX3ZhbHVlID0gX2NvbnRleHQuc2VudDtcblxuICAgICAgICAgICAgaWYgKF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24pIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDE5O1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgXyA9IF92YWx1ZTtcbiAgICAgICAgICAgIHNpemUrKztcblxuICAgICAgICAgIGNhc2UgMTY6XG4gICAgICAgICAgICBfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uID0gdHJ1ZTtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA2O1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICBjYXNlIDE5OlxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDI1O1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICBjYXNlIDIxOlxuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDIxO1xuICAgICAgICAgICAgX2NvbnRleHQudDAgPSBfY29udGV4dFtcImNhdGNoXCJdKDQpO1xuICAgICAgICAgICAgX2RpZEl0ZXJhdG9yRXJyb3IgPSB0cnVlO1xuICAgICAgICAgICAgX2l0ZXJhdG9yRXJyb3IgPSBfY29udGV4dC50MDtcblxuICAgICAgICAgIGNhc2UgMjU6XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMjU7XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMjY7XG5cbiAgICAgICAgICAgIGlmICghKCFfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uICYmIF9pdGVyYXRvcltcInJldHVyblwiXSAhPSBudWxsKSkge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMzA7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMzA7XG4gICAgICAgICAgICByZXR1cm4gX2l0ZXJhdG9yW1wicmV0dXJuXCJdKCk7XG5cbiAgICAgICAgICBjYXNlIDMwOlxuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDMwO1xuXG4gICAgICAgICAgICBpZiAoIV9kaWRJdGVyYXRvckVycm9yKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAzMztcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHRocm93IF9pdGVyYXRvckVycm9yO1xuXG4gICAgICAgICAgY2FzZSAzMzpcbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dC5maW5pc2goMzApO1xuXG4gICAgICAgICAgY2FzZSAzNDpcbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dC5maW5pc2goMjUpO1xuXG4gICAgICAgICAgY2FzZSAzNTpcbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dC5hYnJ1cHQoXCJyZXR1cm5cIiwgc2l6ZSk7XG5cbiAgICAgICAgICBjYXNlIDM2OlxuICAgICAgICAgIGNhc2UgXCJlbmRcIjpcbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dC5zdG9wKCk7XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICB9LCBfY2FsbGVlLCBudWxsLCBbWzQsIDIxLCAyNSwgMzVdLCBbMjYsLCAzMCwgMzRdXSk7XG4gIH0pKTtcbiAgcmV0dXJuIF9hc3luY1NpemUuYXBwbHkodGhpcywgYXJndW1lbnRzKTtcbn1cblxuZXhwb3J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gICAgICAgICAgICBzdGVwID0gX2FyZ3MubGVuZ3RoID4gMyAmJiBfYXJnc1szXSAhPT0gdW5kZWZpbmVkID8gX2FyZ3NbM10gOiAxO1xuICAgICAgICAgICAgY3VycmVudFBvcyA9IDA7XG4gICAgICAgICAgICBuZXh0VmFsaWRQb3MgPSBzdGFydDtcbiAgICAgICAgICAgIGJ1ZmZlclNpemUgPSBNYXRoLmFicyhlbmQpO1xuICAgICAgICAgICAgY291bnRlciA9IDA7XG5cbiAgICAgICAgICAgIGlmIChlbmQgPCAwKSB7XG4gICAgICAgICAgICAgIGJ1ZmZlciA9IG5ldyBDaXJjdWxhckJ1ZmZlcihidWZmZXJTaXplKTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiA9IHRydWU7XG4gICAgICAgICAgICBfZGlkSXRlcmF0b3JFcnJvciA9IGZhbHNlO1xuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDEwO1xuICAgICAgICAgICAgX2l0ZXJhdG9yID0gX2FzeW5jSXRlcmF0b3Ioc291cmNlKTtcblxuICAgICAgICAgIGNhc2UgMTI6XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTQ7XG4gICAgICAgICAgICByZXR1cm4gX2F3YWl0QXN5bmNHZW5lcmF0b3IoX2l0ZXJhdG9yLm5leHQoKSk7XG5cbiAgICAgICAgICBjYXNlIDE0OlxuICAgICAgICAgICAgX3N0ZXAgPSBfY29udGV4dC5zZW50O1xuICAgICAgICAgICAgX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiA9IF9zdGVwLmRvbmU7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTg7XG4gICAgICAgICAgICByZXR1cm4gX2F3YWl0QXN5bmNHZW5lcmF0b3IoX3N0ZXAudmFsdWUpO1xuXG4gICAgICAgICAgY2FzZSAxODpcbiAgICAgICAgICAgIF92YWx1ZSA9IF9jb250ZXh0LnNlbnQ7XG5cbiAgICAgICAgICAgIGlmIChfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAzNjtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHZhbHVlID0gX3ZhbHVlO1xuXG4gICAgICAgICAgICBpZiAoIWJ1ZmZlcikge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMjY7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB2YWx1ZSA9IGJ1ZmZlci5wdXNoKHZhbHVlKTtcbiAgICAgICAgICAgIGNvdW50ZXIrKztcblxuICAgICAgICAgICAgaWYgKCEoY291bnRlciA8PSBidWZmZXJTaXplKSkge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMjY7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuYWJydXB0KFwiY29udGludWVcIiwgMzMpO1xuXG4gICAgICAgICAgY2FzZSAyNjpcbiAgICAgICAgICAgIGlmICghKGN1cnJlbnRQb3MgPj0gZW5kICYmIGVuZCA+PSAwKSkge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMjg7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuYWJydXB0KFwiYnJlYWtcIiwgMzYpO1xuXG4gICAgICAgICAgY2FzZSAyODpcbiAgICAgICAgICAgIGlmICghKG5leHRWYWxpZFBvcyA9PT0gY3VycmVudFBvcykpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDMyO1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDMxO1xuICAgICAgICAgICAgcmV0dXJuIHZhbHVlO1xuXG4gICAgICAgICAgY2FzZSAzMTpcbiAgICAgICAgICAgIG5leHRWYWxpZFBvcyArPSBzdGVwO1xuXG4gICAgICAgICAgY2FzZSAzMjpcbiAgICAgICAgICAgIGN1cnJlbnRQb3MrKztcblxuICAgICAgICAgIGNhc2UgMzM6XG4gICAgICAgICAgICBfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uID0gdHJ1ZTtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxMjtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSAzNjpcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA0MjtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSAzODpcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAzODtcbiAgICAgICAgICAgIF9jb250ZXh0LnQwID0gX2NvbnRleHRbXCJjYXRjaFwiXSgxMCk7XG4gICAgICAgICAgICBfZGlkSXRlcmF0b3JFcnJvciA9IHRydWU7XG4gICAgICAgICAgICBfaXRlcmF0b3JFcnJvciA9IF9jb250ZXh0LnQwO1xuXG4gICAgICAgICAgY2FzZSA0MjpcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSA0MjtcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSA0MztcblxuICAgICAgICAgICAgaWYgKCEoIV9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gJiYgX2l0ZXJhdG9yW1wicmV0dXJuXCJdICE9IG51bGwpKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA0NztcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA0NztcbiAgICAgICAgICAgIHJldHVybiBfYXdhaXRBc3luY0dlbmVyYXRvcihfaXRlcmF0b3JbXCJyZXR1cm5cI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IDEzO1xuICAgICAgICAgICAgcmV0dXJuIF9zdGVwMi52YWx1ZTtcblxuICAgICAgICAgIGNhc2UgMTM6XG4gICAgICAgICAgICBfdmFsdWUyID0gX2NvbnRleHQzLnNlbnQ7XG5cbiAgICAgICAgICAgIGlmIChfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uMikge1xuICAgICAgICAgICAgICBfY29udGV4dDMubmV4dCA9IDIxO1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdmFsdWUgPSBfdmFsdWUyO1xuICAgICAgICAgICAgYnVmZmVyLnB1c2godmFsdWUpO1xuICAgICAgICAgICAgY291bnRlcisrO1xuXG4gICAgICAgICAgY2FzZSAxODpcbiAgICAgICAgICAgIF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24yID0gdHJ1ZTtcbiAgICAgICAgICAgIF9jb250ZXh0My5uZXh0ID0gNztcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSAyMTpcbiAgICAgICAgICAgIF9jb250ZXh0My5uZXh0ID0gMjc7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgIGNhc2UgMjM6XG4gICAgICAgICAgICBfY29udGV4dDMucHJldiA9IDIzO1xuICAgICAgICAgICAgX2NvbnRleHQzLnQwID0gX2NvbnRleHQzW1wiY2F0Y2hcIl0oNSk7XG4gICAgICAgICAgICBfZGlkSXRlcmF0b3JFcnJvcjIgPSB0cnVlO1xuICAgICAgICAgICAgX2l0ZXJhdG9yRXJyb3IyID0gX2NvbnRleHQzLnQwO1xuXG4gICAgICAgICAgY2FzZSAyNzpcbiAgICAgICAgICAgIF9jb250ZXh0My5wcmV2ID0gMjc7XG4gICAgICAgICAgICBfY29udGV4dDMucHJldiA9IDI4O1xuXG4gICAgICAgICAgICBpZiAoISghX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbjIgJiYgX2l0ZXJhdG9yMltcInJldHVyblwiXSAhPSBudWxsKSkge1xuICAgICAgICAgICAgICBfY29udGV4dDMubmV4dCA9IDMyO1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgX2NvbnRleHQzLm5leHQgPSAzMjtcbiAgICAgICAgICAgIHJldHVybiBfaXRlcmF0b3IyW1wicmV0dXJuXCJdKCk7XG5cbiAgICAgICAgICBjYXNlIDMyOlxuICAgICAgICAgICAgX2NvbnRleHQzLnByZXYgPSAzMjtcblxuICAgICAgICAgICAgaWYgKCFfZGlkSXRlcmF0b3JFcnJvcjIpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQzLm5leHQgPSAzNTtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHRocm93IF9pdGVyYXRvckVycm9yMjtcblxuICAgICAgICAgIGNhc2UgMzU6XG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQzLmZpbmlzaCgzMik7XG5cbiAgICAgICAgICBjYXNlIDM2OlxuICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0My5maW5pc2goMjcpO1xuXG4gICAgICAgICAgY2FzZSAzNzpcbiAgICAgICAgICAgIGlmICghKGlzRmluaXRlKGVuZCkgJiYgZW5kID4gMCkpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQzLm5leHQgPSA0MztcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIG5ld0VuZCA9IGVuZCAtIChjb3VudGVyIC0gYnVmZmVyLnNpemUpO1xuXG4gICAgICAgICAgICBpZiAoIShuZXdFbmQgPCAwKSkge1xuICAgICAgICAgICAgICBfY29udGV4dDMubmV4dCA9IDQxO1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0My5hYnJ1cHQoXCJyZXR1cm5cIiwgW10pO1xuXG4gICAgICAgICAgY2FzZSA0MTp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HJldiA9IDk7XG5cbiAgICAgICAgICBfaXRlcmF0b3IyLnMoKTtcblxuICAgICAgICBjYXNlIDExOlxuICAgICAgICAgIGlmICgoX3N0ZXAyID0gX2l0ZXJhdG9yMi5uKCkpLmRvbmUpIHtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyNztcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIHZhbHVlID0gX3N0ZXAyLnZhbHVlO1xuXG4gICAgICAgICAgaWYgKCFidWZmZXIpIHtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxODtcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIHZhbHVlID0gYnVmZmVyLnB1c2godmFsdWUpO1xuICAgICAgICAgIGNvdW50ZXIrKztcblxuICAgICAgICAgIGlmICghKGNvdW50ZXIgPD0gYnVmZmVyU2l6ZSkpIHtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxODtcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIHJldHVybiBfY29udGV4dC5hYnJ1cHQoXCJjb250aW51ZVwiLCAyNSk7XG5cbiAgICAgICAgY2FzZSAxODpcbiAgICAgICAgICBpZiAoIShjdXJyZW50UG9zID49IGVuZCAmJiBlbmQgPj0gMCkpIHtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyMDtcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIHJldHVybiBfY29udGV4dC5hYnJ1cHQoXCJicmVha1wiLCAyNyk7XG5cbiAgICAgICAgY2FzZSAyMDpcbiAgICAgICAgICBpZiAoIShuZXh0VmFsaWRQb3MgPT09IGN1cnJlbnRQb3MpKSB7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMjQ7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgICB9XG5cbiAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMjM7XG4gICAgICAgICAgcmV0dXJuIHZhbHVlO1xuXG4gICAgICAgIGNhc2UgMjM6XG4gICAgICAgICAgbmV4dFZhbGlkUG9zICs9IHN0ZXA7XG5cbiAgICAgICAgY2FzZSAyNDpcbiAgICAgICAgICBjdXJyZW50UG9zKys7XG5cbiAgICAgICAgY2FzZSAyNTpcbiAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTE7XG4gICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgY2FzZSAyNzpcbiAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMzI7XG4gICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgY2FzZSAyOTpcbiAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMjk7XG4gICAgICAgICAgX2NvbnRleHQudDAgPSBfY29udGV4dFtcImNhdGNoXCJdKDkpO1xuXG4gICAgICAgICAgX2l0ZXJhdG9yMi5lKF9jb250ZXh0LnQwKTtcblxuICAgICAgICBjYXNlIDMyOlxuICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAzMjtcblxuICAgICAgICAgIF9pdGVyYXRvcjIuZigpO1xuXG4gICAgICAgICAgcmV0dXJuIF9jb250ZXh0LmZpbmlzaCgzMik7XG5cbiAgICAgICAgY2FzZSAzNTpcbiAgICAgICAgY2FzZSBcImVuZFwiOlxuICAgICAgICAgIHJldHVybiBfY29udGV4dC5zdG9wKCk7XG4gICAgICB9XG4gICAgfVxuICB9LCBfbWFya2VkLCBudWxsLCBbWzksIDI5LCAzMiwgMzVdXSk7XG59XG5cbmV4cG9ydHMuX19zbGljZUZyb21TdGFydCA9IF9fc2xpY2VGcm9tU3RhcnQ7XG5cbmZ1bmN0aW9uIGJ1ZmZlcmVkU2xpY2Uoc291cmNlLCBzdGFydCwgZW5kLCBzdGVwKSB7XG4gIHZhciBidWZmZXJTaXplID0gTWF0aC5hYnMoc3RhcnQpO1xuICB2YXIgYnVmZmVyID0gbmV3IENpcmN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ybiBfcmVnZW5lcmF0b3JSdW50aW1lLndyYXAoZnVuY3Rpb24gX2NhbGxlZSQoX2NvbnRleHQpIHtcbiAgICAgIHdoaWxlICgxKSB7XG4gICAgICAgIHN3aXRjaCAoX2NvbnRleHQucHJldiA9IF9jb250ZXh0Lm5leHQpIHtcbiAgICAgICAgICBjYXNlIDA6XG4gICAgICAgICAgICBjID0gMDtcbiAgICAgICAgICAgIF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gPSB0cnVlO1xuICAgICAgICAgICAgX2RpZEl0ZXJhdG9yRXJyb3IgPSBmYWxzZTtcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAzO1xuICAgICAgICAgICAgX2l0ZXJhdG9yID0gX2FzeW5jSXRlcmF0b3IoaXRlcmFibGUpO1xuXG4gICAgICAgICAgY2FzZSA1OlxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDc7XG4gICAgICAgICAgICByZXR1cm4gX2l0ZXJhdG9yLm5leHQoKTtcblxuICAgICAgICAgIGNhc2UgNzpcbiAgICAgICAgICAgIF9zdGVwID0gX2NvbnRleHQuc2VudDtcbiAgICAgICAgICAgIF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gPSBfc3RlcC5kb25lO1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDExO1xuICAgICAgICAgICAgcmV0dXJuIF9zdGVwLnZhbHVlO1xuXG4gICAgICAgICAgY2FzZSAxMTpcbiAgICAgICAgICAgIF92YWx1ZSA9IF9jb250ZXh0LnNlbnQ7XG5cbiAgICAgICAgICAgIGlmIChfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyMTtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHZhbHVlID0gX3ZhbHVlO1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDE2O1xuICAgICAgICAgICAgcmV0dXJuIGZ1bmModmFsdWUsIGMrKyk7XG5cbiAgICAgICAgICBjYXNlIDE2OlxuICAgICAgICAgICAgaWYgKCFfY29udGV4dC5zZW50KSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxODtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dC5hYnJ1cHQoXCJyZXR1cm5cIiwgdHJ1ZSk7XG5cbiAgICAgICAgICBjYXNlIDE4OlxuICAgICAgICAgICAgX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiA9IHRydWU7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gNTtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSAyMTpcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyNztcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSAyMzpcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAyMztcbiAgICAgICAgICAgIF9jb250ZXh0LnQwID0gX2NvbnRleHRbXCJjYXRjaFwiXSgzKTtcbiAgICAgICAgICAgIF9kaWRJdGVyYXRvckVycm9yID0gdHJ1ZTtcbiAgICAgICAgICAgIF9pdGVyYXRvckVycm9yID0gX2NvbnRleHQudDA7XG5cbiAgICAgICAgICBjYXNlIDI3OlxuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDI3O1xuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDI4O1xuXG4gICAgICAgICAgICBpZiAoISghX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiAmJiBfaXRlcmF0b3JbXCJyZXR1cm5cIl0gIT0gbnVsbCkpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDMyO1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDMyO1xuICAgICAgICAgICAgcmV0dXJuIF9pdGVyYXRvcltcInJldHVyblwiXSgpO1xuXG4gICAgICAgICAgY2FzZSAzMjpcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAzMjtcblxuICAgICAgICAgICAgaWYgKCFfZGlkSXRlcmF0b3JFcnJvcikge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMzU7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB0aHJvdyBfaXRlcmF0b3JFcnJvcjtcblxuICAgICAgICAgIGNhc2UgMzU6XG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuZmluaXNoKDMyKTtcblxuICAgICAgICAgIGNhc2UgMzY6XG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuZmluaXNoKDI3KTtcblxuICAgICAgICAgIGNhc2UgMzc6XG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuYWJydXB0KFwicmV0dXJuXCIsIGZhbHNlKTtcblxuICAgICAgICAgIGNhc2UgMzg6XG4gICAgICAgICAgY2FzZSBcImVuZFwiOlxuICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0LnN0b3AoKTtcbiAgICAgICAgfVxuICAgICAgfVxuICAgIH0sIF9jYWxsZWUsIG51bGwsIFtbMywgMjMsIDI3LCAzN10sIFsyOCwsIDMyLCAzNl1dKTtcbiAgfSkpO1xuICByZXR1cm4gX2FzeW5jU29tZS5hcHBseSh0aGlzLCBhcmd1bWVudHMpO1xufVxuXG5leHBvcnRzLl9fYXN5bmNTb21lID0gX19hc3luY1NvbWU7XG52YXIgYXN5bmNTb21lID0gLyojX19QVVJFX18qL2FzeW5jSXRlcmFibGVDdXJyeShfX2FzeW5jU29tZSwge1xuICByZWR1Y2VzOiB0cnVlXG59KTtcbmV4cG9ydHMuYXN5bmNTb21lID0gYXN5bmNTb21lOyIsImZ1bmN0aW9uIF9jcmVhdGVGb3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RLZXk7XG4gICAgcmV0dXJuIF9yZWdlbmVyYXRvclJ1bnRpbWUud3JhcChmdW5jdGlvbiBfY2FsbGVlJChfY29udGV4dCkge1xuICAgICAgd2hpbGUgKDEpIHtcbiAgICAgICAgc3dpdGNoIChfY29udGV4dC5wcmV2ID0gX2NvbnRleHQubmV4dCkge1xuICAgICAgICAgIGNhc2UgMDpcbiAgICAgICAgICAgIGdldEtleSA9IF9yZWYuZ2V0S2V5O1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDM7XG4gICAgICAgICAgICByZXR1cm4gX2F3YWl0QXN5bmNHZW5lcmF0b3IoX19hc3luY1BlZWtlcmF0ZShzb3VyY2UpKTtcblxuICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgIHBlZWtyID0gX2NvbnRleHQuc2VudDtcbiAgICAgICAgICAgIGtleSA9IGluaXRpYWxLZXk7XG4gICAgICAgICAgICBpZHggPSAwO1xuXG4gICAgICAgICAgY2FzZSA2OlxuICAgICAgICAgICAgaWYgKHBlZWtyLmRvbmUpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDIyO1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgbGFzdEtleSA9IGtleTtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxMDtcbiAgICAgICAgICAgIHJldHVybiBfYXdhaXRBc3luY0dlbmVyYXRvcihnZXRLZXkocGVla3IudmFsdWUsIGlkeCsrKSk7XG5cbiAgICAgICAgICBjYXNlIDEwOlxuICAgICAgICAgICAga2V5ID0gX2NvbnRleHQuc2VudDtcblxuICAgICAgICAgICAgaWYgKCEobGFzdEtleSAhPT0ga2V5KSkge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTY7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTQ7XG4gICAgICA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B2YXIgZ2V0S2V5LCBwZWVrciwga2V5LCBpZHgsIGxhc3RLZXk7XG4gIHJldHVybiBfcmVnZW5lcmF0b3JSdW50aW1lLndyYXAoZnVuY3Rpb24gZ3JvdXBpbmdTcGxpdGVyYXRvciQoX2NvbnRleHQpIHtcbiAgICB3aGlsZSAoMSkge1xuICAgICAgc3dpdGNoIChfY29udGV4dC5wcmV2ID0gX2NvbnRleHQubmV4dCkge1xuICAgICAgICBjYXNlIDA6XG4gICAgICAgICAgZ2V0S2V5ID0gX3JlZi5nZXRLZXk7XG4gICAgICAgICAgcGVla3IgPSBfX3BlZWtlcmF0ZShzb3VyY2UpO1xuICAgICAgICAgIGtleSA9IGluaXRpYWxLZXk7XG4gICAgICAgICAgaWR4ID0gMDtcblxuICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgaWYgKHBlZWtyLmRvbmUpIHtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxNztcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIGxhc3RLZXkgPSBrZXk7XG4gICAgICAgICAga2V5ID0gZ2V0S2V5KHBlZWtyLnZhbHVlLCBpZHgrKyk7XG5cbiAgICAgICAgICBpZiAoIShsYXN0S2V5ICE9PSBrZXkpKSB7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTI7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgICB9XG5cbiAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTA7XG4gICAgICAgICAgcmV0dXJuIHNwbGl0O1xuXG4gICAgICAgIGNhc2UgMTA6XG4gICAgICAgICAgX2NvbnRleHQubmV4dCA9IDEyO1xuICAgICAgICAgIHJldHVybiBrZXk7XG5cbiAgICAgICAgY2FzZSAxMjpcbiAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTQ7XG4gICAgICAgICAgcmV0dXJuIHBlZWtyLnZhbHVlO1xuXG4gICAgICAgIGNhc2UgMTQ6XG4g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tcblxuICAgICAgICAgIGNhc2UgNzpcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA5O1xuICAgICAgICAgICAgcmV0dXJuIF9hd2FpdEFzeW5jR2VuZXJhdG9yKF9pdGVyYXRvci5uZXh0KCkpO1xuXG4gICAgICAgICAgY2FzZSA5OlxuICAgICAgICAgICAgX3N0ZXAgPSBfY29udGV4dC5zZW50O1xuICAgICAgICAgICAgX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiA9IF9zdGVwLmRvbmU7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTM7XG4gICAgICAgICAgICByZXR1cm4gX2F3YWl0QXN5bmNHZW5lcmF0b3IoX3N0ZXAudmFsdWUpO1xuXG4gICAgICAgICAgY2FzZSAxMzpcbiAgICAgICAgICAgIF92YWx1ZSA9IF9jb250ZXh0LnNlbnQ7XG5cbiAgICAgICAgICAgIGlmIChfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAzMTtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGJ1ZmZlciA9IF92YWx1ZTtcblxuICAgICAgICAgICAgaWYgKCEoc2tpcCA+IDApKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxOTtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHNraXAtLTtcbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dC5hYnJ1cHQoXCJjb250aW51ZVwiLCAyOCk7XG5cbiAgICAgICAgICBjYXNlIDE5OlxuICAgICAgICAgICAgbWF0Y2hpbmdMZW5ndGggPSBnZXRNYXRjaGluZ0xlbmd0aChidWZmZXIsIHNlcGFyYXRvclNlcXMsIHNhbWUpO1xuXG4gICAgICAgICAgICBpZiAoIShtYXRjaGluZ0xlbmd0aCA+IDApKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyNjtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyMztcbiAgICAgICAgICAgIHJldHVybiBzcGxpdDtcblxuICAgICAgICAgIGNhc2UgMjM6XG4gICAgICAgICAgICBza2lwID0gbWF0Y2hpbmdMZW5ndGggLSAxO1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDI4O1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICBjYXNlIDI2OlxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDI4O1xuICAgICAgICAgICAgcmV0dXJuIGJ1ZmZlci5nZXQoMCk7XG5cbiAgICAgICAgICBjYXNlIDI4OlxuICAgICAgICAgICAgX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiA9IHRydWU7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gNztcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSAzMTpcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAzNztcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSAzMzpcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAzMztcbiAgICAgICAgICAgIF9jb250ZXh0LnQwID0gX2NvbnRleHRbXCJjYXRjaFwiXSg1KTtcbiAgICAgICAgICAgIF9kaWRJdGVyYXRvckVycm9yID0gdHJ1ZTtcbiAgICAgICAgICAgIF9pdGVyYXRvckVycm9yID0gX2NvbnRleHQudDA7XG5cbiAgICAgICAgICBjYXNlIDM3OlxuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDM3O1xuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDM4O1xuXG4gICAgICAgICAgICBpZiAoISghX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiAmJiBfaXRlcmF0b3JbXCJyZXR1cm5cIl0gIT0gbnVsbCkpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDQyO1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDQyO1xuICAgICAgICAgICAgcmV0dXJuIF9hd2FpdEFzeW5jR2VuZXJhdG9yKF9pdGVyYXRvcltcInJldHVyblwiXSgpKTtcblxuICAgICAgICAgIGNhc2UgNDI6XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gNDI7XG5cbiAgICAgICAgICAgIGlmICghX2RpZEl0ZXJhdG9yRXJyb3IpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDQ1O1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdGhyb3cgX2l0ZXJhdG9yRXJyb3I7XG5cbiAgICAgICAgICBjYXNlIDQ1OlxuICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0LmZpbmlzaCg0Mik7XG5cbiAgICAgICAgICBjYXNlIDQ2OlxuICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0LmZpbmlzaCgzNyk7XG5cbiAgICAgICAgICBjYXNlIDQ3OlxuICAgICAgICAgIGNhc2UgXCJlbmRcIjpcbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dC5zdG9wKCk7XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICB9LCBfY2FsbGVlLCBudWxsLCBbWzUsIDMzLCAzNywgNDddLCBbMzgsLCA0MiwgNDZdXSk7XG4gIH0pKTtcbiAgcmV0dXJuIF9hc3luY0FueVNlcXNwbGl0ZXJhdG9yLmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7XG59XG5cbmZ1bmN0aW9uIF9fYXN5bmNTcGxpdE9uQW55U2VxKF94NCwgX3g1KSB7XG4gIHJldHVybiBfYXN5bmNTcGxpdE9uQW55U2VxLmFwcGx5K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gICAgICAgICAgfSwgMSk7XG4gICAgICAgICAgc2tpcCA9IDA7XG4gICAgICAgICAgX2l0ZXJhdG9yMiA9IF9jcmVhdGVGb3JPZkl0ZXJhdG9ySGVscGVyKF9fd2luZG93QWhlYWQoc291cmNlLCBtYXhNYXRjaExlbmd0aCwge1xuICAgICAgICAgICAgdXNlRmlsbGVyOiBmYWxzZVxuICAgICAgICAgIH0pKTtcbiAgICAgICAgICBfY29udGV4dC5wcmV2ID0gNDtcblxuICAgICAgICAgIF9pdGVyYXRvcjIucygpO1xuXG4gICAgICAgIGNhc2UgNjpcbiAgICAgICAgICBpZiAoKF9zdGVwMiA9IF9pdGVyYXRvcjIubigpKS5kb25lKSB7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMjI7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgICB9XG5cbiAgICAgICAgICBidWZmZXIgPSBfc3RlcDIudmFsdWU7XG5cbiAgICAgICAgICBpZiAoIShza2lwID4gMCkpIHtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxMTtcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIHNraXAtLTtcbiAgICAgICAgICByZXR1cm4gX2NvbnRleHQuYWJydXB0KFwiY29udGludWVcIiwgMjApO1xuXG4gICAgICAgIGNhc2UgMTE6XG4gICAgICAgICAgbWF0Y2hpbmdMZW5ndGggPSBnZXRNYXRjaGluZ0xlbmd0aChidWZmZXIsIHNlcGFyYXRvclNlcXMsIHNhbWUpO1xuXG4gICAgICAgICAgaWYgKCEobWF0Y2hpbmdMZW5ndGggPiAwKSkge1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDE4O1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgX2NvbnRleHQubmV4dCA9IDE1O1xuICAgICAgICAgIHJldHVybiBzcGxpdDtcblxuICAgICAgICBjYXNlIDE1OlxuICAgICAgICAgIHNraXAgPSBtYXRjaGluZ0xlbmd0aCAtIDE7XG4gICAgICAgICAgX2NvbnRleHQubmV4dCA9IDIwO1xuICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgIGNhc2UgMTg6XG4gICAgICAgICAgX2NvbnRleHQubmV4dCA9IDIwO1xuICAgICAgICAgIHJldHVybiBidWZmZXIuZ2V0KDApO1xuXG4gICAgICAgIGNhc2UgMjA6XG4gICAgICAgICAgX2NvbnRleHQubmV4dCA9IDY7XG4gICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgY2FzZSAyMjpcbiAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMjc7XG4gICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgY2FzZSAyNDpcbiAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMjQ7XG4gICAgICAgICAgX2NvbnRleHQudDAgPSBfY29udGV4dFtcImNhdGNoXCJdKDQpO1xuXG4gICAgICAgICAgX2l0ZXJhdG9yMi5lKF9jb250ZXh0LnQwKTtcblxuICAgICAgICBjYXNlIDI3OlxuICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAyNztcblxuICAgICAgICAgIF9pdGVyYXRvcjIuZigpO1xuXG4gICAgICAgICAgcmV0dXJuIF9jb250ZXh0LmZpbmlzaCgyNyk7XG5cbiAgICAgICAgY2FzZSAzMDpcbiAgICAgICAgY2FzZSBcImVuZFwiOlxuICAgICAgICAgIHJldHVybiBfY29udGV4dC5zdG9wKCk7XG4gICAgICB9XG4gICAgfVxuICB9LCBfbWFya2VkLCBudWxsLCBbWzQsIDI0LCAyNywgMzBdXSk7XG59XG5cbmZ1bmN0aW9uIF9fc3BsaXRPbkFueVNlcShzb3VyY2UsIHNlcGFyYXRvclNlcXMpIHtcbiAgdmFyIHNhbWUsXG4gICAgICBzZXBhcmF0b3JTZXFzQXJyLFxuICAgICAgX2FyZ3MyID0gYXJndW1lbnRzO1xuICByZXR1cm4gX3JlZ2VuZXJhdG9yUnVudGltZS53cmFwKGZ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IF9zdGVwID0gX2NvbnRleHQuc2VudDtcbiAgICAgICAgICAgIF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gPSBfc3RlcC5kb25lO1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDEyO1xuICAgICAgICAgICAgcmV0dXJuIF9hd2FpdEFzeW5jR2VuZXJhdG9yKF9zdGVwLnZhbHVlKTtcblxuICAgICAgICAgIGNhc2UgMTI6XG4gICAgICAgICAgICBfdmFsdWUgPSBfY29udGV4dC5zZW50O1xuXG4gICAgICAgICAgICBpZiAoX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbikge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMjc7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB2YWx1ZSA9IF92YWx1ZTtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxNztcbiAgICAgICAgICAgIHJldHVybiBfYXdhaXRBc3luY0dlbmVyYXRvcihwcmVkaWNhdGUodmFsdWUsIGkrKykpO1xuXG4gICAgICAgICAgY2FzZSAxNzpcbiAgICAgICAgICAgIGlmICghX2NvbnRleHQuc2VudCkge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMjE7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBfY29udGV4dC50MCA9IHNwbGl0O1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDIyO1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICBjYXNlIDIxOlxuICAgICAgICAgICAgX2NvbnRleHQudDAgPSB2YWx1ZTtcblxuICAgICAgICAgIGNhc2UgMjI6XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMjQ7XG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQudDA7XG5cbiAgICAgICAgICBjYXNlIDI0OlxuICAgICAgICAgICAgX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiA9IHRydWU7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gNjtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSAyNzpcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAzMztcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSAyOTpcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAyOTtcbiAgICAgICAgICAgIF9jb250ZXh0LnQxID0gX2NvbnRleHRbXCJjYXRjaFwiXSg0KTtcbiAgICAgICAgICAgIF9kaWRJdGVyYXRvckVycm9yID0gdHJ1ZTtcbiAgICAgICAgICAgIF9pdGVyYXRvckVycm9yID0gX2NvbnRleHQudDE7XG5cbiAgICAgICAgICBjYXNlIDMzOlxuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDMzO1xuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDM0O1xuXG4gICAgICAgICAgICBpZiAoISghX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiAmJiBfaXRlcmF0b3JbXCJyZXR1cm5cIl0gIT0gbnVsbCkpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDM4O1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDM4O1xuICAgICAgICAgICAgcmV0dXJuIF9hd2FpdEFzeW5jR2VuZXJhdG9yKF9pdGVyYXRvcltcInJldHVyblwiXSgpKTtcblxuICAgICAgICAgIGNhc2UgMzg6XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMzg7XG5cbiAgICAgICAgICAgIGlmICghX2RpZEl0ZXJhdG9yRXJyb3IpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDQxO1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgIC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AgICAgICAgfVxuXG4gICAgICAgICAgdmFsdWUgPSBfc3RlcC52YWx1ZTtcbiAgICAgICAgICBfY29udGV4dC5uZXh0ID0gOTtcbiAgICAgICAgICByZXR1cm4gcHJlZGljYXRlKHZhbHVlLCBpKyspID8gc3BsaXQgOiB2YWx1ZTtcblxuICAgICAgICBjYXNlIDk6XG4gICAgICAgICAgX2NvbnRleHQubmV4dCA9IDU7XG4gICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgY2FzZSAxMTpcbiAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTY7XG4gICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgY2FzZSAxMzpcbiAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMTM7XG4gICAgICAgICAgX2NvbnRleHQudDAgPSBfY29udGV4dFtcImNhdGNoXCJdKDMpO1xuXG4gICAgICAgICAgX2l0ZXJhdG9yLmUoX2NvbnRleHQudDApO1xuXG4gICAgICAgIGNhc2UgMTY6XG4gICAgICAgICAgX2NvbnRleHQucHJldiA9IDE2O1xuXG4gICAgICAgICAgX2l0ZXJhdG9yLmYoKTtcblxuICAgICAgICAgIHJldHVybiBfY29udGV4dC5maW5pc2goMTYpO1xuXG4gICAgICAgIGNhc2UgMTk6XG4gICAgICAgIGNhc2UgXCJlbmRcIjpcbiAgICAgICAgICByZXR1cm4gX2NvbnRleHQuc3RvcCgpO1xuICAgICAgfVxuICAgIH1cbiAgfSwgX21hcmtlZCwgbnVsbCwgW1szLCAxMywgMTYsIDE5XV0pO1xufVxuXG5mdW5jdGlvbiBfX3NwbGl0V2hlbihzb3VyY2UsIHByZWRpY2F0ZSkge1xuICByZXR1cm4gX19zcGxpdGVyYXRlKHNvdXJjZSwgcHJlZGljYXRlU3BsaXRlcmF0b3IsIHtcbiAgICBwcmVkaWNhdGU6IHByZWRpY2F0ZVxuICB9KTtcbn1cblxuZXhwb3J0cy5fX3NwbGl0V2hlbiA9IF9fc3BsaXRXaGVuO1xudmFyIHNwbG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0aW9uIF9jYWxsZWUocGVla3IsIHN1YnNlcVBlZWtyLCBzYW1lKSB7XG4gICAgdmFyIG1hdGNoZXMsIHZhbHVlLCBzZXFWYWx1ZSwgaTtcbiAgICByZXR1cm4gX3JlZ2VuZXJhdG9yUnVudGltZS53cmFwKGZ1bmN0aW9uIF9jYWxsZWUkKF9jb250ZXh0KSB7XG4gICAgICB3aGlsZSAoMSkge1xuICAgICAgICBzd2l0Y2ggKF9jb250ZXh0LnByZXYgPSBfY29udGV4dC5uZXh0KSB7XG4gICAgICAgICAgY2FzZSAwOlxuICAgICAgICAgICAgaWYgKCEoc3Vic2VxUGVla3IuZG9uZSB8fCBzdWJzZXFQZWVrci52YWx1ZS5pbmNsdWRlcyhub25lKSkpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDI7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuYWJydXB0KFwicmV0dXJuXCIsIHRydWUpO1xuXG4gICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgbWF0Y2hlcyA9IHN1YnNlcVBlZWtyLnZhbHVlLm1hcChmdW5jdGlvbiAoKSB7XG4gICAgICAgICAgICAgIHJldHVybiB0cnVlO1xuICAgICAgICAgICAgfSk7XG5cbiAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICBpZiAoISghcGVla3IuZG9uZSAmJiAhc3Vic2VxUGVla3IuZG9uZSkpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDIyO1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdmFsdWUgPSBwZWVrci52YWx1ZTtcbiAgICAgICAgICAgIHNlcVZhbHVlID0gc3Vic2VxUGVla3IudmFsdWU7XG4gICAgICAgICAgICBpID0gMDtcblxuICAgICAgICAgIGNhc2UgNzpcbiAgICAgICAgICAgIGlmICghKGkgPCBzZXFWYWx1ZS5sZW5ndGgpKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxODtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmIChtYXRjaGVzW2ldKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxMDtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dC5hYnJ1cHQoXCJjb250aW51ZVwiLCAxNSk7XG5cbiAgICAgICAgICBjYXNlIDEwOlxuICAgICAgICAgICAgaWYgKCEoc2VxVmFsdWVbaV0gPT09IG5vbmUpKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxNDtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dC5hYnJ1cHQoXCJyZXR1cm5cIiwgdHJ1ZSk7XG5cbiAgICAgICAgICBjYXNlIDE0OlxuICAgICAgICAgICAgbWF0Y2hlc1tpXSA9IHNhbWUoc2VxVmFsdWVbaV0sIHZhbHVlKTtcblxuICAgICAgICAgIGNhc2UgMTU6XG4gICAgICAgICAgICBpKys7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gNztcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSAxODpcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyMDtcbiAgICAgICAgICAgIHJldHVybiBQcm9taXNlLmFsbChbc3Vic2VxUGVla3IuYWR2YW5jZSgpLCBwZWVrci5hZHZhbmNlKCldKTtcblxuICAgICAgICAgIGNhc2UgMjA6XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMztcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSAyMjpcbiAgICAgICAgICAgIHJldHVybiBfY29udGV4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h0KSB7XG4gICAgICAgICAgY2FzZSAwOlxuICAgICAgICAgICAgc2FtZSA9IF9hcmdzMi5sZW5ndGggPiAyICYmIF9hcmdzMlsyXSAhPT0gdW5kZWZpbmVkID8gX2FyZ3MyWzJdIDogT2JqZWN0LmlzO1xuXG4gICAgICAgICAgICBpZiAoc2Vxcy5sZW5ndGgpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQyLm5leHQgPSAzO1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0Mi5hYnJ1cHQoXCJyZXR1cm5cIiwgZmFsc2UpO1xuXG4gICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgX2NvbnRleHQyLm5leHQgPSA1O1xuICAgICAgICAgICAgcmV0dXJuIF9fYXN5bmNQZWVrZXJhdGUoaXRlcmFibGUpO1xuXG4gICAgICAgICAgY2FzZSA1OlxuICAgICAgICAgICAgcGVla3IgPSBfY29udGV4dDIuc2VudDtcbiAgICAgICAgICAgIF9jb250ZXh0Mi5uZXh0ID0gODtcbiAgICAgICAgICAgIHJldHVybiBfX2FzeW5jUGVla2VyYXRlKF9fYXN5bmNaaXBBbGwoc2Vxcywge1xuICAgICAgICAgICAgICBmaWxsZXI6IG5vbmVcbiAgICAgICAgICAgIH0pKTtcblxuICAgICAgICAgIGNhc2UgODpcbiAgICAgICAgICAgIHN1YnNlcVBlZWtyID0gX2NvbnRleHQyLnNlbnQ7XG4gICAgICAgICAgICBfY29udGV4dDIubmV4dCA9IDExO1xuICAgICAgICAgICAgcmV0dXJuIF9hc3luY1N0YXJ0c1dpdGhBbnlTZXEocGVla3IsIHN1YnNlcVBlZWtyLCBzYW1lKTtcblxuICAgICAgICAgIGNhc2UgMTE6XG4gICAgICAgICAgICBzZXFGb3VuZCA9IF9jb250ZXh0Mi5zZW50O1xuICAgICAgICAgICAgX2NvbnRleHQyLm5leHQgPSAxNDtcbiAgICAgICAgICAgIHJld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2VuZXJhdG9yUnVudGltZS53cmFwKGZ1bmN0aW9uIF9jYWxsZWUkKF9jb250ZXh0KSB7XG4gICAgICB3aGlsZSAoMSkge1xuICAgICAgICBzd2l0Y2ggKF9jb250ZXh0LnByZXYgPSBfY29udGV4dC5uZXh0KSB7XG4gICAgICAgICAgY2FzZSAwOlxuICAgICAgICAgICAgc2FtZSA9IF9hcmdzLmxlbmd0aCA+IDIgJiYgX2FyZ3NbMl0gIT09IHVuZGVmaW5lZCA/IF9hcmdzWzJdIDogT2JqZWN0LmlzO1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDM7XG4gICAgICAgICAgICByZXR1cm4gX19hc3luY0ZpcnN0T3IoaXRlcmFibGUsIG5vbmUpO1xuXG4gICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgZmlyc3QgPSBfY29udGV4dC5zZW50O1xuXG4gICAgICAgICAgICBpZiAoIShmaXJzdCA9PT0gbm9uZSkpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDY7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuYWJydXB0KFwicmV0dXJuXCIsIGZhbHNlKTtcblxuICAgICAgICAgIGNhc2UgNjpcbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dC5hYnJ1cHQoXCJyZXR1cm5cIiwgc2FtZSh2YWx1ZSwgZmlyc3QpKTtcblxuICAgICAgICAgIGNhc2UgNzpcbiAgICAgICAgICBjYXNlIFwiZW5kXCI6XG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuc3RvcCgpO1xuICAgICAgICB9XG4gICAgICB9XG4gICAgfSwgX2NhbGxlZSk7XG4gIH0pKTtcbiAgcmV0dXJuIF9hc3luY1N0YXJ0c1dpdGguYXBwbHkodGhpcywgYXJndW1lbnRzKTtcbn1cblxuZXhwb3J0cy5fX2FzeW5jU3RhcnRzV2l0aCA9IF9fYXN5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hmdW5jdGlvbiBfY2FsbGVlKGNoYXJzKSB7XG4gICAgdmFyIHJlc3VsdCwgX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiwgX2RpZEl0ZXJhdG9yRXJyb3IsIF9pdGVyYXRvckVycm9yLCBfaXRlcmF0b3IsIF9zdGVwLCBfdmFsdWUsIF9jaGFyO1xuXG4gICAgcmV0dXJuIF9yZWdlbmVyYXRvclJ1bnRpbWUud3JhcChmdW5jdGlvbiBfY2FsbGVlJChfY29udGV4dCkge1xuICAgICAgd2hpbGUgKDEpIHtcbiAgICAgICAgc3dpdGNoIChfY29udGV4dC5wcmV2ID0gX2NvbnRleHQubmV4dCkge1xuICAgICAgICAgIGNhc2UgMDpcbiAgICAgICAgICAgIHJlc3VsdCA9ICcnO1xuICAgICAgICAgICAgX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiA9IHRydWU7XG4gICAgICAgICAgICBfZGlkSXRlcmF0b3JFcnJvciA9IGZhbHNlO1xuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDM7XG4gICAgICAgICAgICBfaXRlcmF0b3IgPSBfYXN5bmNJdGVyYXRvcihjaGFycyk7XG5cbiAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gNztcbiAgICAgICAgICAgIHJldHVybiBfaXRlcmF0b3IubmV4dCgpO1xuXG4gICAgICAgICAgY2FzZSA3OlxuICAgICAgICAgICAgX3N0ZXAgPSBfY29udGV4dC5zZW50O1xuICAgICAgICAgICAgX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiA9IF9zdGVwLmRvbmU7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTE7XG4gICAgICAgICAgICByZXR1cm4gX3N0ZXAudmFsdWU7XG5cbiAgICAgICAgICBjYXNlIDExOlxuICAgICAgICAgICAgX3ZhbHVlID0gX2NvbnRleHQuc2VudDtcblxuICAgICAgICAgICAgaWYgKF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24pIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDE4O1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgX2NoYXIgPSBfdmFsdWU7XG4gICAgICAgICAgICByZXN1bHQgKz0gX2NoYXIudG9TdHJpbmcoKTtcblxuICAgICAgICAgIGNhc2UgMTU6XG4gICAgICAgICAgICBfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uID0gdHJ1ZTtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA1O1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICBjYXNlIDE4OlxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDI0O1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICBjYXNlIDIwOlxuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDIwO1xuICAgICAgICAgICAgX2NvbnRleHQudDAgPSBfY29udGV4dFtcImNhdGNoXCJdKDMpO1xuICAgICAgICAgICAgX2RpZEl0ZXJhdG9yRXJyb3IgPSB0cnVlO1xuICAgICAgICAgICAgX2l0ZXJhdG9yRXJyb3IgPSBfY29udGV4dC50MDtcblxuICAgICAgICAgIGNhc2UgMjQ6XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMjQ7XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMjU7XG5cbiAgICAgICAgICAgIGlmICghKCFfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uICYmIF9pdGVyYXRvcltcInJldHVyblwiXSAhPSBudWxsKSkge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMjk7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMjk7XG4gICAgICAgICAgICByZXR1cm4gX2l0ZXJhdG9yW1wicmV0dXJuXCJdKCk7XG5cb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AgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDc7XG4gICAgICAgICAgICByZXR1cm4gX2l0ZXJhdG9yLm5leHQoKTtcblxuICAgICAgICAgIGNhc2UgNzpcbiAgICAgICAgICAgIF9zdGVwID0gX2NvbnRleHQuc2VudDtcbiAgICAgICAgICAgIF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gPSBfc3RlcC5kb25lO1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDExO1xuICAgICAgICAgICAgcmV0dXJuIF9zdGVwLnZhbHVlO1xuXG4gICAgICAgICAgY2FzZSAxMTpcbiAgICAgICAgICAgIF92YWx1ZTIgPSBfY29udGV4dC5zZW50O1xuXG4gICAgICAgICAgICBpZiAoX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbikge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTg7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB2YWx1ZSA9IF92YWx1ZTI7XG4gICAgICAgICAgICBfdmFsdWUgPSB2YWx1ZTtcblxuICAgICAgICAgIGNhc2UgMTU6XG4gICAgICAgICAgICBfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uID0gdHJ1ZTtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA1O1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICBjYXNlIDE4OlxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDI0O1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICBjYXNlIDIwOlxuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDIwO1xuICAgICAgICAgICAgX2NvbnRleHQudDAgPSBfY29udGV4dFtcImNhdGNoXCJdKDMpO1xuICAgICAgICAgICAgX2RpZEl0ZXJhdG9yRXJyb3IgPSB0cnVlO1xuICAgICAgICAgICAgX2l0ZXJhdG9yRXJyb3IgPSBfY29udGV4dC50MDtcblxuICAgICAgICAgIGNhc2UgMjQ6XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMjQ7XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMjU7XG5cbiAgICAgICAgICAgIGlmICghKCFfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uICYmIF9pdGVyYXRvcltcInJldHVyblwiXSAhPSBudWxsKSkge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMjk7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMjk7XG4gICAgICAgICAgICByZXR1cm4gX2l0ZXJhdG9yW1wicmV0dXJuXCJdKCk7XG5cbiAgICAgICAgICBjYXNlIDI5OlxuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDI5O1xuXG4gICAgICAgICAgICBpZiAoIV9kaWRJdGVyYXRvckVycm9yKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAzMjtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHRocm93IF9pdGVyYXRvckVycm9yO1xuXG4gICAgICAgICAgY2FzZSAzMjpcbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dC5maW5pc2goMjkpO1xuXG4gICAgICAgICAgY2FzZSAzMzpcbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dC5maW5pc2goMjQpO1xuXG4gICAgICAgICAgY2FzZSAzNDpcbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dC5hYnJ1cHQoXCJyZXR1cm5cIiwgX3ZhbHVlKTtcblxuICAgICAgICAgIGNhc2UgMzU6XG4gICAgICAgICAgY2FzZSBcImVuZFwiOlxuICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0LnN0b3AoKTtcbiAgICAgICAgfVxuICAgICAgfVxuICAgIH0sIF9jYWxsZWUsIG51bGwsIFtbMywgMjAsID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VlO1xuICAgICAgICAgICAgaGVhcC5wdXNoKHZhbHVlKTtcblxuICAgICAgICAgICAgaWYgKGhlYXAuc2l6ZSA+IG4pIHtcbiAgICAgICAgICAgICAgaGVhcC5wb3AoKTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgIGNhc2UgMTg6XG4gICAgICAgICAgICBfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uID0gdHJ1ZTtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA3O1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICBjYXNlIDIxOlxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDI3O1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICBjYXNlIDIzOlxuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDIzO1xuICAgICAgICAgICAgX2NvbnRleHQudDAgPSBfY29udGV4dFtcImNhdGNoXCJdKDUpO1xuICAgICAgICAgICAgX2RpZEl0ZXJhdG9yRXJyb3IgPSB0cnVlO1xuICAgICAgICAgICAgX2l0ZXJhdG9yRXJyb3IgPSBfY29udGV4dC50MDtcblxuICAgICAgICAgIGNhc2UgMjc6XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMjc7XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMjg7XG5cbiAgICAgICAgICAgIGlmICghKCFfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uICYmIF9pdGVyYXRvcltcInJldHVyblwiXSAhPSBudWxsKSkge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMzI7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMzI7XG4gICAgICAgICAgICByZXR1cm4gX2F3YWl0QXN5bmNHZW5lcmF0b3IoX2l0ZXJhdG9yW1wicmV0dXJuXCJdKCkpO1xuXG4gICAgICAgICAgY2FzZSAzMjpcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAzMjtcblxuICAgICAgICAgICAgaWYgKCFfZGlkSXRlcmF0b3JFcnJvcikge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMzU7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB0aHJvdyBfaXRlcmF0b3JFcnJvcjtcblxuICAgICAgICAgIGNhc2UgMzU6XG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuZmluaXNoKDMyKTtcblxuICAgICAgICAgIGNhc2UgMzY6XG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuZmluaXNoKDI3KTtcblxuICAgICAgICAgIGNhc2UgMzc6XG4gICAgICAgICAgICBpZiAoIWhlYXAuc2l6ZSkge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gNDI7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gNDA7XG4gICAgICAgICAgICByZXR1cm4gaGVhcC5wb3AoKTtcblxuICAgICAgICAgIGNhc2UgNDA6XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMzc7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgIGNhc2UgNDI6XG4gICAgICAgICAgY2FzZSBcImVuZFwiOlxuICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0LnN0b3AoKTtcbiAgICAgICAgfVxuICAgICAgfVxuICAgIH0sIF9jYWxsZWUsIG51bGwsIFtbNSwgMjMsIDI3LCAzN10sIFsyOCwsIDMyLCAzNl1dKTtcbiAgfSkpO1xuICByZXR1cm4gX2FzeW5jVGFrZVNvcnRlZC5hcHBseSh0aGlzLCBhcmd1bWVudHMpO1xufVxuXG52YXIgYXN5bmNUYWtlU29ydGVkID0gLyojX19QVVJFX18qL2FzeW5jSXRlcmFibGVDdXJyeShfX2FzeW5jVGFrZVNv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gIGhlYXAgPSBuZXcgSGVhcChjb21wYXJlKTtcbiAgICAgICAgICBfaXRlcmF0b3IgPSBfY3JlYXRlRm9yT2ZJdGVyYXRvckhlbHBlcihzb3VyY2UpO1xuXG4gICAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgIGZvciAoX2l0ZXJhdG9yLnMoKTsgIShfc3RlcCA9IF9pdGVyYXRvci5uKCkpLmRvbmU7KSB7XG4gICAgICAgICAgICAgIHZhbHVlID0gX3N0ZXAudmFsdWU7XG4gICAgICAgICAgICAgIGhlYXAucHVzaCh2YWx1ZSk7XG5cbiAgICAgICAgICAgICAgaWYgKGhlYXAuc2l6ZSA+IG4pIHtcbiAgICAgICAgICAgICAgICBoZWFwLnBvcCgpO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfSBjYXRjaCAoZXJyKSB7XG4gICAgICAgICAgICBfaXRlcmF0b3IuZShlcnIpO1xuICAgICAgICAgIH0gZmluYWxseSB7XG4gICAgICAgICAgICBfaXRlcmF0b3IuZigpO1xuICAgICAgICAgIH1cblxuICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgaWYgKCFoZWFwLnNpemUpIHtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxMDtcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA4O1xuICAgICAgICAgIHJldHVybiBoZWFwLnBvcCgpO1xuXG4gICAgICAgIGNhc2UgODpcbiAgICAgICAgICBfY29udGV4dC5uZXh0ID0gNTtcbiAgICAgICAgICBicmVhaztcblxuICAgICAgICBjYXNlIDEwOlxuICAgICAgICBjYXNlIFwiZW5kXCI6XG4gICAgICAgICAgcmV0dXJuIF9jb250ZXh0LnN0b3AoKTtcbiAgICAgIH1cbiAgICB9XG4gIH0sIF9tYXJrZWQpO1xufVxuXG5leHBvcnRzLl9fdGFrZVNvcnRlZCA9IF9fdGFrZVNvcnR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uICAgICAgICAgIGNhc2UgODpcbiAgICAgICAgICAgIF9zdGVwID0gX2NvbnRleHQuc2VudDtcbiAgICAgICAgICAgIF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gPSBfc3RlcC5kb25lO1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDEyO1xuICAgICAgICAgICAgcmV0dXJuIF9hd2FpdEFzeW5jR2VuZXJhdG9yKF9zdGVwLnZhbHVlKTtcblxuICAgICAgICAgIGNhc2UgMTI6XG4gICAgICAgICAgICBfdmFsdWUgPSBfY29udGV4dC5zZW50O1xuXG4gICAgICAgICAgICBpZiAoX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbikge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMjc7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB2YWx1ZSA9IF92YWx1ZTtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxNztcbiAgICAgICAgICAgIHJldHVybiBfYXdhaXRBc3luY0dlbmVyYXRvcihwcmVkaWNhdGUodmFsdWUsIGMrKykpO1xuXG4gICAgICAgICAgY2FzZSAxNzpcbiAgICAgICAgICAgIHRha2UgPSBfY29udGV4dC5zZW50O1xuXG4gICAgICAgICAgICBpZiAoIXRha2UpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDIzO1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDIxO1xuICAgICAgICAgICAgcmV0dXJuIHZhbHVlO1xuXG4gICAgICAgICAgY2FzZSAyMTpcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyNDtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSAyMzpcbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dC5hYnJ1cHQoXCJicmVha1wiLCAyNyk7XG5cbiAgICAgICAgICBjYXNlIDI0OlxuICAgICAgICAgICAgX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiA9IHRydWU7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gNjtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSAyNzpcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAzMztcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSAyOTpcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAyOTtcbiAgICAgICAgICAgIF9jb250ZXh0LnQwID0gX2NvbnRleHRbXCJjYXRjaFwiXSg0KTtcbiAgICAgICAgICAgIF9kaWRJdGVyYXRvckVycm9yID0gdHJ1ZTtcbiAgICAgICAgICAgIF9pdGVyYXRvckVycm9yID0gX2NvbnRleHQudDA7XG5cbiAgICAgICAgICBjYXNlIDMzOlxuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDMzO1xuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDM0O1xuXG4gICAgICAgICAgICBpZiAoISghX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiAmJiBfaXRlcmF0b3JbXCJyZXR1cm5cIl0gIT0gbnVsbCkpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDM4O1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDM4O1xuICAgICAgICAgICAgcmV0dXJuIF9hd2FpdEFzeW5jR2VuZXJhdG9yKF9pdGVyYXRvcltcInJldHVyblwiXSgpKTtcblxuICAgICAgICAgIGNhc2UgMzg6XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMzg7XG5cbiAgICAgICAgICAgIGlmICghX2RpZEl0ZXJhdG9yRXJyb3IpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDQxO1xuICA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sIHByZWRpY2F0ZSkge1xuICB2YXIgdGFrZSwgYywgX2l0ZXJhdG9yLCBfc3RlcCwgdmFsdWU7XG5cbiAgcmV0dXJuIF9yZWdlbmVyYXRvclJ1bnRpbWUud3JhcChmdW5jdGlvbiBfX3Rha2VXaGlsZSQoX2NvbnRleHQpIHtcbiAgICB3aGlsZSAoMSkge1xuICAgICAgc3dpdGNoIChfY29udGV4dC5wcmV2ID0gX2NvbnRleHQubmV4dCkge1xuICAgICAgICBjYXNlIDA6XG4gICAgICAgICAgdGFrZSA9IHRydWU7XG4gICAgICAgICAgYyA9IDA7XG4gICAgICAgICAgX2l0ZXJhdG9yID0gX2NyZWF0ZUZvck9mSXRlcmF0b3JIZWxwZXIoc291cmNlKTtcbiAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMztcblxuICAgICAgICAgIF9pdGVyYXRvci5zKCk7XG5cbiAgICAgICAgY2FzZSA1OlxuICAgICAgICAgIGlmICgoX3N0ZXAgPSBfaXRlcmF0b3IubigpKS5kb25lKSB7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTY7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgICB9XG5cbiAgICAgICAgICB2YWx1ZSA9IF9zdGVwLnZhbHVlO1xuICAgICAgICAgIHRha2UgPSBwcmVkaWNhdGUodmFsdWUsIGMrKyk7XG5cbiAgICAgICAgICBpZiAoIXRha2UpIHtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxMztcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxMTtcbiAgICAgICAgICByZXR1cm4gdmFsdWU7XG5cbiAgICAgICAgY2FzZSAxMTpcbiAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTQ7XG4gICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgY2FzZSAxMzpcbiAgICAgICAgICByZXR1cm4gX2NvbnRleHQuYWJydXB0KFwiYnJ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DApKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyO1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0LmFicnVwdChcInJldHVyblwiKTtcblxuICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgIGkgPSAwO1xuICAgICAgICAgICAgX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiA9IHRydWU7XG4gICAgICAgICAgICBfZGlkSXRlcmF0b3JFcnJvciA9IGZhbHNlO1xuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDU7XG4gICAgICAgICAgICBfaXRlcmF0b3IgPSBfYXN5bmNJdGVyYXRvcihpdGVyYWJsZSk7XG5cbiAgICAgICAgICBjYXNlIDc6XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gOTtcbiAgICAgICAgICAgIHJldHVybiBfYXdhaXRBc3luY0dlbmVyYXRvcihfaXRlcmF0b3IubmV4dCgpKTtcblxuICAgICAgICAgIGNhc2UgOTpcbiAgICAgICAgICAgIF9zdGVwID0gX2NvbnRleHQuc2VudDtcbiAgICAgICAgICAgIF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gPSBfc3RlcC5kb25lO1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDEzO1xuICAgICAgICAgICAgcmV0dXJuIF9hd2FpdEFzeW5jR2VuZXJhdG9yKF9zdGVwLnZhbHVlKTtcblxuICAgICAgICAgIGNhc2UgMTM6XG4gICAgICAgICAgICBfdmFsdWUgPSBfY29udGV4dC5zZW50O1xuXG4gICAgICAgICAgICBpZiAoX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbikge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMjM7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB2YWx1ZSA9IF92YWx1ZTtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxODtcbiAgICAgICAgICAgIHJldHVybiB2YWx1ZTtcblxuICAgICAgICAgIGNhc2UgMTg6XG4gICAgICAgICAgICBpZiAoISgrK2kgPT09IG4pKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyMDtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dC5hYnJ1cHQoXCJicmVha1wiLCAyMyk7XG5cbiAgICAgICAgICBjYXNlIDIwOlxuICAgICAgICAgICAgX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiA9IHRydWU7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gNztcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSAyMzpcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyOTtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSAyNTpcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAyNTtcbiAgICAgICAgICAgIF9jb250ZXh0LnQwID0gX2NvbnRleHRbXCJjYXRjaFwiXSg1KTtcbiAgICAgICAgICAgIF9kaWRJdGVyYXRvckVycm9yID0gdHJ1ZTtcbiAgICAgICAgICAgIF9pdGVyYXRvckVycm9yID0gX2NvbnRleHQudDA7XG5cbiAgICAgICAgICBjYXNlIDI5OlxuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDI5O1xuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDMwO1xuXG4gICAgICAgICAgICBpZiAoISghX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiAmJiBfaXRlcmF0b3JbXCJyZXR1cm5cIl0gIT0gbnVsbCkpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDM0O1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAg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yBpKyspIHsgYXJyMltpXSA9IGFycltpXTsgfSByZXR1cm4gYXJyMjsgfVxuXG52YXIgX3JlcXVpcmUgPSByZXF1aXJlKCcuLi8uLi9pbnRlcm5hbC9pdGVyYWJsZS5qcycpLFxuICAgIGl0ZXJhYmxlQ3VycnkgPSBfcmVxdWlyZS5pdGVyYWJsZUN1cnJ5O1xuXG5mdW5jdGlvbiBfX3Rha2UoaXRlcmFibGUsIG4pIHtcbiAgdmFyIGksIF9pdGVyYXRvciwgX3N0ZXAsIHZhbHVlO1xuXG4gIHJldHVybiBfcmVnZW5lcmF0b3JSdW50aW1lLndyYXAoZnVuY3Rpb24gX190YWtlJChfY29udGV4dCkge1xuICAgIHdoaWxlICgxKSB7XG4gICAgICBzd2l0Y2ggKF9jb250ZXh0LnByZXYgPSBfY29udGV4dC5uZXh0KSB7XG4gICAgICAgIGNhc2UgMDpcbiAgICAgICAgICBpZiAoIShuID09PSAwKSkge1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDI7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgICB9XG5cbiAgICAgICAgICByZXR1cm4gX2NvbnRleHQuYWJydXB0KFwicmV0dXJuXCIpO1xuXG4gICAgICAgIGNhc2UgMjpcbiAgICAgICAgICBpID0gMDtcbiAgICAgICAgICBfaXRlcmF0b3IgPSBfY3JlYXRlRm9yT2ZJdGVyYXRvckhlbHBlcihpdGVyYWJsZSk7XG4gICAgICAgICAgX2NvbnRleHQucHJldiA9IDQ7XG5cbiAgICAgICAgICBfaXRlcmF0b3IucygpO1xuXG4gICAgICAgIGNhc2UgNjpcbiAgICAgICAgICBpZiAoKF9zdGVwID0gX2l0ZXJhdG9yLm4oKSkuZG9uZSkge1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDE0O1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgdmFsdWUgPSBfc3RlcC52YWx1ZTtcbiAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTA7XG4gICAgICAgICAgcmV0dXJuIHZhbHVlO1xuXG4gICAgICAgIGNhc2UgMTA6XG4gICAgICAgICAgaWYgKCEoKytpID09PSBuKSkge1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDEyO1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgcmV0dXJuIF9jb250ZXh0LmFicnVwdChcImJyZWFrXCIsIDE0KTtcblxuICAgICAgICBjYXNlIDEyOlxuICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA2O1xuICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgIGNhc2UgMTQ6XG4gICAgICAgICAgX2NvbnRleHQubmV4dCA9IDE5O1xuICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgIGNhc2UgMTY6XG4gICAgICAgICAgX2NvbnRleHQucHJldiA9IDE2O1xuICAgICAgICAgIF9jb250ZXh0LnQwID0gX2NvbnRleHRbXCJjYXRjaFwiXSg0KTtcblxuICAgICAgICAgIF9pdGVyYXRvci5lKF9jb250ZXh0LnQwKTtcblxuICAgICAgICBjYXNlIDE5OlxuICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAxOTtcblxuICAgICAgICAgIF9pdGVyYXRvci5mKCk7XG5cbiAgICAgICAgICByZXR1cm4gX2NvbnRleHQuZmluaXNoKDE5KTtcblxuICAgICAgICBjYXNlIDIyOlxuICAgICAgICBjYXNlIFwiZW5kXCI6XG4gICAgICAgICAgcmV0dXJuIF9jb250ZXh0LnN0b3AoKTtcbiAgICAgIH1cbiAgICB9XG4gIH0sIF9tYXJrZWQsIG51bGwsIFtbNCwgMTYsIDE5LCAyMl1dKTtcbn1cblxuZXhwb3J0cy5fX3Rha2UgPSBfX3Rha2U7XG52YXIgdGFrZSA9IC8qI19fUFVSRV9fKi9pdGVyYWJsZUN1cnJ5KF9fdGFrZSk7XG5leHBvcnRzLnRha2UgPSB0YWtlOyIsInZhciBfcmVnZW5lc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yYXRvclJ1bnRpbWUud3JhcChmdW5jdGlvbiBfY2FsbGVlJChfY29udGV4dCkge1xuICAgICAgd2hpbGUgKDEpIHtcbiAgICAgICAgc3dpdGNoIChfY29udGV4dC5wcmV2ID0gX2NvbnRleHQubmV4dCkge1xuICAgICAgICAgIGNhc2UgMDpcbiAgICAgICAgICAgIGMgPSAwO1xuICAgICAgICAgICAgX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiA9IHRydWU7XG4gICAgICAgICAgICBfZGlkSXRlcmF0b3JFcnJvciA9IGZhbHNlO1xuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDM7XG4gICAgICAgICAgICBfaXRlcmF0b3IgPSBfYXN5bmNJdGVyYXRvcihzb3VyY2UpO1xuXG4gICAgICAgICAgY2FzZSA1OlxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDc7XG4gICAgICAgICAgICByZXR1cm4gX2F3YWl0QXN5bmNHZW5lcmF0b3IoX2l0ZXJhdG9yLm5leHQoKSk7XG5cbiAgICAgICAgICBjYXNlIDc6XG4gICAgICAgICAgICBfc3RlcCA9IF9jb250ZXh0LnNlbnQ7XG4gICAgICAgICAgICBfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uID0gX3N0ZXAuZG9uZTtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxMTtcbiAgICAgICAgICAgIHJldHVybiBfYXdhaXRBc3luY0dlbmVyYXRvcihfc3RlcC52YWx1ZSk7XG5cbiAgICAgICAgICBjYXNlIDExOlxuICAgICAgICAgICAgX3ZhbHVlID0gX2NvbnRleHQuc2VudDtcblxuICAgICAgICAgICAgaWYgKF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24pIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDIwO1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdmFsdWUgPSBfdmFsdWU7XG4gICAgICAgICAgICBjYWxsYmFjayh2YWx1ZSwgYysrKTtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxNztcbiAgICAgICAgICAgIHJldHVybiB2YWx1ZTtcblxuICAgICAgICAgIGNhc2UgMTc6XG4gICAgICAgICAgICBfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uID0gdHJ1ZTtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA1O1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICBjYXNlIDIwOlxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDI2O1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICBjYXNlIDIyOlxuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDIyO1xuICAgICAgICAgICAgX2NvbnRleHQudDAgPSBfY29udGV4dFtcImNhdGNoXCJdKDMpO1xuICAgICAgICAgICAgX2RpZEl0ZXJhdG9yRXJyb3IgPSB0cnVlO1xuICAgICAgICAgICAgX2l0ZXJhdG9yRXJyb3IgPSBfY29udGV4dC50MDtcblxuICAgICAgICAgIGNhc2UgMjY6XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMjY7XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMjc7XG5cbiAgICAgICAgICAgIGlmICghKCFfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uICYmIF9pdGVyYXRvcltcInJldHVyblwiXSAhPSBudWxsKSkge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMzE7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMzE7XG4gICAgICAgICAgICByZXR1cm4gX2F3YWl0QXN5bmNHZW5lcmF0b3IoX2l0ZXJhdG9yW1wicmV0dXJuXCJdKCkpO1xuXG4gICAgICAgICAgY2FzZSAzMTpcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAzMTtcbl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mN0aW9uIF9fdGFwKHNvdXJjZSwgY2FsbGJhY2spIHtcbiAgdmFyIGMsIF9pdGVyYXRvciwgX3N0ZXAsIHZhbHVlO1xuXG4gIHJldHVybiBfcmVnZW5lcmF0b3JSdW50aW1lLndyYXAoZnVuY3Rpb24gX190YXAkKF9jb250ZXh0KSB7XG4gICAgd2hpbGUgKDEpIHtcbiAgICAgIHN3aXRjaCAoX2NvbnRleHQucHJldiA9IF9jb250ZXh0Lm5leHQpIHtcbiAgICAgICAgY2FzZSAwOlxuICAgICAgICAgIGMgPSAwO1xuICAgICAgICAgIF9pdGVyYXRvciA9IF9jcmVhdGVGb3JPZkl0ZXJhdG9ySGVscGVyKHNvdXJjZSk7XG4gICAgICAgICAgX2NvbnRleHQucHJldiA9IDI7XG5cbiAgICAgICAgICBfaXRlcmF0b3IucygpO1xuXG4gICAgICAgIGNhc2UgNDpcbiAgICAgICAgICBpZiAoKF9zdGVwID0gX2l0ZXJhdG9yLm4oKSkuZG9uZSkge1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDExO1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgdmFsdWUgPSBfc3RlcC52YWx1ZTtcbiAgICAgICAgICBjYWxsYmFjayh2YWx1ZSwgYysrKTtcbiAgICAgICAgICBfY29udGV4dC5uZXh0ID0gOTtcbiAgICAgICAgICByZXR1cm4gdmFsdWU7XG5cbiAgICAgICAgY2FzZSA5OlxuICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA0O1xuICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgIGNhc2UgMTE6XG4gICAgICAgICAgX2NvbnRleHQubmV4dCA9IDE2O1xuICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgIGNhc2UgMTM6XG4gICAgICAgICAgX2NvbnRleHQucHJldiA9IDEzO1xuICAgICAgICAgIF9jb250ZXh0LnQwID0gX2NvbnRleHRbXCJjYXRjaFwiXSgyKTtcblxuICAgICA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ZXAudmFsdWU7XG5cbiAgICAgICAgICBjYXNlIDExOlxuICAgICAgICAgICAgX3ZhbHVlID0gX2NvbnRleHQuc2VudDtcblxuICAgICAgICAgICAgaWYgKF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24pIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDE4O1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdmFsdWUgPSBfdmFsdWU7XG4gICAgICAgICAgICBvdXQucHVzaCh2YWx1ZSk7XG5cbiAgICAgICAgICBjYXNlIDE1OlxuICAgICAgICAgICAgX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiA9IHRydWU7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gNTtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSAxODpcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyNDtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSAyMDpcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAyMDtcbiAgICAgICAgICAgIF9jb250ZXh0LnQwID0gX2NvbnRleHRbXCJjYXRjaFwiXSgzKTtcbiAgICAgICAgICAgIF9kaWRJdGVyYXRvckVycm9yID0gdHJ1ZTtcbiAgICAgICAgICAgIF9pdGVyYXRvckVycm9yID0gX2NvbnRleHQudDA7XG5cbiAgICAgICAgICBjYXNlIDI0OlxuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDI0O1xuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDI1O1xuXG4gICAgICAgICAgICBpZiAoISghX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiAmJiBfaXRlcmF0b3JbXCJyZXR1cm5cIl0gIT0gbnVsbCkpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDI5O1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDI5O1xuICAgICAgICAgICAgcmV0dXJuIF9pdGVyYXRvcltcInJldHVyblwiXSgpO1xuXG4gICAgICAgICAgY2FzZSAyOTpcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAyOTtcblxuICAgICAgICAgICAgaWYgKCFfZGlkSXRlcmF0b3JFcnJvcikge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMzI7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB0aHJvdyBfaXRlcmF0b3JFcnJvcjtcblxuICAgICAgICAgIGNhc2UgMzI6XG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuZmluaXNoKDI5KTtcblxuICAgICAgICAgIGNhc2UgMzM6XG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuZmluaXNoKDI0KTtcblxuICAgICAgICAgIGNhc2UgMzQ6XG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuYWJydXB0KFwicmV0dXJuXCIsIG91dCk7XG5cbiAgICAgICAgICBjYXNlIDM1OlxuICAgICAgICAgIGNhc2UgXCJlbmRcIjpcbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dC5zdG9wKCk7XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICB9LCBfY2FsbGVlLCBudWxsLCBbWzMsIDIwLCAyNCwgMzRdLCBbMjUsLCAyOSwgMzNdXSk7XG4gIH0pKTtcbiAgcmV0dXJuIF9hc3luY1RvQXJyYXkuYXBwbHkodGhpcywgYXJndW1lbnRzKTtcbn1cblxuZXhwb3J0cy5fX2FzeW5jVG9BcnJheSA9IF9fYXN5bmNUb0FycmF5O1xuXG5mdW5jdGlvbiBhc3luY1RvQXJyYXkoc291cmNlKSB7XG4gIHJldHVybiBfX2FzeW5jVG9BcnJheShhc3luY0Vuc3VyZUl0ZXJhYmxlKHNvdXJjZSkpO1xufVx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XG4gICAgICAgIHN3aXRjaCAoX2NvbnRleHQucHJldiA9IF9jb250ZXh0Lm5leHQpIHtcbiAgICAgICAgICBjYXNlIDA6XG4gICAgICAgICAgICBwcm90byA9IF9hcmdzLmxlbmd0aCA+IDEgJiYgX2FyZ3NbMV0gIT09IHVuZGVmaW5lZCA/IF9hcmdzWzFdIDogT2JqZWN0LnByb3RvdHlwZTtcbiAgICAgICAgICAgIG9iaiA9IE9iamVjdC5jcmVhdGUocHJvdG8pO1xuICAgICAgICAgICAgX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiA9IHRydWU7XG4gICAgICAgICAgICBfZGlkSXRlcmF0b3JFcnJvciA9IGZhbHNlO1xuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDQ7XG4gICAgICAgICAgICBfaXRlcmF0b3IgPSBfYXN5bmNJdGVyYXRvcihpdGVyYWJsZSk7XG5cbiAgICAgICAgICBjYXNlIDY6XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gODtcbiAgICAgICAgICAgIHJldHVybiBfaXRlcmF0b3IubmV4dCgpO1xuXG4gICAgICAgICAgY2FzZSA4OlxuICAgICAgICAgICAgX3N0ZXAgPSBfY29udGV4dC5zZW50O1xuICAgICAgICAgICAgX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiA9IF9zdGVwLmRvbmU7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTI7XG4gICAgICAgICAgICByZXR1cm4gX3N0ZXAudmFsdWU7XG5cbiAgICAgICAgICBjYXNlIDEyOlxuICAgICAgICAgICAgX3ZhbHVlID0gX2NvbnRleHQuc2VudDtcblxuICAgICAgICAgICAgaWYgKF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24pIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDE5O1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgX3ZhbHVlMiA9IF92YWx1ZSwgX3ZhbHVlMyA9IF9zbGljZWRUb0FycmF5KF92YWx1ZTIsIDIpLCBrZXkgPSBfdmFsdWUzWzBdLCB2YWx1ZSA9IF92YWx1ZTNbMV07XG4gICAgICAgICAgICBvYmpba2V5XSA9IHZhbHVlO1xuXG4gICAgICAgICAgY2FzZSAxNjpcbiAgICAgICAgICAgIF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gPSB0cnVlO1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDY7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgIGNhc2UgMTk6XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMjU7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgIGNhc2UgMjE6XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMjE7XG4gICAgICAgICAgICBfY29udGV4dC50MCA9IF9jb250ZXh0W1wiY2F0Y2hcIl0oNCk7XG4gICAgICAgICAgICBfZGlkSXRlcmF0b3JFcnJvciA9IHRydWU7XG4gICAgICAgICAgICBfaXRlcmF0b3JFcnJvciA9IF9jb250ZXh0LnQwO1xuXG4gICAgICAgICAgY2FzZSAyNTpcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAyNTtcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAyNjtcblxuICAgICAgICAgICAgaWYgKCEoIV9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gJiYgX2l0ZXJhdG9yW1wicmV0dXJuXCJdICE9IG51bGwpKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAzMDtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAzMDtcbiAgICAgICAgICAgIHJldHVybiBfaXRlcmF0b3JbXCJyZXR1cm5cIl0oKTtcblxuICAgICAgICAgIGNhc2UgMzA6XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0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AgICBfY29udGV4dC5uZXh0ID0gMjU7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB2YWx1ZSA9IF92YWx1ZTtcbiAgICAgICAgICAgIGJ1ZmZlci5wdXNoKHZhbHVlKTtcblxuICAgICAgICAgICAgaWYgKCFidWZmZXIuaXNGdWxsKCkpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDIxO1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDIxO1xuICAgICAgICAgICAgcmV0dXJuIGJ1ZmZlclJlYWRQcm94eTtcblxuICAgICAgICAgIGNhc2UgMjE6XG4gICAgICAgICAgICBsZW4rKztcblxuICAgICAgICAgIGNhc2UgMjI6XG4gICAgICAgICAgICBfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uID0gdHJ1ZTtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA4O1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICBjYXNlIDI1OlxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDMxO1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICBjYXNlIDI3OlxuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDI3O1xuICAgICAgICAgICAgX2NvbnRleHQudDAgPSBfY29udGV4dFtcImNhdGNoXCJdKDYpO1xuICAgICAgICAgICAgX2RpZEl0ZXJhdG9yRXJyb3IgPSB0cnVlO1xuICAgICAgICAgICAgX2l0ZXJhdG9yRXJyb3IgPSBfY29udGV4dC50MDtcblxuICAgICAgICAgIGNhc2UgMzE6XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMzE7XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMzI7XG5cbiAgICAgICAgICAgIGlmICghKCFfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uICYmIF9pdGVyYXRvcltcInJldHVyblwiXSAhPSBudWxsKSkge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMzY7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMzY7XG4gICAgICAgICAgICByZXR1cm4gX2F3YWl0QXN5bmNHZW5lcmF0b3IoX2l0ZXJhdG9yW1wicmV0dXJuXCJdKCkpO1xuXG4gICAgICAgICAgY2FzZSAzNjpcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAzNjtcblxuICAgICAgICAgICAgaWYgKCFfZGlkSXRlcmF0b3JFcnJvcikge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMzk7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB0aHJvdyBfaXRlcmF0b3JFcnJvcjtcblxuICAgICAgICAgIGNhc2UgMzk6XG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuZmluaXNoKDM2KTtcblxuICAgICAgICAgIGNhc2UgNDA6XG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuZmluaXNoKDMxKTtcblxuICAgICAgICAgIGNhc2UgNDE6XG4gICAgICAgICAgICBpZiAodXNlRmlsbGVyKSB7XG4gICAgICAgICAgICAgIGZvciAoaSA9IGxlbjsgaSA8IHNpemU7IGkrKykge1xuICAgICAgICAgICAgICAgIGJ1ZmZlci5wdXNoKGZpbGxlcik7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgaWYgKCEobGVuID4gMCAmJiBsZW4gPCBzaXplKSkge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gNDU7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gNDU7XG4gICAgICAgICAgICByZXR1cm4gYnVmZmVyUmVhZFByb3h5O1xuXG4gICAgICAgICAgY2FzZSA0NTpcbiAgICAgICAgICAgIF9pID0gMDtcblxuICAgICAgICAgIGNhc2UgNDY6XG4gICAgICAgICAgICBpZiAoIShfaSA8IE1hdGgubWluKHNpemUsIGxlbikgLSAxKSkge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gNTQ7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBidWZmZXIuc2hpZnQoKTtcblxuICAgICAgICAgICAgaWYgKHVzZUZpbGxlcikge1xuICAgICAgICAgICAgICBidWZmZXIucHVzaChmaWxsZXIpO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gNTE7XG4gICAgICAgICAgICByZXR1cm4gYnVmZmVyUmVhZFByb3h5O1xuXG4gICAgICAgICAgY2FzZSA1MTpcbiAgICAgICAgICAgIF9pKys7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gNDY7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgIGNhc2UgNTQ6XG4gICAgICAgICAgY2FzZSBcImVuZFwiOlxuICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0LnN0b3AoKTtcbiAgICAgICAgfVxuICAgICAgfVxuICAgIH0sIF9jYWxsZWUsIG51bGwsIFtbNiwgMjcsIDMxLCA0MV0sIFszMiwsIDM2LCA0MF1dKTtcbiAgfSkpO1xuICByZXR1cm4gX2FzeW5jV2luZG93QWhlYWQuYXBwbHkodGhpcywgYXJndW1lbnRzKTtcbn1cblxudmFyIGFzeW5jV2luZG93QWhlYWQgPSAvKiNfX1BVUkVfXyovYXN5bmNJdGVyYWJsZUN1cnJ5KF9fYXN5bmNXaW5kb3dBaGVhZCwge1xuICBtaW5BcmdzOiAxLFxuICBtYXhBcmdzOiAyLFxuICB2YWxpZGF0ZUFyZ3M6IGZ1bmN0aW9uIHZhbGlkYXRlQXJncyh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gIF9jb250ZXh0Lm5leHQgPSAxNjtcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIHZhbHVlID0gX3N0ZXAudmFsdWU7XG4gICAgICAgICAgYnVmZmVyLnB1c2godmFsdWUpO1xuXG4gICAgICAgICAgaWYgKCFidWZmZXIuaXNGdWxsKCkpIHtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxMztcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxMztcbiAgICAgICAgICByZXR1cm4gYnVmZmVyUmVhZFByb3h5O1xuXG4gICAgICAgIGNhc2UgMTM6XG4gICAgICAgICAgbGVuKys7XG5cbiAgICAgICAgY2FzZSAxNDpcbiAgICAgICAgICBfY29udGV4dC5uZXh0ID0gNztcbiAgICAgICAgICBicmVhaztcblxuICAgICAgICBjYXNlIDE2OlxuICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyMTtcbiAgICAgICAgICBicmVhaztcblxuICAgICAgICBjYXNlIDE4OlxuICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAxODtcbiAgICAgICAgICBfY29udGV4dC50MCA9IF9jb250ZXh0W1wiY2F0Y2hcIl0oNSk7XG5cbiAgICAgICAgICBfaXRlcmF0b3IuZShfY29udGV4dC50MCk7XG5cbiAgICAgICAgY2FzZSAyMTpcbiAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMjE7XG5cbiAgICAgICAgICBfaXRlcmF0b3IuZigpO1xuXG4gICAgICAgICAgcmV0dXJuIF9jb250ZXh0LmZpbmlzaCgyMSk7XG5cbiAgICAgICAgY2FzZSAyNDpcbiAgICAgICAgICBpZiAodXNlRmlsbGVyKSB7XG4gICAgICAgICAgICBmb3IgKGkgPSBsZW47IGkgPCBzaXplOyBpKyspIHtcbiAgICAgICAgICAgICAgYnVmZmVyLnB1c2goZmlsbGVyKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG5cbiAgICAgICAgICBpZiAoIShsZW4gPiAwICYmIGxlbiA8IHNpemUpKSB7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMjg7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgICB9XG5cbiAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMjg7XG4gICAgICAgICAgcmV0dXJuIGJ1ZmZlclJlYWRQcm94eTtcblxuICAgICAgICBjYXNlIDI4OlxuICAgICAgICAgIF9pID0gMDtcblxuICAgICAgICBjYXNlIDI5OlxuICAgICAgICAgIGlmICghKF9pIDwgTWF0aC5taW4oc2l6ZSwgbGVuKSAtIDEpKSB7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMzc7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgICB9XG5cbiAgICAgICAgICBidWZmZXIuc2hpZnQoKTtcblxuICAgICAgICAgIGlmICh1c2VGaWxsZXIpIHtcbiAgICAgICAgICAgIGJ1ZmZlci5wdXNoKGZpbGxlcik7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgX2NvbnRleHQubmV4dCA9IDM0O1xuICAgICAgICAgIHJldHVybiBidWZmZXJSZWFkUHJveHk7XG5cbiAgICAgICAgY2FzZSAzNDpcbiAgICAgICAgICBfaSsrO1xuICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyOTtcbiAgICAgICAgICBicmVhaztcblxuICAgICAgICBjYXNlIDM3OlxuICAgICAgICBjYXNlIFwiZW5kXCI6XG4gICAgICAgICAgcmV0dXJuIF9jb250ZXh0LnN0b3AoKTtcbiAgICAgIH1cbiAgICB9XG4gIH0sIF9tYXJrZWQsIG51bGwsIFtbNSwgMTgsIDIxLCAyNF1dKTtcbn1cblxuZXhwb3J0cy5fX3dpbmRvd0FoZWFkID0gX193aW5kb3dBaGVhZDtcbnZhciB3aW5kb3dBaGVhZCA9IC8qI19fUFVSRV9fKi9pdGVyYWJsZUN1cnJ5KF9fd2luZG93QWh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XJnc1syXSAhPT0gdW5kZWZpbmVkID8gX2FyZ3NbMl0gOiB7fSwgZmlsbGVyID0gX3JlZi5maWxsZXI7XG4gICAgICAgICAgICBidWZmZXIgPSBuZXcgQ2lyY3VsYXJCdWZmZXIoc2l6ZSk7XG4gICAgICAgICAgICBidWZmZXJSZWFkUHJveHkgPSBuZXcgUmVhZE9ubHlDaXJjdWxhckJ1ZmZlcihidWZmZXIpO1xuICAgICAgICAgICAgYnVmZmVyLmZpbGwoZmlsbGVyKTtcbiAgICAgICAgICAgIF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gPSB0cnVlO1xuICAgICAgICAgICAgX2RpZEl0ZXJhdG9yRXJyb3IgPSBmYWxzZTtcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSA2O1xuICAgICAgICAgICAgX2l0ZXJhdG9yID0gX2FzeW5jSXRlcmF0b3Ioc291cmNlKTtcblxuICAgICAgICAgIGNhc2UgODpcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxMDtcbiAgICAgICAgICAgIHJldHVybiBfYXdhaXRBc3luY0dlbmVyYXRvcihfaXRlcmF0b3IubmV4dCgpKTtcblxuICAgICAgICAgIGNhc2UgMTA6XG4gICAgICAgICAgICBfc3RlcCA9IF9jb250ZXh0LnNlbnQ7XG4gICAgICAgICAgICBfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uID0gX3N0ZXAuZG9uZTtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxNDtcbiAgICAgICAgICAgIHJldHVybiBfYXdhaXRBc3luY0dlbmVyYXRvcihfc3RlcC52YWx1ZSk7XG5cbiAgICAgICAgICBjYXNlIDE0OlxuICAgICAgICAgICAgX3ZhbHVlID0gX2NvbnRleHQuc2VudDtcblxuICAgICAgICAgICAgaWYgKF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24pIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDIzO1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdmFsdWUgPSBfdmFsdWU7XG4gICAgICAgICAgICBidWZmZXIucHVzaCh2YWx1ZSk7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMjA7XG4gICAgICAgICAgICByZXR1cm4gYnVmZmVyUmVhZFByb3h5O1xuXG4gICAgICAgICAgY2FzZSAyMDpcbiAgICAgICAgICAgIF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gPSB0cnVlO1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDg7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgIGNhc2UgMjM6XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMjk7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgIGNhc2UgMjU6XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMjU7XG4gICAgICAgICAgICBfY29udGV4dC50MCA9IF9jb250ZXh0W1wiY2F0Y2hcIl0oNik7XG4gICAgICAgICAgICBfZGlkSXRlcmF0b3JFcnJvciA9IHRydWU7XG4gICAgICAgICAgICBfaXRlcmF0b3JFcnJvciA9IF9jb250ZXh0LnQwO1xuXG4gICAgICAgICAgY2FzZSAyOTpcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAyOTtcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAzMDtcblxuICAgICAgICAgICAgaWYgKCEoIV9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gJiYgX2l0ZXJhdG9yW1wicmV0dXJuXCJdICE9IG51bGwpKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAzNDtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAzNDtcbiAgICAgICAgICAgIHJldHVybiBfYXdhaXRBc3luY0dlbmVyYXRvcihfaXRlcmF0b3JbXCJyZXR1cm5cIl0oKSk7XG5cbiAgICAgICAgICBjYXNlIDM0OlxuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDM0O1xuXG4gICAgICAgICAgICBpZiAoIV9kaWRJdGVyYXRvckVycm9yKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAzNztcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHRocm93IF9pdGVyYXRvckVycm9yO1xuXG4gICAgICAgICAgY2FzZSAzNzpcbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dC5maW5pc2goMzQpO1xuXG4gICAgICAgICAgY2FzZSAzODpcbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dC5maW5pc2goMjkpO1xuXG4gICAgICAgICAgY2FzZSAzOTpcbiAgICAgICAgICBjYXNlIFwiZW5kXCI6XG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuc3RvcCgpO1xuICAgICAgICB9XG4gICAgICB9XG4gICAgfSwgX2NhbGxlZSwgbnVsbCwgW1s2LCAyNSwgMjksIDM5XSwgWzMwLCwgMzQsIDM4XV0pO1xuICB9KSk7XG4gIHJldHVybiBfYXN5bmNXaW5kb3dCZWhpbmQuYXBwbHkodGhpcywgYXJndW1lbnRzKTtcbn1cblxudmFyIGFzeW5jV2luZG93QmVoaW5kID0gLyojX19QVVJFX18qL2FzeW5jSXRlcmFibGVDdXJyeShfX2FzeW5jV2luZG93QmVoaW5kLCB7XG4gIG1pbkFyZ3M6IDEsXG4gIG1heEFyZ3M6IDIsXG4gIHZhbGlkYXRlQXJnczogZnVuY3Rpb24gdmFsaWRhdGVBcmdzKGFyZ3MpIHtcbiAgICBpZiAodHlwZW9mIGFyZ3NbMV0gIT09ICdudW1iZXInKSB7XG4gICAgICB0aHJvdyBuZXcgRXJyb3IoJ2FzeW5jV2luZG93QmVoaW5kJy5jb25jYXQoXCIgbXVzdCBiZSBwYXNzZWQgYSBudW1lcmljIHNp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XNlIDEyOlxuICAgICAgICAgICAgX3ZhbHVlID0gX2NvbnRleHQuc2VudDtcblxuICAgICAgICAgICAgaWYgKF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24pIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDIyO1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdmFsdWUgPSBfdmFsdWU7XG4gICAgICAgICAgICBidWZmZXIucHVzaCh2YWx1ZSk7XG5cbiAgICAgICAgICAgIGlmICghYnVmZmVyLmlzRnVsbCgpKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxOTtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxOTtcbiAgICAgICAgICAgIHJldHVybiBidWZmZXJSZWFkUHJveHk7XG5cbiAgICAgICAgICBjYXNlIDE5OlxuICAgICAgICAgICAgX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiA9IHRydWU7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gNjtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSAyMjpcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyODtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSAyNDpcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAyNDtcbiAgICAgICAgICAgIF9jb250ZXh0LnQwID0gX2NvbnRleHRbXCJjYXRjaFwiXSg0KTtcbiAgICAgICAgICAgIF9kaWRJdGVyYXRvckVycm9yID0gdHJ1ZTtcbiAgICAgICAgICAgIF9pdGVyYXRvckVycm9yID0gX2NvbnRleHQudDA7XG5cbiAgICAgICAgICBjYXNlIDI4OlxuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDI4O1xuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDI5O1xuXG4gICAgICAgICAgICBpZiAoISghX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiAmJiBfaXRlcmF0b3JbXCJyZXR1cm5cIl0gIT0gbnVsbCkpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDMzO1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDMzO1xuICAgICAgICAgICAgcmV0dXJuIF9hd2FpdEFzeW5jR2VuZXJhdG9yKF9pdGVyYXRvcltcInJldHVyblwiXSgpKTtcblxuICAgICAgICAgIGNhc2UgMzM6XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMzM7XG5cbiAgICAgICAgICAgIGlmICghX2RpZEl0ZXJhdG9yRXJyb3IpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDM2O1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdGhyb3cgX2l0ZXJhdG9yRXJyb3I7XG5cbiAgICAgICAgICBjYXNlIDM2OlxuICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0LmZpbmlzaCgzMyk7XG5cbiAgICAgICAgICBjYXNlIDM3OlxuICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0LmZpbmlzaCgyOCk7XG5cbiAgICAgICAgICBjYXNlIDM4OlxuICAgICAgICAgIGNhc2UgXCJlbmRcIjpcbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dC5zdG9wKCk7XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICB9LCBfY2FsbGVlLCBudWxsLCBbWzQsIDI0LCAyOCwgMzhdLCBbMjksLCAzMywgMzddXSk7XG4gIH0pKTtcbiAgcmV0dXJuIF9hc3luY1dpbmRvdy5hcHBseSh0aGlzLCBhcmd1bWVudHMpO1xufVxuXG52YXIgYXN5bmNXaW5kb3cgPSAvKiNfX1BVUkVfXy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mVyYXRvclJ1bnRpbWUud3JhcChmdW5jdGlvbiBfX3dpbmRvdyQoX2NvbnRleHQpIHtcbiAgICB3aGlsZSAoMSkge1xuICAgICAgc3dpdGNoIChfY29udGV4dC5wcmV2ID0gX2NvbnRleHQubmV4dCkge1xuICAgICAgICBjYXNlIDA6XG4gICAgICAgICAgYnVmZmVyID0gbmV3IENpcmN1bGFyQnVmZmVyKHNpemUpO1xuICAgICAgICAgIGJ1ZmZlclJlYWRQcm94eSA9IG5ldyBSZWFkT25seUNpcmN1bGFyQnVmZmVyKGJ1ZmZlcik7XG4gICAgICAgICAgX2l0ZXJhdG9yID0gX2NyZWF0ZUZvck9mSXRlcmF0b3JIZWxwZXIoc291cmNlKTtcbiAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMztcblxuICAgICAgICAgIF9pdGVyYXRvci5zKCk7XG5cbiAgICAgICAgY2FzZSA1OlxuICAgICAgICAgIGlmICgoX3N0ZXAgPSBfaXRlcmF0b3IubigpKS5kb25lKSB7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTM7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgICB9XG5cbiAgICAgICAgICB2YWx1ZSA9IF9zdGVwLnZhbHVlO1xuICAgICAgICAgIGJ1ZmZlci5wdXNoKHZhbHVlKTtcblxuICAgICAgICAgIGlmICghYnVmZmVyLmlzRnVsbCgpKSB7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTE7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgICB9XG5cbiAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTE7XG4gICAgICAgICAgcmV0dXJuIGJ1ZmZlclJlYWRQcm94eTtcblxuICAgICAgICBjYXNlIDExOlxuICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA1O1xuICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgIGNhc2UgMTM6XG4gICAgICAgICAgX2NvbnRleHQubmV4dCA9IDE4O1xuICAgICAgICAgI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AgaWYgKGRvbmUpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDE0O1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDk7XG4gICAgICAgICAgICByZXR1cm4gcGVla3JzLm1hcChmdW5jdGlvbiAoX3JlZjIpIHtcbiAgICAgICAgICAgICAgdmFyIHZhbHVlID0gX3JlZjIudmFsdWUsXG4gICAgICAgICAgICAgICAgICBkb25lID0gX3JlZjIuZG9uZTtcbiAgICAgICAgICAgICAgcmV0dXJuIGRvbmUgPyBmaWxsZXIgOiB2YWx1ZTtcbiAgICAgICAgICAgIH0pO1xuXG4gICAgICAgICAgY2FzZSA5OlxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDExO1xuICAgICAgICAgICAgcmV0dXJuIF9hd2FpdEFzeW5jR2VuZXJhdG9yKGFzeW5jUGFyYWxsZWxFYWNoKHBlZWtycywgZnVuY3Rpb24gKHBlZWtyKSB7XG4gICAgICAgICAgICAgIHJldHVybiBwZWVrci5hZHZhbmNlKCk7XG4gICAgICAgICAgICB9KSk7XG5cbiAgICAgICAgICBjYXNlIDExOlxuICAgICAgICAgICAgZG9uZSA9IF9fZXZlcnkocGVla3JzLCBpc0RvbmUpO1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDY7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgIGNhc2UgMTQ6XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMTQ7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTc7XG4gICAgICAgICAgICByZXR1cm4gX2F3YWl0QXN5bmNHZW5lcmF0b3IoYXN5bmNQYXJhbGxlbEVhY2gocGVla3JzLCBmdW5jdGlvbiAocGVla3IpIHtcbiAgICAgICAgICAgICAgcmV0dXJuIHBlZWtyW1wicmV0dXJuXCJdKCk7XG4gICAgICAgICAgICB9KSk7XG5cbiAgIC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WVrcnMsIGlzRG9uZSk7XG4gICAgICAgICAgX2NvbnRleHQucHJldiA9IDM7XG5cbiAgICAgICAgY2FzZSA0OlxuICAgICAgICAgIGlmIChkb25lKSB7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTE7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgICB9XG5cbiAgICAgICAgICBfY29udGV4dC5uZXh0ID0gNztcbiAgICAgICAgICByZXR1cm4gcGVla3JzLm1hcChmdW5jdGlvbiAoX3JlZjIpIHtcbiAgICAgICAgICAgIHZhciB2YWx1ZSA9IF9yZWYyLnZhbHVlLFxuICAgICAgICAgICAgICAgIGRvbmUgPSBfcmVmMi5kb25lO1xuICAgICAgICAgICAgcmV0dXJuIGRvbmUgPyBmaWxsZXIgOiB2YWx1ZTtcbiAgICAgICAgICB9KTtcblxuICAgICAgICBjYXNlIDc6XG4gICAgICAgICAgcGFyYWxsZWxFYWNoKHBlZWtycywgZnVuY3Rpb24gKHBlZWtyKSB7XG4gICAgICAgICAgICByZXR1cm4gcGVla3IuYWR2YW5jZSgpO1xuICAgICAgICAgIH0pO1xuICAgICAgICAgIGRvbmUgPSBfX2V2ZXJ5KHBlZWtycywgaXNEb25lKTtcbiAgICAgICAgICBfY29udGV4dC5uZXh0ID0gNDtcbiAgICAgICAgICBicmVhaztcblxuICAgICAgICBjYXNlIDExOlxuICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAxMTtcbiAgICAgICAgICBwYXJhbGxlbEVhY2gocGVla3JzLCBmdW5jdGlvbiAocGVla3IpIHtcbiAgICAgICAgICAgIHJldHVybiBwZWVrcltcInJldHVyblwiXSgpO1xuICAgICAgICAgIH0pO1xuICAgICAgICAgIHJldHVybiBfY29udGV4dC5maW5pc2goMTEpO1xuXG4gICAgICAgIGNhc2UgMTQ6XG4gICAgICAgIGNhc2UgXCJlbmRcIjpcbiAgICAgICAgICByZXR1cm4gX2NvbnRleHQuc3RvcCgpO1xuICAgICAgfVxuICAgIH1cb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4dC5uZXh0KSB7XG4gICAgICAgICAgY2FzZSAwOlxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDI7XG4gICAgICAgICAgICByZXR1cm4gX2F3YWl0QXN5bmNHZW5lcmF0b3IoX19hc3luY1RvQXJyYXkoX19hc3luY01hcChzb3VyY2VzLCBfX2FzeW5jUGVla2VyYXRlKSkpO1xuXG4gICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgcGVla3JzID0gX2NvbnRleHQuc2VudDtcbiAgICAgICAgICAgIGRvbmUgPSBfX3NvbWUocGVla3JzLCBpc0RvbmUpO1xuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDQ7XG5cbiAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICBpZiAoZG9uZSkge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTM7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gODtcbiAgICAgICAgICAgIHJldHVybiBwZWVrcnMubWFwKGZ1bmN0aW9uIChfcmVmKSB7XG4gICAgICAgICAgICAgIHZhciB2YWx1ZSA9IF9yZWYudmFsdWU7XG4gICAgICAgICAgICAgIHJldHVybiB2YWx1ZTtcbiAgICAgICAgICAgIH0pO1xuXG4gICAgICAgICAgY2FzZSA4OlxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDEwO1xuICAgICAgICAgICAgcmV0dXJuIF9hd2FpdEFzeW5jR2VuZXJhdG9yKFByb21pc2UuYWxsKF9fbWFwKHBlZWtycywgZnVuY3Rpb24gKHBlZWtyKSB7XG4gICAgICAgICAgICAgIHJldHVybiBwZWVrci5hZHZhbmNlKCk7XG4gICAgICAgICAgICB9KSkpO1xuXG4gICAgICAgICAgY2FzZSAxMDpcbiAgICAgICAgICAgIGRvbmUgPSBfX3NvbWUocGVla3JzLCBpc0RvbmUpO1xuICAgICAgICAgICAgX2NvbnRleHQubmV4d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ID0gX190b0FycmF5KF9fbWFwKHNvdXJjZXMsIF9fcGVla2VyYXRlKSk7XG4gICAgICAgICAgZG9uZSA9IF9fc29tZShwZWVrcnMsIGlzRG9uZSk7XG4gICAgICAgICAgX2NvbnRleHQucHJldiA9IDI7XG5cbiAgICAgICAgY2FzZSAzOlxuICAgICAgICAgIGlmIChkb25lKSB7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTE7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgICB9XG5cbiAgICAgICAgICBfY29udGV4dC5uZXh0ID0gNjtcbiAgICAgICAgICByZXR1cm4gcGVla3JzLm1hcChmdW5jdGlvbiAoX3JlZikge1xuICAgICAgICAgICAgdmFyIHZhbHVlID0gX3JlZi52YWx1ZTtcbiAgICAgICAgICAgIHJldHVybiB2YWx1ZTtcbiAgICAgICAgICB9KTtcblxuICAgICAgICBjYXNlIDY6XG4gICAgICAgICAgX2l0ZXJhdG9yID0gX2NyZWF0ZUZvck9mSXRlcmF0b3JIZWxwZXIocGVla3JzKTtcblxuICAgICAgICAgIHRyeSB7XG4gICAgICAgICAgICBmb3IgKF9pdGVyYXRvci5zKCk7ICEoX3N0ZXAgPSBfaXRlcmF0b3IubigpKS5kb25lOykge1xuICAgICAgICAgICAgICBwZWVrciA9IF9zdGVwLnZhbHVlO1xuICAgICAgICAgICAgICBwZWVrci5hZHZhbmNlKCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfSBjYXRjaCAoZXJyKSB7XG4gICAgICAgICAgICBfaXRlcmF0b3IuZShlcnIpO1xuICAgICAgICAgIH0gZmluYWxseSB7XG4gICAgICAgICAgICBfaXRlcmF0b3IuZigpO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIGRvbmUgPSBfX3NvbWUocGVla3JzLCBpc0RvbmUpO1xuICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAzO1xuICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgIGNhc2UgMTE6XG4gICAgICAgICAg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GNhc2UgMzpcbiAgICAgICAgICAgICAgICByZXR1cm4gX2NvbnRleHQyLmFicnVwdChcInJldHVyblwiLCBfY29udGV4dDIuc2VudCk7XG5cbiAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICBjYXNlIFwiZW5kXCI6XG4gICAgICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0Mi5zdG9wKCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuICAgICAgICB9LCBfY2FsbGVlMiwgdGhpcyk7XG4gICAgICB9KSk7XG5cbiAgICAgIGZ1bmN0aW9uIG5leHQoKSB7XG4gICAgICAgIHJldHVybiBfbmV4dC5hcHBseSh0aGlzLCBhcmd1bWVudHMpO1xuICAgICAgfVxuXG4gICAgICByZXR1cm4gbmV4dDtcbiAgICB9KClcbiAgfSwge1xuICAgIGtleTogXCJyZXR1cm5cIixcbiAgICB2YWx1ZTogZnVuY3Rpb24gKCkge1xuICAgICAgdmFyIF9yZXR1cm4yID0gX2FzeW5jVG9HZW5lcmF0b3IoIC8qI19fUFVSRV9fKi9fcmVnZW5lcmF0b3JSdW50aW1lLm1hcmsoZnVuY3Rpb24gX2NhbGxlZTMoKSB7XG4gICAgICAgIHJldHVybiBfcmVnZW5lcmF0b3JSdW50aW1lLndyYXAoZnVuY3Rpb24gX2NhbGxlZTMkKF9jb250ZXh0Mykge1xuICAgICAgICAgIHdoaWxlICgxKSB7XG4gICAgICAgICAgICBzd2l0Y2ggKF9jb250ZXh0My5wcmV2ID0gX2NvbnRleHQzLm5leHQpIHtcbiAgICAgICAgICAgICAgY2FzZSAwOlxuICAgICAgICAgICAgICAgIF9jb250ZXh0My5uZXh0ID0gMjtcbiAgICAgICAgICAgICAgICByZXR1cm4gYXN5bmNDYWxsUmV0dXJuKHRoaXMuaXRlcmF0b3IpO1xuXG4gICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICByZXR1cm4gX2NvbnRleHQzLmFicnVwdChcInJldHVyblwi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cmVnZW5lcmF0b3JSdW50aW1lLm1hcmsoZnVuY3Rpb24gX2NhbGxlZShzb3VyY2VzKSB7XG4gICAgdmFyIGl0ZXJhdG9ycywgc3RlcFByb21pc2VzLCByZWFkeSwgX2xvb3A7XG5cbiAgICByZXR1cm4gX3JlZ2VuZXJhdG9yUnVudGltZS53cmFwKGZ1bmN0aW9uIF9jYWxsZWUkKF9jb250ZXh0Mikge1xuICAgICAgd2hpbGUgKDEpIHtcbiAgICAgICAgc3dpdGNoIChfY29udGV4dDIucHJldiA9IF9jb250ZXh0Mi5uZXh0KSB7XG4gICAgICAgICAgY2FzZSAwOlxuICAgICAgICAgICAgaXRlcmF0b3JzID0gc291cmNlcy5tYXAoZnVuY3Rpb24gKGl0ZXJhYmxlKSB7XG4gICAgICAgICAgICAgIHJldHVybiBpdGVyYWJsZVtTeW1ib2wuYXN5bmNJdGVyYXRvcl0oKTtcbiAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgc3RlcFByb21pc2VzID0gaXRlcmF0b3JzLm1hcChmdW5jdGlvbiAoaXRlciwgaWR4KSB7XG4gICAgICAgICAgICAgIHJldHVybiBpdGVyLm5leHQoKS50aGVuKGZ1bmN0aW9uIChzdGVwKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgICAgICAgIGlkeDogaWR4LFxuICAgICAgICAgICAgICAgICAgc3RlcDogc3RlcFxuICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICBfbG9vcCA9IC8qI19fUFVSRV9fKi9fcmVnZW5lcmF0b3JSdW50aW1lLm1hcmsoZnVuY3Rpb24gX2xvb3AoKSB7XG4gICAgICAgICAgICAgIHZhciBfcmVhZHksIGlkeCwgc3RlcDtcblxuICAgICAgICAgICAgICByZXR1cm4gX3JlZ2VuZXJhdG9yUnVudGltZS53cmFwKGZ1bmN0aW9uIF9sb29wJChfY29udGV4dCkge1xuICAgICAgICAgICAgICAgIHdoaWxlICgxKSB7XG4gICAgICAgICAgICAgICAgICBzd2l0Y2ggKF9jb250ZXh0LnByZXYgPSBfY29udGV4dC5uZXh0KSB7XG4gICAgICAgICAgICAgICAgICAgIGNhc2UgMDpcbiAgICAgICAgICAgICAgICAgICAgICBfcmVhZHkgPSByZWFkeSwgaWR4ID0gX3JlYWR5LmlkeCwgc3RlcCA9IF9yZWFkeS5zdGVwO1xuICAgICAgICAgICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAzO1xuICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBzdGVwLnZhbHVlO1xuXG4gICAgICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgICBzdGVwUHJvbWlzZXNbaWR4XSA9IGl0ZXJhdG9yc1tpZHhdLm5leHQoKS50aGVuKGZ1bmN0aW9uIChzdGVwKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgICAgICAgICAgICAgICBpZHg6IGlkeCxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgc3RlcDogc3RlcFxuICAgICAgICAgICAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgICAgICAgICAgICB9KTtcblxuICAgICAgICAgICAgICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgICAgICAgICAgIGNhc2UgXCJlbmRcIjpcbiAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuc3RvcCgpO1xuICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgfSwgX2xvb3ApO1xuICAgICAgICAgICAgfSk7XG5cbiAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICBfY29udGV4dDIubmV4dCA9IDU7XG4gICAgICAgICAgICByZXR1cm4gX2F3YWl0QXN5bmNHZW5lcmF0b3IocmFjZVRvKGZ1bmN0aW9uIChfcmVmKSB7XG4gICAgICAgICAgICAgIHZhciBzdGVwID0gX3JlZi5zdGVwO1xuICAgICAgICAgICAgICByZXR1cm4gIXN0ZXAuZG9uZTtcbiAgICAgICAgICAgIH0sIG51bGwsIHN0ZXBQcm9taXNlcykpO1xuXG4gICAgICAgICAgY2FzZSA1OlxuICAgICAgICAgICAgX2NvbnRleHQyLnQwID0gcmVhZHkgPSBfY29udGV4dDIuc2VudDtcblxuICAgICAgICAgICAgaWYgKCEoX2NvbnRleHQyLnQwICE9PSBudWxsKSkge1xuICAgICAgICAgICAgICBfY29udGV4dDIubmV4dCA9IDEwO1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0Mi5kZWxlZ2F0ZVlpZWxkKF9sb29wKCksIFwidDFcIiwgOCk7XG5cbiAgICAgICAgICBjYXNlIDg6XG4gICAgICAgICAgICBfY29udGV4dDIubmV4dCA9IDM7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgIGNhc2UgMTA6XG4gICAgICAgICAgY2FzZSBcImVuZFwiOlxuICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0Mi5zdG9wKCk7XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICB9LCBfY2FsbGVlKTtcbiAgfSkpO1xuICByZXR1cm4gX2FzeW5jSW50ZXJsZWF2ZVJlYWR5LmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7XG59XG5cbnZhciBhc3luY0ludGVybGVhdmVSZWFkeSA9IC8qI19fUFVSRV9fKi9hc3luY0l0ZXJhYmxlQ3VycnkoX19hc3luY0ludGVybGVhdmVSZWFkeSwge1xuICB2YXJpYWRpYzogdHJ1ZVxufSk7XG5leHBvcnRzLmFzeW5jSW50ZXJsZWF2ZVJlYWR5ID0gYXN5bmNJbnRlcmxlYXZlUmVhZHk7IiwiZnVuY3Rpb24gX2NyZWF0ZUZvck9mSXRlcmF0b3JIZWxwZXIobywgYWxsb3dBcnJheUxpa2UpIHsgdmFyIGl0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4dCA9IDc7XG4gICAgICAgICAgICByZXR1cm4gX2F3YWl0QXN5bmNHZW5lcmF0b3IoX2l0ZXJhdG9yLm5leHQoKSk7XG5cbiAgICAgICAgICBjYXNlIDc6XG4gICAgICAgICAgICBfc3RlcCA9IF9jb250ZXh0LnNlbnQ7XG4gICAgICAgICAgICBfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uID0gX3N0ZXAuZG9uZTtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxMTtcbiAgICAgICAgICAgIHJldHVybiBfYXdhaXRBc3luY0dlbmVyYXRvcihfc3RlcC52YWx1ZSk7XG5cbiAgICAgICAgICBjYXNlIDExOlxuICAgICAgICAgICAgX3ZhbHVlID0gX2NvbnRleHQuc2VudDtcblxuICAgICAgICAgICAgaWYgKF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24pIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDIzO1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdmFsdWUgPSBfdmFsdWU7XG4gICAgICAgICAgICBkdXJhdGlvbiA9IGludGVydmFsTXMgLSAoRGF0ZS5ub3coKSAtIHdhaXRTaW5jZSk7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTc7XG4gICAgICAgICAgICByZXR1cm4gX2F3YWl0QXN5bmNHZW5lcmF0b3IoZHVyYXRpb24gPiAwICYmIGRlbGF5KGR1cmF0aW9uKSk7XG5cbiAgICAgICAgICBjYXNlIDE3OlxuICAgICAgICAgICAgd2FpdFNpbmNlID0gRGF0ZS5ub3coKTtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyMDtcbiAgICAgICAgICAgIHJldHVybiB2YWx1ZTtcblxuICAgICAgICAgIGNhc2UgMjA6XG4gICAgICAgICAgICBfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uID0gdHJ1ZTtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA1O1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICBjYXNlIDIzOlxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDI5O1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICBjYXNlIDI1OlxuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDI1O1xuICAgICAgICAgICAgX2NvbnRleHQudDAgPSBfY29udGV4dFtcImNhdGNoXCJdKDMpO1xuICAgICAgICAgICAgX2RpZEl0ZXJhdG9yRXJyb3IgPSB0cnVlO1xuICAgICAgICAgICAgX2l0ZXJhdG9yRXJyb3IgPSBfY29udGV4dC50MDtcblxuICAgICAgICAgIGNhc2UgMjk6XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMjk7XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMzA7XG5cbiAgICAgICAgICAgIGlmICghKCFfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uICYmIF9pdGVyYXRvcltcInJldHVyblwiXSAhPSBudWxsKSkge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMzQ7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMzQ7XG4gICAgICAgICAgICByZXR1cm4gX2F3YWl0QXN5bmNHZW5lcmF0b3IoX2l0ZXJhdG9yW1wicmV0dXJuXCJdKCkpO1xuXG4gICAgICAgICAgY2FzZSAzNDpcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAzNDtcblxuICAgICAgICAgICAgaWYgKCFfZGlkSXRlcmF0b3JFcnJvcikge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMzc7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB0aHJvdyBfaXRlcmF0b3JFcnJvcjtcblxuICAgICAgICAgIGNhc2UgMzc6XG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l0ZXJhdG9yID0gX3JlcXVpcmUud3JhcFdpdGhJdGVyYWJsZUl0ZXJhdG9yO1xuXG52YXIgaGFzT3duUHJvcGVydHkgPSBPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5O1xuXG5mdW5jdGlvbiBfX29iamVjdEVudHJpZXMob2JqKSB7XG4gIHZhciBrZXk7XG4gIHJldHVybiBfcmVnZW5lcmF0b3JSdW50aW1lLndyYXAoZnVuY3Rpb24gX19vYmplY3RFbnRyaWVzJChfY29udGV4dCkge1xuICAgIHdoaWxlICgxKSB7XG4gICAgICBzd2l0Y2ggKF9jb250ZXh0LnByZXYgPSBfY29udGV4dC5uZXh0KSB7XG4gICAgICAgIGNhc2UgMDpcbiAgICAgICAgICBpZiAoIShvYmogPT0gbnVsbCkpIHtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyO1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgcmV0dXJuIF9jb250ZXh0LmFicnVwdChcInJldHVyblwiKTtcblxuICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgX2NvbnRleHQudDAgPSBfcmVnZW5lcmF0b3JSdW50aW1lLmtleXMob2JqKTtcblxuICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgaWYgKChfY29udGV4dC50MSA9IF9jb250ZXh0LnQwKCkpLmRvbmUpIHtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxMDtcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIGtleSA9IF9jb250ZXh0LnQxLnZhbHVlO1xuXG4gICAgICAgICAgaWYgKCFoYXNPd25Qcm9wZXJ0eS5jYWxsKG9iaiwga2V5KSkge1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDg7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgICB9XG5cbiAgICAgICAgICBfY29udGV4dC5uZXh0ID0gODtcbiAgICAgICAgICByZX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JlZ2VuZXJhdG9yUnVudGltZS5rZXlzKG9iaik7XG5cbiAgICAgICAgY2FzZSAzOlxuICAgICAgICAgIGlmICgoX2NvbnRleHQudDEgPSBfY29udGV4dC50MCgpKS5kb25lKSB7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTA7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgICB9XG5cbiAgICAgICAgICBrZXkgPSBfY29udGV4dC50MS52YWx1ZTtcblxuICAgICAgICAgIGlmICghaGFzT3duUHJvcGVydHkuY2FsbChvYmosIGtleSkpIHtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA4O1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgX2NvbnRleHQubmV4dCA9IDg7XG4gICAgICAgICAgcmV0dXJuIGtleTtcblxuICAgICAgICBjYXNlIDg6XG4gICAgICAgICAgX2NvbnRleHQubmV4dCA9IDM7XG4gICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgY2FzZSAxMDpcbiAgICAgICAgY2FzZSBcImVuZFwiOlxuICAgICAgICAgIHJldHVybiBfY29udGV4dC5zdG9wKCk7XG4gICAgICB9XG4gICAgfVxuICB9LCBfbWFya2VkKTtcbn1cblxuZXhwb3J0cy5fX29iamVjdEtleXMgPSBfX29iamVjdEtleXM7XG52YXIgb2JqZWN0S2V5cyA9IC8qI19fUFVSRV9fKi93cmFwV2l0aEl0ZXJhYmxlSXRlcmF0b3IoX19vYmplY3RLZXlzLCB7XG4gIHZhbGlkYXRlQXJnczogZnVuY3Rpb24gdmFsaWRhdGVBcmdzKGFyZ3MpIHtcbiAgICBpZiAoIShhcmdzWzBdID09IG51bGwgfHwgX3R5cGVvZihhcmdzWzBdKSA9PT0gJ29iamVjdCcpKSB7XG4gICAgICB0aHJvdyBuZXcgRXJyb3IoJ29iaiBhcmd1bWVudCB0byBvYmplY3RLZXlzIG11c3QgYmUgYW4gb2JqZWN0LCBudWxsLCBvciB1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gX3JlZ2VuZXJhdG9yUnVudGltZS5rZXlzKG9iaik7XG5cbiAgICAgICAgY2FzZSAzOlxuICAgICAgICAgIGlmICgoX2NvbnRleHQudDEgPSBfY29udGV4dC50MCgpKS5kb25lKSB7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTA7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgICB9XG5cbiAgICAgICAgICBrZXkgPSBfY29udGV4dC50MS52YWx1ZTtcblxuICAgICAgICAgIGlmICghaGFzT3duUHJvcGVydHkuY2FsbChvYmosIGtleSkpIHtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA4O1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgX2NvbnRleHQubmV4dCA9IDg7XG4gICAgICAgICAgcmV0dXJuIG9ialtrZXldO1xuXG4gICAgICAgIGNhc2UgODpcbiAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMztcbiAgICAgICAgICBicmVhaztcblxuICAgICAgICBjYXNlIDEwOlxuICAgICAgICBjYXNlIFwiZW5kXCI6XG4gICAgICAgICAgcmV0dXJuIF9jb250ZXh0LnN0b3AoKTtcbiAgICAgIH1cbiAgICB9XG4gIH0sIF9tYXJrZWQpO1xufVxuXG5leHBvcnRzLl9fb2JqZWN0VmFsdWVzID0gX19vYmplY3RWYWx1ZXM7XG52YXIgb2JqZWN0VmFsdWVzID0gLyojX19QVVJFX18qL3dyYXBXaXRoSXRlcmFibGVJdGVyYXRvcihfX29iamVjdFZhbHVlcywge1xuICB2YWxpZGF0ZUFyZ3M6IGZ1bmN0aW9uIHZhbGlkYXRlQXJncyhhcmdzKSB7XG4gICAgaWYgKCEoYXJnc1swXSA9PSBudWxsIHx8IF90eXBlb2YoYXJnc1swXSkgPT09ICdvYmplY3QnKSkge1xuICAgICAgdGhyb3cgbmV3IEVycm9yKCdvYmogYXJndW1lbnQgdG8gb2JqZWN0VmFsdWVzIG11c3QgYmUgYW4gb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yIF9zZXR1cEZpcnN0ID0gX2FzeW5jVG9HZW5lcmF0b3IoIC8qI19fUFVSRV9fKi9fcmVnZW5lcmF0b3JSdW50aW1lLm1hcmsoZnVuY3Rpb24gX2NhbGxlZSgpIHtcbiAgICAgICAgdmFyIHNvdXJjZSwgc3RyYXRlZ3ksIG9wdGlvbnMsIHN0ZXA7XG4gICAgICAgIHJldHVybiBfcmVnZW5lcmF0b3JSdW50aW1lLndyYXAoZnVuY3Rpb24gX2NhbGxlZSQoX2NvbnRleHQpIHtcbiAgICAgICAgICB3aGlsZSAoMSkge1xuICAgICAgICAgICAgc3dpdGNoIChfY29udGV4dC5wcmV2ID0gX2NvbnRleHQubmV4dCkge1xuICAgICAgICAgICAgICBjYXNlIDA6XG4gICAgICAgICAgICAgICAgc291cmNlID0gdGhpcy5zb3VyY2UsIHN0cmF0ZWd5ID0gdGhpcy5zdHJhdGVneSwgb3B0aW9ucyA9IHRoaXMub3B0aW9ucztcbiAgICAgICAgICAgICAgICB0aGlzLnBhcnRzSXRlcmF0b3IgPSB0aGlzLnBhcnRzSXRlcmF0b3IgfHwgbmV3IEFzeW5jUGFydHNJdGVyYXRvcihzb3VyY2UsIHN0cmF0ZWd5LCBvcHRpb25zKTtcblxuICAgICAgICAgICAgICAgIGlmICh0aGlzLmZpcnN0UGFydCkge1xuICAgICAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDc7XG4gICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gNTtcbiAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5wYXJ0c0l0ZXJhdG9yLm5leHQoKTtcblxuICAgICAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICAgICAgc3RlcCA9IF9jb250ZXh0LnNlbnQ7XG4gICAgICAgICAgICAgICAgdGhpcy5maXJzdFBhcnQgPSBzdGVwLmRvbmUgPyBbXSA6IHN0ZXAudmFsdWU7XG5cbiAgICAgICAgICAgICAgY2FzZSA3OlxuICAgICAgICAgICAgICBjYXNlIFwiZW5kXCI6XG4gICAgICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0LnN0b3AoKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgIH0sIF9jYWxsZWUsIHRoaXMpO1xuICAgICAgfSkpO1xuXG4gICAgICBmdW5jdGlvbiBzZXR1cEZpcnN0KCkge1xuICAgICAgICByZXR1cm4gX3NldHVwRmlyc3QuYXBwbHkodGhpcywgYXJndW1lbnRzKTtcbiAgICAgIH1cblxuICAgICAgcmV0dXJuIHNldHVwRmlyc3Q7XG4gICAgfSgpXG4gIH0sIHtcbiAgICBrZXk6IFwibmV4dFwiLFxuICAgIHZhbHVlOiBmdW5jdGlvbiBuZXh0KCkge1xuICAgICAgdmFyIHNlbGYgPSB0aGlzO1xuXG4gICAgICBzd2l0Y2ggKHRoaXMuY3VycmVudElkeCsrKSB7XG4gICAgICAgIGNhc2UgMDpcbiAgICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgdmFsdWU6IF93cmFwQXN5bmNHZW5lcmF0b3IoIC8qI19fUFVSRV9fKi9fcmVnZW5lcmF0b3JSdW50aW1lLm1hcmsoZnVuY3Rpb24gX2NhbGxlZTIoKSB7XG4gICAgICAgICAgICAgIHJldHVybiBfcmVnZW5lcmF0b3JSdW50aW1lLndyYXAoZnVuY3Rpb24gX2NhbGxlZTIkKF9jb250ZXh0Mikge1xuICAgICAgICAgICAgICAgIHdoaWxlICgxKSB7XG4gICAgICAgICAgICAgICAgICBzd2l0Y2ggKF9jb250ZXh0Mi5wcmV2ID0gX2NvbnRleHQyLm5leHQpIHtcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAwOlxuICAgICAgICAgICAgICAgICAgICAgIF9jb250ZXh0Mi5uZXh0ID0gMjtcbiAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gX2F3YWl0QXN5bmNHZW5lcmF0b3Ioc2VsZi5zZXR1cEZpcnN0KCkpO1xuXG4gICAgICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gX2NvbnRleHQyLmRlbGVnYXRlWWllbGQoX2FzeW5jR2VuZXJhdG9yRGVsZWdhdGUoX2FzeW5jSXRlcmF0b3Ioc2VsZi5maXJzdFBhcnQpLCBfYXdhaXRBc3luY0dlbmVyYXRvciksIFwidDBcIiwgMyk7XG5cbiAgICAgICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBjYXNlIFwiZW5kXCI6XG4gICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0Mi5zdG9wKCk7XG4gICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICB9LCBfY2FsbGVlMik7XG4gICAgICAgICAgICB9KSkoKSxcbiAgICAgICAgICAgIGRvbmU6IGZhbHNlXG4gICAgICAgICAgfTtcblxuICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgIHZhbHVlOiBfd3JhcEFzeW5jR2VuZXJhdG9yKCAvKiNfX1BVUkVfXyovX3JlZ2VuZXJhdG9yUnVudGltZS5tYXJrKGZ1bmN0aW9uIF9jYWxsZWUzKCkge1xuICAgICAgICAgICAgICB2YXIgc3RlcDtcbiAgICAgICAgICAgICAgcmV0dXJuIF9yZWdlbmVyYXRvclJ1bnRpbWUud3JhcChmdW5jdGlvbiBfY2FsbGVlMyQoX2NvbnRleHQzKSB7XG4gICAgICAgICAgICAgICAgd2hpbGUgKDEpIHtcbiAgICAgICAgICAgICAgICAgIHN3aXRjaCAoX2NvbnRleHQzLnByZXYgPSBfY29udGV4dDMubmV4dCkge1xuICAgICAgICAgICAgICAgICAgICBjYXNlIDA6XG4gICAgICAgICAgICAgICAgICAgICAgX2NvbnRleHQzLm5leHQgPSAyO1xuICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBfYXdhaXRBc3luY0dlbmVyYXRvcihzZWxmLnNldHVwRmlyc3QoKSk7XG5cbiAgICAgICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICAgIF9jb250ZXh0My5uZXh0ID0gNDtcbiAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gX2F3YWl0QXN5bmNHZW5lcmF0b3Ioc2VsZi5wYXJ0c0l0ZXJhdG9yLm5leHQoKSk7XG5cbiAgICAgICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICAgIHN0ZXAgPSBfY29udGV4dDMuc2VudDtcbiAgICAgICAgICAgICAgICAgICAgICBzZWxmLnNlY29uZFBhcnQgPSBzdGVwLmRvbmUgPyBbXSA6IHN0ZXAudmFsdWU7XG4gICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0My5kZWxlZ2F0ZVlpZWxkKF9hc3luY0dlbmVyYXRvckRlbGVnYXRlKF9hc3luY0l0ZXJhdG9yKHNlbGYuc2Vjb25kUGFydCksIF9hd2FpdEFzeW5jR2VuZXJhdG9yKSwgXCJ0MFwiLCA3KTtcblxuICAgICAgICAgICAgICAgICAgICBjYXNlIDc6XG4gICAgICAgICAgICAgICAgICAgIGNhc2UgXCJlbmRcIjpcbiAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gX2NvbnRleHQzLnN0b3AoKTtcbiAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIH0sIF9jYWxsZWUzKTtcbiAgICAgICAgICAgIH0pKSgpLFxuICAgICAgICAgICAgZG9uZTogZmFsc2VcbiAgICAgICAgICB9O1xuXG4gICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgIHZhbHVlOiB1bmRlZmluZWQsXG4gICAgICAgICAgICBkb25lOiB0cnVlXG4gICAgICAgICAgfTtcbiAgICAgIH1cbiAg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X3RoaXM7XG4gIH1cblxuICBfY3JlYXRlQ2xhc3MoQXN5bmNGb3JrLCBbe1xuICAgIGtleTogXCJuZXh0XCIsXG4gICAgdmFsdWU6IGZ1bmN0aW9uICgpIHtcbiAgICAgIHZhciBfbmV4dCA9IF9hc3luY1RvR2VuZXJhdG9yKCAvKiNfX1BVUkVfXyovX3JlZ2VuZXJhdG9yUnVudGltZS5tYXJrKGZ1bmN0aW9uIF9jYWxsZWUoKSB7XG4gICAgICAgIHZhciBkb25lLCBleGNoYW5nZSwgaGVhZCwgX2hlYWQsIHN0ZXA7XG5cbiAgICAgICAgcmV0dXJuIF9yZWdlbmVyYXRvclJ1bnRpbWUud3JhcChmdW5jdGlvbiBfY2FsbGVlJChfY29udGV4dCkge1xuICAgICAgICAgIHdoaWxlICgxKSB7XG4gICAgICAgICAgICBzd2l0Y2ggKF9jb250ZXh0LnByZXYgPSBfY29udGV4dC5uZXh0KSB7XG4gICAgICAgICAgICAgIGNhc2UgMDpcbiAgICAgICAgICAgICAgICBkb25lID0gdGhpcy5kb25lLCBleGNoYW5nZSA9IHRoaXMuZXhjaGFuZ2U7XG5cbiAgICAgICAgICAgICAgICBpZiAoIWRvbmUpIHtcbiAgICAgICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA1O1xuICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0LmFicnVwdChcInJldHVyblwiLCB7XG4gICAgICAgICAgICAgICAgICB2YWx1ZTogdW5kZWZpbmVkLFxuICAgICAgICAgICAgICAgICAgZG9uZTogZG9uZVxuICAgICAgICAgICAgICAgIH0pO1xuXG4gICAgICAgICAgICAgIGNhc2UgNTpcbiAgICAgICAgICAgICAgICBoZWFkID0gdGhpcy5oZWFkO1xuXG4gICAgICAgICAgICAgICAgaWYgKGhlYWQubmV4dCkge1xuICAgICAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDk7XG4gICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gOTtcbiAgICAgICAgICAgICAgICByZXR1cm4gZXhjaGFuZ2UuZmV0Y2goKTtcblxuICAgICAgICAgICAgICBjYXNlIDk6XG4gICAgICAgICAgICAgICAgaGVhZCA9IGhlYWQubmV4dDtcbiAgICAgICAgICAgICAgICBfaGVhZCA9IGhlYWQsIHN0ZXAgPSBfaGVhZC5zdGVwO1xuICAgICAgICAgICAgICAgIHRoaXMuZG9uZSA9IHN0ZXAuZG9uZTtcbiAgICAgICAgICAgICAgICB0aGlzLmhlYWQgPSBoZWFkO1xuICAgICAgICAgICAgICAgIHJldHVybiBfY29udGV4dC5hYnJ1cHQoXCJyZXR1cm5cIiwgc3RlcCk7XG5cbiAgICAgICAgICAgICAgY2FzZSAxNDpcbiAgICAgICAgICAgICAgY2FzZSBcImVuZFwiOlxuICAgICAgICAgICAgICAgIHJldHVybiBfY29udGV4dC5zdG9wKCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuICAgICAgICB9LCBfY2FsbGVlLCB0aGlzKTtcbiAgICAgIH0pKTtcblxuICAgICAgZnVuY3Rpb24gbmV4dCgpIHtcbiAgICAgICAgcmV0dXJuIF9uZXh0LmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7XG4gICAgICB9XG5cbiAgICAgIHJldHVybiBuZXh0O1xuICAgIH0oKVxuICB9LCB7XG4gICAga2V5OiBcInJldHVyblwiLFxuICAgIHZhbHVlOiBmdW5jdGlvbiAoKSB7XG4gICAgICB2YXIgX3JldHVybjIgPSBfYXN5bmNUb0dlbmVyYXRvciggLyojX19QVVJFX18qL19yZWdlbmVyYXRvclJ1bnRpbWUubWFyayhmdW5jdGlvbiBfY2FsbGVlMigpIHtcbiAgICAgICAgdmFyIGRvbmUsIGV4Y2hhbmdlO1xuICAgICAgICByZXR1cm4gX3JlZ2VuZXJhdG9yUnVudGltZS53cmFwKGZ1bmN0aW9uIF9jYWxsZWUyJChfY29udGV4dDIpIHtcbiAgICAgICAgICB3aGlsZSAoMSkge1xuICAgICAgICAgICAgc3dpdGNoIChfY29udGV4dDIucHJldiA9IF9jb250ZXh0Mi5uZXh0KSB7XG4gICAgICAgICAgICAgIGNhc2UgMDpcbiAgICAgICAgICAgICAgICBkb25lID0gdGhpcy5kb25lLCBleGNoYW5nZSA9IHRoaXMuZXhjaGFuZ2U7XG5cbiAgICAgICAgICAgICAgICBpZiAoZG9uZSkge1xuICAgICAgICAgICAgICAgICAgX2NvbnRleHQyLm5leHQgPSA0O1xuICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgX2NvbnRleHQyLm5leHQgPSA0O1xuICAgICAgICAgICAgICAgIHJldHVybiBleGNoYW5nZVtcInJldHVyblwiXSgpO1xuXG4gICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgY2FzZSBcImVuZFwiOlxuICAgICAgICAgICAgICAgIHJldHVybiBfY29udGV4dDIuc3RvcCgpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cbiAgICAgICAgfSwgX2NhbGxlZTIsIHRoaXMpO1xuICAgICAgfSkpO1xuXG4gICAgICBmdW5jdGlvbiBfcmV0dXJuKCkge1xuICAgICAgICByZXR1cm4gX3JldHVybjIuYXBwbHkodGhpcywgYXJndW1lbnRzKTtcbiAgICAgIH1cblxuICAgICAgcmV0dXJuIF9yZXR1cm47XG4gICAgfSgpXG4gIH1dKTtcblxuICByZXR1cm4gQXN5bmNGb3JrO1xufShBc3luY0l0ZXJhYmxlSXRlcmF0b3IpO1xuXG52YXIgQXN5bmNFeGNoYW5nZSA9IC8qI19fUFVSRV9fKi9mdW5jdGlvbiAoKSB7XG4gIGZ1bmN0aW9uIEFzeW5jRXhjaGFuZ2UoaXRlcmF0b3IpIHtcbiAgICBfY2xhc3NDYWxs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ICByZXR1cm4gdGhpcy5pdGVyYXRvci5uZXh0KCk7XG5cbiAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgIHN0ZXAgPSBfY29udGV4dDMuc2VudDtcbiAgICAgICAgICAgICAgICBuZXdJdGVtID0gbmV3IFF1ZXVlSXRlbShzdGVwKTtcbiAgICAgICAgICAgICAgICB0aGlzLmhlYWQubmV4dCA9IHRoaXMuaGVhZCA9IG5ld0l0ZW07XG5cbiAgICAgICAgICAgICAgY2FzZSA1OlxuICAgICAgICAgICAgICBjYXNlIFwiZW5kXCI6XG4gICAgICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0My5zdG9wKCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuICAgICAgICB9LCBfY2FsbGVlMywgdGhpcyk7XG4gICAgICB9KSk7XG5cbiAgICAgIGZ1bmN0aW9uIGZldGNoKCkge1xuICAgICAgICByZXR1cm4gX2ZldGNoLmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7XG4gICAgICB9XG5cbiAgICAgIHJldHVybiBmZXRjaDtcbiAgICB9KClcbiAgfSwge1xuICAgIGtleTogXCJyZXR1cm5cIixcbiAgICB2YWx1ZTogZnVuY3Rpb24gKCkge1xuICAgICAgdmFyIF9yZXR1cm4zID0gX2FzeW5jVG9HZW5lcmF0b3IoIC8qI19fUFVSRV9fKi9fcmVnZW5lcmF0b3JSdW50aW1lLm1hcmsoZnVuY3Rpb24gX2NhbGxlZTQoKSB7XG4gICAgICAgIHJldHVybiBfcmVnZW5lcmF0b3JSdW50aW1lLndyYXAoZnVuY3Rpb24gX2NhbGxlZTQkKF9jb250ZXh0NCkge1xuICAgICAgICAgIHdoaWxlICgxKSB7XG4gICAgICAgICAgICBzd2l0Y2ggKF9jb250ZXh0NC5wcmV2ID0gX2NvbnRleHQ0Lm5leHQpIHtcbiAgICAgICAgICAgICAgY2FzZSAwOlxuICAgICAgICAgICAgICAgIC0tdGhpcy5mb3JrcztcblxuICAg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IGFyZ3VtZW50cyk7XG4gIH1cblxuICBfY3JlYXRlQ2xhc3MoQXN5bmNHcm91cHNJdGVyYXRvciwgW3tcbiAgICBrZXk6IFwibmV4dFwiLFxuICAgIHZhbHVlOiBmdW5jdGlvbiAoKSB7XG4gICAgICB2YXIgX25leHQgPSBfYXN5bmNUb0dlbmVyYXRvciggLyojX19QVVJFX18qL19yZWdlbmVyYXRvclJ1bnRpbWUubWFyayhmdW5jdGlvbiBfY2FsbGVlKCkge1xuICAgICAgICB2YXIgc3BsaXRlcmF0b3IsIGtleTtcbiAgICAgICAgcmV0dXJuIF9yZWdlbmVyYXRvclJ1bnRpbWUud3JhcChmdW5jdGlvbiBfY2FsbGVlJChfY29udGV4dCkge1xuICAgICAgICAgIHdoaWxlICgxKSB7XG4gICAgICAgICAgICBzd2l0Y2ggKF9jb250ZXh0LnByZXYgPSBfY29udGV4dC5uZXh0KSB7XG4gICAgICAgICAgICAgIGNhc2UgMDpcbiAgICAgICAgICAgICAgICBpZiAodGhpcy5pbml0aWFsaXplZCkge1xuICAgICAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDM7XG4gICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMztcbiAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5pbml0KCk7XG5cbiAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgIHNwbGl0ZXJhdG9yID0gdGhpcy5zcGxpdGVyYXRvcjtcblxuICAgICAgICAgICAgICAgIGlmICghKHRoaXMuY3VycmVudFBhcnQgIT09IG51bGwpKSB7XG4gICAgICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTI7XG4gICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBpZiAoIShzcGxpdGVyYXRvci52YWx1ZSAhPT0gc3BsaXQgfHwgc3BsaXRlcmF0b3IuY3VycmVudCA9PT0gdGhpcy5zcGxpdFN0ZXApKSB7XG4gICAgICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTI7XG4gICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICB0aGlzLmN1cnJlbnRQYXJ0LmluYWN0aXZlID0gdHJ1ZTtcblxuICAgICAgICAgICAgICBjYXNlIDc6XG4gICAgICAgICAgICAgICAgaWYgKCEoIXNwbGl0ZXJhdG9yLmRvbmUgJiYgc3BsaXRlcmF0b3IudmFsdWUgIT09IHNwbGl0KSkge1xuICAgICAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDEyO1xuICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDEwO1xuICAgICAgICAgICAgICAgIHJldHVybiBzcGxpdGVyYXRvci5hZHZhbmNlKCk7XG5cbiAgICAgICAgICAgICAgY2FzZSAxMDpcbiAgICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gNztcbiAgICAgICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgICAgICBjYXNlIDEyOlxuICAgICAgICAgICAgICAgIGlmICghc3BsaXRlcmF0b3IuZG9uZSkge1xuICAgICAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDE0O1xuICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0LmFicnVwdChcInJldHVyblwiLCB7XG4gICAgICAgICAgICAgICAgICB2YWx1ZTogdW5kZWZpbmVkLFxuICAgICAgICAgICAgICAgICAgZG9uZTogdHJ1ZVxuICAgICAgICAgICAgICAgIH0pO1xuXG4gICAgICAgICAgICAgIGNhc2UgMTQ6XG4gICAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDE2O1xuICAgICAgICAgICAgICAgIHJldHVybiBzcGxpdGVyYXRvci5hZHZhbmNlKCk7XG5cbiAgICAgICAgICAgICAgY2FzZSAxNjpcbiAgICAgICAgICAgICAgICBpZiAoIShzcGxpdGVyYXRvci5kb25lIHx8IHNwbGl0ZXJhdG9yLnZhbHVlID09PSBzcGxpdCkpIHtcbiAgICAgICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxODtcbiAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignVW5leHBlY3RlZCBlbXB0eSBncm91cCcpO1xuXG4gICAgICAgICAgICAgIGNhc2UgMTg6XG4gICAgICAgICAgICAgICAga2V5ID0gc3BsaXRlcmF0b3IudmFsdWU7XG4gICAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDIxO1xuICAgICAgICAgICAgICAgIHJldHVybiBzcGxpdGVyYXRvci5hZHZhbmNlKCk7XG5cbiAgICAgICAgICAgICAgY2FzZSAyMTpcbiAgICAgICAgICAgICAgICB0aGlzLnNwbGl0U3RlcCA9IHNwbGl0ZXJhdG9yLmN1cnJlbnQ7XG4gICAgICAgICAgICAgICAgdGhpcy5jdXJyZW50UGFydCA9IG5ldyBBc3luY1BhcnRJdGVyYXRvcih0aGlzKTtcbiAgICAgICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuYWJydXB0KFwicmV0dXJuXCIsIHtcbiAgICAgICAgICAgICAgICAgIHZhbHVlOiBba2V5LCB0aGlzLmN1cnJlbnRQYXJ0XSxcbiAgICAgICAgICAgICAgICAgIGRvbmU6IGZhbHNlXG4gICAgICAgICAgICAgICAgfSk7XG5cbiAgICAgICAgICAgICAgY2FzZSAyNDpcbiAgICAgICAgICAgICAgY2FzZSBcImVuZFwiOlxuICAgICAgICAgICAgICAgIHJldHVybiBfY29udGV4dC5zdG9wKCk7XG4gICAgICAgICAgICB9XG4gICAgICAg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gPSBfc3RlcC5kb25lO1xuICAgICAgICAgICAgX2NvbnRleHQyLm5leHQgPSAxMTtcbiAgICAgICAgICAgIHJldHVybiBfc3RlcC52YWx1ZTtcblxuICAgICAgICAgIGNhc2UgMTE6XG4gICAgICAgICAgICBfdmFsdWUgPSBfY29udGV4dDIuc2VudDtcblxuICAgICAgICAgICAgaWYgKF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24pIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQyLm5leHQgPSAxODtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHZhbHVlID0gX3ZhbHVlO1xuICAgICAgICAgICAgYXJyLnB1c2godmFsdWUpO1xuXG4gICAgICAgICAgY2FzZSAxNTpcbiAgICAgICAgICAgIF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gPSB0cnVlO1xuICAgICAgICAgICAgX2NvbnRleHQyLm5leHQgPSA1O1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICBjYXNlIDE4OlxuICAgICAgICAgICAgX2NvbnRleHQyLm5leHQgPSAyNDtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSAyMDpcbiAgICAgICAgICAgIF9jb250ZXh0Mi5wcmV2ID0gMjA7XG4gICAgICAgICAgICBfY29udGV4dDIudDAgPSBfY29udGV4dDJbXCJjYXRjaFwiXSgzKTtcbiAgICAgICAgICAgIF9kaWRJdGVyYXRvckVycm9yID0gdHJ1ZTtcbiAgICAgICAgICAgIF9pdGVyYXRvckVycm9yID0gX2NvbnRleHQyLnQwO1xuXG4gICAgICAgICAgY2FzZSAyNDpcbiAgICAgICAgICAgIF9jb250ZXh0Mi5wcmV2ID0gMjQ7XG4gICAgICAgICAgICBfY29udGV4dDIucHJldiA9IDI1O1xuXG4gICAgICAgICAgICBpZiAoISghX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiAmJiBfaXRlcmF0b3JbXCJyZXR1cm5cIl0gIT0gbnVsbCkpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQyLm5leHQgPSAyOTtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIF9jb250ZXh0Mi5uZXh0ID0gMjk7XG4gICAgICAgICAgICByZXR1cm4gX2l0ZXJhdG9yW1wicmV0dXJuXCJdKCk7XG5cbiAgICAgICAgICBjYXNlIDI5OlxuICAgICAgICAgICAgX2NvbnRleHQyLnByZXYgPSAyOTtcblxuICAgICAgICAgICAgaWYgKCFfZGlkSXRlcmF0b3JFcnJvcikge1xuICAgICAgICAgICAgICBfY29udGV4dDIubmV4dCA9IDMyO1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdGhyb3cgX2l0ZXJhdG9yRXJyb3I7XG5cbiAgICAgICAgICBjYXNlIDMyOlxuICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0Mi5maW5pc2goMjkpO1xuXG4gICAgICAgICAgY2FzZSAzMzpcbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dDIuZmluaXNoKDI0KTtcblxuICAgICAgICAgIGNhc2UgMzQ6XG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQyLmFicnVwdChcInJldHVyblwiLCBhc3luY1dyYXBXaXRoSXRlcmFibGVJdGVyYXRvcihhc3luY1dyYXApKGFycikpO1xuXG4gICAgICAgICAgY2FzZSAzNTpcbiAgICAgICAgICBjYXNlIFwiZW5kXCI6XG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQyLnN0b3AoKTtcbiAgICAgICAgfVxuICAgICAgfVxuICAgIH0sIF9jYWxsZWUyLCBudWxsLCBbWzMsIDIwLCAyNCwgMzRdLCBbMjUsLCAyOSwgMzNdXSk7XG4gIH0pKTtcbiAgcmV0dXJuIF9hc3luY0NhY2hlLmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7XG59XG5cbmV4cG9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AgICAgICAgICBzcGxpdGVyYXRvciA9IHRoaXMucGFydHNJdGVyYXRvci5zcGxpdGVyYXRvcjtcbiAgICAgICAgICAgICAgICBjdXJyZW50ID0gc3BsaXRlcmF0b3IuY3VycmVudDtcbiAgICAgICAgICAgICAgICB0aGlzLmFzc2VydEFjdGl2ZSgpO1xuXG4gICAgICAgICAgICAgICAgaWYgKCEodGhpcy5kb25lIHx8IGN1cnJlbnQuZG9uZSB8fCBjdXJyZW50LnZhbHVlID09PSBzcGxpdCkpIHtcbiAgICAgICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxMDtcbiAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIHRoaXMuZG9uZSA9IHRydWU7XG4gICAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDc7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMucGFydHNJdGVyYXRvci5tYXliZVJldHVyblNvdXJjZSgpO1xuXG4gICAgICAgICAgICAgIGNhc2UgNzpcbiAgICAgICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuYWJydXB0KFwicmV0dXJuXCIsIHtcbiAgICAgICAgICAgICAgICAgIHZhbHVlOiB1bmRlZmluZWQsXG4gICAgICAgICAgICAgICAgICBkb25lOiB0cnVlXG4gICAgICAgICAgICAgICAgfSk7XG5cbiAgICAgICAgICAgICAgY2FzZSAxMDpcbiAgICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTI7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHNwbGl0ZXJhdG9yLmFkdmFuY2UoKTtcblxuICAgICAgICAgICAgICBjYXNlIDEyOlxuICAgICAgICAgICAgICAgIHJldHVybiBfY29udGV4dC5hYnJ1cHQoXCJyZXR1cm5cIiwgY3VycmVudCk7XG5cbiAgICAgICAgICAgICAgY2FzZSAxMzpcbiAgICAgICAgICAgICAgY2FzZSBcImVuZFwiOlxuICAgICAgICAgICAgICAgIHJldHVybiBfY29udGV4dC5zdG9wKCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuICAgICAgICB9LCBfY2FsbGVlLCB0aGlzKTtcbiAgICAgIH0pKTtcblxuICAgICAgZnVuY3Rpb24gbmV4dCgpIHtcbiAgICAgICAgcmV0dXJuIF9uZXh0LmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7XG4gICAgICB9XG5cbiAgICAgIHJldHVybiBuZXh0O1xuICAgIH0oKVxuICB9LCB7XG4gICAga2V5OiBcInJldHVyblwiLFxuICAgIHZhbHVlOiBmdW5jdGlvbiAoKSB7XG4gICAgICB2YXIgX3JldHVybjIgPSBfYXN5bmNUb0dlbmVyYXRvciggLyojX19QVVJFX18qL19yZWdlbmVyYXRvclJ1bnRpbWUubWFyayhmdW5jdGlvbiBfY2FsbGVlMigpIHtcbiAgICAgICAgcmV0dXJuIF9yZWdlbmVyYXRvclJ1bnRpbWUud3JhcChmdW5jdGlvbiBfY2FsbGVlMiQoX2NvbnRleHQyKSB7XG4gICAgICAgICAgd2hpbGUgKDEpIHtcbiAgICAgICAgICAgIHN3aXRjaCAoX2NvbnRleHQyLnByZXYgPSBfY29udGV4dDIubmV4dCkge1xuICAgICAgICAgICAgICBjYXNlIDA6XG4gICAgICAgICAgICAgICAgdGhpcy5kb25lID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICBfY29udGV4dDIubmV4dCA9IDM7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMucGFydHNJdGVyYXRvci5tYXliZVJldHVyblNvdXJjZSgpO1xuXG4gICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICByZXR1cm4gX2NvbnRleHQyLmFicnVwdChcInJldHVyblwiLCB7XG4gICAgICAgICAgICAgICAgICB2YWx1ZTogdW5kZWZpbmVkLFxuICAgICAgICAgICAgICAgICAgZG9uZTogdHJ1ZVxuICAgICAgICAgICAgICAgIH0pO1xuXG4gICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgY2FzZSBcImVuZFwiOlxuICAgICAgICAgICAgICAgIHJldHVybiBfY29udGV4dDIuc3RvcCgpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cbiAgICAgICAgfSwgX2NhbGxlZTIsIHRoaXMpO1xuICAgICAgfSkpO1xuXG4gICAgICBmdW5jdGlvbiBfcmV0dXJuKCkge1xuICAgICAgICByZXR1cm4gX3JldHVybjIuYXBwbHkodGhpcywgYXJndW1lbnRzKTtcbiAgICAgIH1cblxuICAgICAgcmV0dXJuIF9yZXR1cm47XG4gICAgfSgpXG4gIH0sIHtcbiAgICBrZXk6IFwidGhyb3dcIixcbiAgICB2YWx1ZTogZnVuY3Rpb24gKCkge1xuICAgICAgdmFyIF90aHJvdzIgPSBfYXN5bmNUb0dlbmVyYXRvciggLyojX19QVVJFX18qL19yZWdlbmVyYXRvclJ1bnRpbWUubWFyayhmdW5jdGlvbiBfY2FsbGVlMygpIHtcbiAgICAgICAgcmV0dXJuIF9yZWdlbmVyYXRvclJ1bnRpbWUud3JhcChmdW5jdGlvbiBfY2FsbGVlMyQoX2NvbnRleHQzKSB7XG4gICAgICAgICAgd2hpbGUgKDEpIHtcbiAgICAgICAgICAgIHN3aXRjaCAoX2NvbnRleHQzLnByZXYgPSBfY29udGV4dDMubmV4dCkge1xuICAgICAgICAgICAgICBjYXNlIDA6XG4gICAgICAgICAgICAgICAgX2NvbnRleHQzLm5leHQgPSAyO1xuICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW1wicmV0dXJuXCJdKCk7XG5cbiAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgIHJldHVybiBfY29udGV4dDMuYWJydXB0KFwicmV0dXJuXCIsIF9jb250ZXh0My5zZW50KTtcblxuICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgIGNhc2UgXCJlbmRcIjpcbiAgICAgICAgICAgICAgICByZXR1cm4gX2NvbnRleHQzLnN0b3AoK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LnNlbnQ7XG5cbiAgICAgICAgICAgICAgY2FzZSA1OlxuICAgICAgICAgICAgICBjYXNlIFwiZW5kXCI6XG4gICAgICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0NC5zdG9wKCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuICAgICAgICB9LCBfY2FsbGVlNCwgdGhpcyk7XG4gICAgICB9KSk7XG5cbiAgICAgIGZ1bmN0aW9uIGluaXQoKSB7XG4gICAgICAgIHJldHVybiBfaW5pdC5hcHBseSh0aGlzLCBhcmd1bWVudHMpO1xuICAgICAgfVxuXG4gICAgICByZXR1cm4gaW5pdDtcbiAgICB9KClcbiAgfSwge1xuICAgIGtleTogXCJtYXliZVJldHVyblNvdXJjZVwiLFxuICAgIHZhbHVlOiBmdW5jdGlvbiAoKSB7XG4gICAgICB2YXIgX21heWJlUmV0dXJuU291cmNlID0gX2FzeW5jVG9HZW5lcmF0b3IoIC8qI19fUFVSRV9fKi9fcmVnZW5lcmF0b3JSdW50aW1lLm1hcmsoZnVuY3Rpb24gX2NhbGxlZTUoKSB7XG4gICAgICAgIHJldHVybiBfcmVnZW5lcmF0b3JSdW50aW1lLndyYXAoZnVuY3Rpb24gX2NhbGxlZTUkKF9jb250ZXh0NSkge1xuICAgICAgICAgIHdoaWxlICgxKSB7XG4gICAgICAgICAgICBzd2l0Y2ggKF9jb250ZXh0NS5wcmV2ID0gX2NvbnRleHQ1Lm5leHQpIHtcbiAgICAgICAgICAgICAgY2FzZSAwOlxuICAgICAgICAgICAgICAgIGlmICghKHRoaXMuc3BsaXRlcmF0b3IgJiYgdGhpcy5yZXR1cm5lZCAmJiB0aGlzLmN1cnJlbnRQYXJ0LmRvbmUpKSB7XG4gICAgICAgICAgICAgICAgICBfY29udGV4dDUubmV4dCA9IDM7XG4gICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBfY29udGV4dDUubmV4dCA9IDM7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuc3BsaXRlcmF0b3JbXCJyZXR1cm5cIl0oKTtcblxuICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgIGNhc2UgXCJlbmRcIjpcbiAgICAgICAgICAgICAgICByZXR1cm4gX2NvbnRleHQ1LnN0b3AoKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgIH0sIF9jYWxsZWU1LCB0aGlzKTtcbiAgICAgIH0pKTtcblxuICAgICAgZnVuY3Rpb24gbWF5YmVSZXR1cm5Tb3VyY2UoKSB7XG4gICAgICAgIHJldHVybiBfbWF5YmVSZXR1cm5Tb3VyY2UuYXBwbHkodGhpcywgYXJndW1lbnRzKTtcbiAgICAgIH1cblxuICAgICAgcmV0dXJuIG1heWJlUmV0dXJuU291cmNlO1xuICAgIH0oKVxuICB9LCB7XG4gICAga2V5OiBcIm5leHRcIixcbiAgICB2YWx1ZTogZnVuY3Rpb24gKCkge1xuICAgICAgdmFyIF9uZXh0MiA9IF9hc3luY1RvR2VuZXJhdG9yKCAvKiNfX1BVUkVfXyovX3JlZ2VuZXJhdG9yUnVudGltZS5tYXJrKGZ1bmN0aW9uIF9jYWxsZWU2KCkge1xuICAgICAgICB2YXIgc3BsaXRlcmF0b3I7XG4gICAgICAgIHJldHVybiBfcmVnZW5lcmF0b3JSdW50aW1lLndyYXAoZnVuY3Rpb24gX2NhbGxlZTYkKF9jb250ZXh0Nikge1xuICAgICAgICAgIHdoaWxlICgxKSB7XG4gICAgICAgICAgICBzd2l0Y2ggKF9jb250ZXh0Ni5wcmV2ID0gX2NvbnRleHQ2Lm5leHQpIHtcbiAgICAgICAgICAgICAgY2FzZSAwOlxuICAgICAgICAgICAgICAgIGlmICh0aGlzLmluaXRpYWxpemVkKSB7XG4gICAgICAgICAgICAgICAgICBfY29udGV4dDYubmV4dCA9IDM7XG4gICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBfY29udGV4dDYubmV4dCA9IDM7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuaW5pdCgpO1xuXG4gICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICBzcGxpdGVyYXRvciA9IHRoaXMuc3BsaXRlcmF0b3I7XG5cbiAgICAgICAgICAgICAgICBpZiAoIXNwbGl0ZXJhdG9yLmRvbmUpIHtcbiAgICAgICAgICAgICAgICAgIF9jb250ZXh0Ni5uZXh0ID0gNjtcbiAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIHJldHVybiBfY29udGV4dDYuYWJydXB0KFwicmV0dXJuXCIsIHtcbiAgICAgICAgICAgICAgICAgIHZhbHVlOiB1bmRlZmluZWQsXG4gICAgICAgICAgICAgICAgICBkb25lOiB0cnVlXG4gICAgICAgICAgICAgICAgfSk7XG5cbiAgICAgICAgICAgICAgY2FzZSA2OlxuICAgICAgICAgICAgICAgIGlmICghKHRoaXMuY3VycmVudFBhcnQgIT09IG51bGwpKSB7XG4gICAgICAgICAgICAgICAgICBfY29udGV4dDYubmV4dCA9IDE2O1xuICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgaWYgKCEoc3BsaXRlcmF0b3IudmFsdWUgIT09IHNwbGl0IHx8IHNwbGl0ZXJhdG9yLmN1cnJlbnQgPT09IHRoaXMuc3BsaXRTdGVwKSkge1xuICAgICAgICAgICAgICAgICAgX2NvbnRleHQ2Lm5leHQgPSAxNDtcbiAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIHRoaXMuY3VycmVudFBhcnQuaW5hY3RpdmUgPSB0cnVlO1xuXG4gICAgICAgICAgICAgIGNhc2UgOTpcbiAgICAgICAgICAgICAgICBpZiAoISghc3BsaXRlcmF0b3IuZG9uZSAmJiBzcGxpdGVyYXRvci52YWx1ZSAhPT0gc3BsaXQpKSB7XG4gICAgICAgICAgICAgICAgICBfY29udGV4dDYubmV4dCA9IDE0O1xuICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgX2NvbnRleHQ2Lm5leHQgPSAxMjtcbiAgICAgICAgICAgICAgICByZXR1cm4gc3BsaXRlcmF0b3IuYWR2YW5jZSgpO1xuXG4gICAgICAgICAgICAgIGNhc2UgMTI6XG4gICAgICAgICAgICAgICAgX2NvbnRleHQ2Lm5leHQgPSA5O1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgICAgIGNhc2UgMTQ6XG4gICAgICAgICAgICAgICAgX2NvbnRleHQ2Lm5leHQgPSAxNjtcbiAgICAgICAgICAgICAgICByZXR1cm4gc3BsaXRlcmF0b3IuYWR2YW5jZSgpO1xuXG4gICAgICAgICAgICAgIGNhc2UgMTY6XG4gICAgICAgICAgICAgICAgdGhpcy5zcGxpdFN0ZXAgPSBzcGxpdGVyYXRvci5jdXJyZW50O1xuICAgICAgICAgICAgICAgIHRoaXMuY3VycmVudFBhcnQgPSBuZXcgQXN5bmNQYXJ0SXRlcmF0b3IodGhpcyk7XG4gICAgICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0Ni5hYnJ1cHQoXCJyZXR1cm5cIiwge1xuICAgICAgICAgICAgICAgICAgdmFsdWU6IHRoaXMuY3VycmVudFBhcnQsXG4gICAgICAgICAgICAgICAgICBkb25lOiBmYWxzZVxuICAgICAgICAgICAgICAgIH0pO1xuXG4gICAgICAgICAgICAgIGNhc2UgMTk6XG4gICAgICAgICAgICAgIGNhc2UgXCJlbmRcIjpcbiAgICAgICAgICAgICAgICByZXR1cm4gX2NvbnRleHQ2LnN0b3AoKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgIH0sIF9jYWxsZWU2LCB0aGlzKTtcbiAgICAgIH0pKTtcblxuICAgICAgZnVuY3Rpb24gbmV4dCgpIHtcbiAgICAgICAgcmV0dXJuIF9uZXh0Mi5hcHBseSh0aGlzLCBhcmd1bWVudHMpO1xuICAgICAgfVxuXG4gICAgICByZXR1cm4gbmV4dDtcbiAgICB9KClcbiAgfSwge1xuICAgIGtleTogXCJyZXR1cm5cIixcbiAgICB2YWx1ZTogZnVuY3Rpb24gKCkge1xuICAgICAgdmFyIF9yZXR1cm4zID0gX2FzeW5jVG9HZW5lcmF0b3IoIC8qI19fUFVSRV9fKi9fcmVnZW5lcmF0b3JSdW50aW1lLm1hcmsoZnVuY3Rpb24gX2NhbGxlZTcodmFsdWUpIHtcbiAgICAgICAgcmV0dXJuIF9yZWdlbmVyYXRvclJ1bnRpbWUud3JhcChmdW5jdGlvbiBfY2FsbGVlNyQoX2NvbnRleHQ3KSB7XG4gICAgICAgICAgd2hpbGUgKDEpIHtcbiAgICAgICAgICAgIHN3aXRjaCAoX2NvbnRleHQ3LnByZXYgPSBfY29udGV4dDcubmV4dCkge1xuICAgICAgICAgICAgICBjYXNlIDA6XG4gICAgICAgICAgICAgICAgdGhpcy5yZXR1cm5lZCA9IHRydWU7XG4gICAgICAgICAgICAgICAgX2NvbnRleHQ3Lm5leHQgPSAzO1xuICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLm1heWJlUmV0dXJuU291cmNlKCk7XG5cbiAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgIHJldHVybiBfY29udGV4dDcuYWJydXB0KFwicmV0dXJuXCIsIHtcbiAgICAgICAgICAgICAgICAgIHZhbHVlOiB2YWx1ZSxcbiAgICAgICAgICAgICAgICAgIGRvbmU6IHRydWVcbiAgICAgICAgICAgICAgICB9KTtcblxuICAgICAgICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgICAgIGNhc2UgXCJlbmRcIjpcbiAgICAgICAgICAgICAgICByZXR1cm4gX2NvbnRleHQ3LnN0b3AoKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgIH0sIF9jYWxsZWU3LCB0aGlzKTtcbiAgICAgIH0pKTtcblxuICAgICAgZnVuY3Rpb24gX3JldHVybihfeCkge1xuICAgICAgICByZXR1cm4gX3JldHVybjMuYXBwbHkodGhpcywgYXJndW1lbnRzKTtcbiAgICAgIH1cblxuICAgICAgcmV0dXJuIF9yZXR1cm47XG4gICAgfSgpXG4gIH0sIHtcbiAgICBrZXk6IFwidGhyb3dcIixcbiAgICB2YWx1ZTogZnVuY3Rpb24gKCkge1xuICAgICAgdmFyIF90aHJvdzMgPSBfYXN5bmNUb0dlbmVyYXRvciggLyojX19QVVJFX18qL19yZWdlbmVyYXRvclJ1bnRpbWUubWFyayhmdW5jdGlvbiBfY2FsbGVlOCgpIHtcbiAgICAgICAgcmV0dXJuIF9yZWdlbmVyYXRvclJ1bnRpbWUud3JhcChmdW5jdGlvbiBfY2FsbGVlOCQoX2NvbnRleHQ4KSB7XG4gICAgICAgICAgd2hpbGUgKDEpIHtcbiAgICAgICAgICAgIHN3aXRjaCAoX2NvbnRleHQ4LnByZXYgPSBfY29udGV4dDgubmV4dCkge1xuICAgICAgICAgICAgICBjYXNlIDA6XG4gICAgICAgICAgICAgICAgX2NvbnRleHQ4Lm5leHQgPSAyO1xuICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW1wicmV0dXJuXCJdKCk7XG5cbiAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgIHJldHVybiBfY29udGV4dDguYWJydXB0KFwicmV0dXJuXCIsIF9jb250ZXh0OC5zZW50KTtcblxuICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgIGNhc2UgXCJlbmRcIjpcbiAgICAgICAgICAgICAgICByZXR1cm4gX2NvbnRleHQ4LnN0b3AoKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgIH0sIF9jYWxsZWU4LCB0aGlzKTtcbiAgICAgIH0pKTtcbl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GNhc2UgXCJlbmRcIjpcbiAgICAgICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuc3RvcCgpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cbiAgICAgICAgfSwgX2NhbGxlZSwgdGhpcyk7XG4gICAgICB9KSk7XG5cbiAgICAgIGZ1bmN0aW9uIG5leHQoKSB7XG4gICAgICAgIHJldHVybiBfbmV4dC5hcHBseSh0aGlzLCBhcmd1bWVudHMpO1xuICAgICAgfVxuXG4gICAgICByZXR1cm4gbmV4dDtcbiAgICB9KClcbiAgfSwge1xuICAgIGtleTogXCJyZXR1cm5cIixcbiAgICB2YWx1ZTogZnVuY3Rpb24gKCkge1xuICAgICAgdmFyIF9yZXR1cm4yID0gX2FzeW5jVG9HZW5lcmF0b3IoIC8qI19fUFVSRV9fKi9fcmVnZW5lcmF0b3JSdW50aW1lLm1hcmsoZnVuY3Rpb24gX2NhbGxlZTIoKSB7XG4gICAgICAgIHJldHVybiBfcmVnZW5lcmF0b3JSdW50aW1lLndyYXAoZnVuY3Rpb24gX2NhbGxlZTIkKF9jb250ZXh0Mikge1xuICAgICAgICAgIHdoaWxlICgxKSB7XG4gICAgICAgICAgICBzd2l0Y2ggKF9jb250ZXh0Mi5wcmV2ID0gX2NvbnRleHQyLm5leHQpIHtcbiAgICAgICAgICAgICAgY2FzZSAwOlxuICAgICAgICAgICAgICAgIF9jb250ZXh0Mi5uZXh0ID0gMjtcbiAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5wZWVrcltcInJldHVyblwiXSgpO1xuXG4gICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgY2FzZSBcImVuZFwiOlxuICAgICAgICAgICAgICAgIHJldHVybiBfY29udGV4dDIuc3RvcCgpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cbiAgICAgICAgfSwgX2NhbGxlZTIsIHRoaXMpO1xuICAgICAgfSkpO1xuXG4gICAgICBmdW5jdGlvbiBfcmV0dXJuKCkge1xuIC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JhYmxlKGl0ZXJhYmxlKVtTeW1ib2wuYXN5bmNJdGVyYXRvcl0oKTtcbiAgICAgICAgICAgICAgICBfY29udGV4dDMubmV4dCA9IDM7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGl0ZXJhdG9yLm5leHQoKTtcblxuICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgZmlyc3QgPSBfY29udGV4dDMuc2VudDtcblxuICAgICAgICAgICAgICAgIGZvciAoX2xlbiA9IF9hcmdzMy5sZW5ndGgsIGFyZ3MgPSBuZXcgQXJyYXkoX2xlbiA+IDEgPyBfbGVuIC0gMSA6IDApLCBfa2V5ID0gMTsgX2tleSA8IF9sZW47IF9rZXkrKykge1xuICAgICAgICAgICAgICAgICAgYXJnc1tfa2V5IC0gMV0gPSBfYXJnczNbX2tleV07XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0My5hYnJ1cHQoXCJyZXR1cm5cIiwgX2NvbnN0cnVjdCh0aGlzLCBbaXRlcmF0b3IsIGZpcnN0XS5jb25jYXQoYXJncykpKTtcblxuICAgICAgICAgICAgICBjYXNlIDY6XG4gICAgICAgICAgICAgIGNhc2UgXCJlbmRcIjpcbiAgICAgICAgICAgICAgICByZXR1cm4gX2NvbnRleHQzLnN0b3AoKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgIH0sIF9jYWxsZWUzLCB0aGlzKTtcbiAgICAgIH0pKTtcblxuICAgICAgZnVuY3Rpb24gZnJvbShfeCkge1xuICAgICAgICByZXR1cm4gX2Zyb20uYXBwbHkodGhpcywgYXJndW1lbnRzKTtcbiAgICAgIH1cblxuICAgICAgcmV0dXJuIGZyb207XG4gICAgfSgpXG4gIH1dKTtcblxuICBmdW5jdGlvbiBBc3luY1BlZWtlcmF0b3IoaXRlcmF0b3IsIGZpcnN0KSB7XG4gICAgX2NsYXNzQ2FsbENoZWNrKHRoaXMsIEFzeW5jUGVla2VyYXRvcik7XG5cbiAgICB0aGlzW19dID0ge1xuICAgICAgaXRlcmF0b3I6IGl0ZXJhdG9yLFxuICAgICAgY3VycmVudDogZmlyc3QsXG4gICAgICBpbmRleDogMFxuICAgIH07XG4gIH1cblxuICBfY3JlYXRlQ2xhc3MoQXN5bmNQZWVrZXJhdG9yLCBbe1xuICAgIGtleTogXCJhZHZhbmNlXCIsXG4gICAgdmFsdWU6IGZ1bmN0aW9uICgpIHtcbiAgICAgIHZhciBfYWR2YW5jZSA9IF9hc3luY1RvR2VuZXJhdG9yKCAvKiNfX1BVUkVfXyovX3JlZ2VuZXJhdG9yUnVudGltZS5tYXJrKGZ1bmN0aW9uIF9jYWxsZWU0KCkge1xuICAgICAgICB2YXIgdGhpc187XG4gICAgICAgIHJldHVybiBfcmVnZW5lcmF0b3JSdW50aW1lLndyYXAoZnVuY3Rpb24gX2NhbGxlZTQkKF9jb250ZXh0NCkge1xuICAgICAgICAgIHdoaWxlICgxKSB7XG4gICAgICAgICAgICBzd2l0Y2ggKF9jb250ZXh0NC5wcmV2ID0gX2NvbnRleHQ0Lm5leHQpIHtcbiAgICAgICAgICAgICAgY2FzZSAwOlxuICAgICAgICAgICAgICAgIHRoaXNfID0gdGhpc1tfXTtcblxuICAgICAgICAgICAgICAgIGlmICh0aGlzXy5jdXJyZW50LmRvbmUpIHtcbiAgICAgICAgICAgICAgICAgIF9jb250ZXh0NC5uZXh0ID0gNjtcbiAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIHRoaXNfLmluZGV4Kys7XG4gICAgICAgICAgICAgICAgX2NvbnRleHQ0Lm5leHQgPSA1O1xuICAgICAgICAgICAgICAgIHJldHVybiB0aGlzXy5pdGVyYXRvci5uZXh0KCk7XG5cbiAgICAgICAgICAgICAgY2FzZSA1OlxuICAgICAgICAgICAgICAgIHRoaXNfLmN1cnJlbnQgPSBfY29udGV4dDQuc2VudDtcblxuICAgICAgICAgICAgICBjYXNlIDY6XG4gICAgICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0NC5hYnJ1cHQoXCJyZXR1cm5cIiwgdGhpcyk7XG5cbiAgICAgICAgICAgICAgY2FzZSA3OlxuICAgICAgICAgICAgICBjYXNlIFwiZW5kXCI6XG4gICAgICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0NC5zdG9wKCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuICAgICAgICB9LCBfY2FsbGVlNCwgdGhpcyk7XG4gICAgICB9KSk7XG5cbiAgICAgIGZ1bmN0aW9uIGFkdmFuY2UoKSB7XG4gICAgICAgIHJldHVybiBfYWR2YW5jZS5hcHBseSh0aGlzLCBhcmd1bWVudHMpO1xuICAgICAgfVxuXG4gICAgICByZXR1cm4gYWR2YW5jZTtcbiAgICB9KClcbiAgfSwge1xuICAgIGtleTogXCJyZXR1cm5cIixcbiAgICB2YWx1ZTogZnVuY3Rpb24gKCkge1xuICAgICAgdmFyIF9yZXR1cm4zID0gX2FzeW5jVG9HZW5lcmF0b3IoIC8qI19fUFVSRV9fKi9fcmVnZW5lcmF0b3JSdW50aW1lLm1hcmsoZnVuY3Rpb24gX2NhbGxlZTUoKSB7XG4gICAgICAgIHZhciB0aGlzXztcbiAgICAgICAgcmV0dXJuIF9yZWdlbmVyYXRvclJ1bnRpbWUud3JhcChmdW5jdGlvbiBfY2FsbGVlNSQoX2NvbnRleHQ1KSB7XG4gICAgICAgICAgd2hpbGUgKDEpIHtcbiAgICAgICAgICAgIHN3aXRjaCAoX2NvbnRleHQ1LnByZXYgPSBfY29udGV4dDUubmV4dCkge1xuICAgICAgICAgICAgICBjYXNlIDA6XG4gICAgICAgICAgICAgICAgdGhpc18gPSB0aGlzW19dO1xuXG4gICAgICAgICAgICAgICAgaWYgKHRoaXMuZG9uZSkge1xuICAgICAgICAgICAgICAgICAgX2NvbnRleHQ1Lm5leHQgPSA0O1xuICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgX2NvbnRleHQ1Lm5leHQgPSA0O1xuICAgICAgICAgICAgICAgIHJldHVybiBhc3luY0NhbGxSZXR1cm4odGhpc18uaXRlcmF0b3IpO1xuXG4gICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICB0aGlzXy5jdXJyZW50ID0ge1xuICAgICAgICAgICAgICAgICAgdmFsdWU6IHVuZGVmaW5lZCxcbiAgICAgICAgICAgICAgICAgIGRvbmU6IHRydWVcbiAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICAgIHJldHVybiBfY29udGV4dDUuYWJydXB0KFwicmV0dXJuXCIsIHRoaXMpO1xuXG4gICAgICAgICAgICAgIGNhc2UgNjpcbiAgICAgICAgICAgICAgY2FzZSBcImVuZFwiOlxuICAgICAgICAgICAgICAgIHJldHVybiBfY29udGV4dDUuc3RvcCgpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cbiAgICAgICAgfSwgX2NhbGxlZTUsIHRoaXMpO1xuICAgICAgfSkpO1xuXG4gICAgICBmdW5jdGlvbiBfcmV0dXJuKCkge1xuICAgICAgICByZXR1cm4gX3JldHVybjMuYXBwbHkodGhpcywgYXJndW1lbnRzKTtcbiAgICAgIH1cblxuICAgICAgcmV0dXJuIF9yZXR1cm47XG4gICAgfSgpXG4gIH0sIHtcbiAgICBrZXk6IFwiYXNJdGVyYXRvclwiLFxuICAgIHZhbHVlOiBmdW5jdGlvbiBhc0l0ZXJhdG9yKCkge1xuICAgICAgcmV0dXJuIG5ldyBBc3luY1BlZWtlcmF0b3JJdGVyYXRvcih0aGlzKTtcbiAgICB9XG4gIH0sIHtcbiAgICBrZXk6IFwiY3VycmVudFwiLFxuICAgIGdldDogZnVuY3Rpb24gZ2V0KCkge1xuICAgICAgcmV0dXJuIHRoaXNbX10uY3VycmVudDtcbiAgICB9XG4gIH0sIHtcbiAgICBrZXk6IFwidmFsdWVcIixcb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L19yZWdlbmVyYXRvclJ1bnRpbWUubWFyayhmdW5jdGlvbiBfY2FsbGVlKCkge1xuICAgICAgICAgICAgICByZXR1cm4gX3JlZ2VuZXJhdG9yUnVudGltZS53cmFwKGZ1bmN0aW9uIF9jYWxsZWUkKF9jb250ZXh0KSB7XG4gICAgICAgICAgICAgICAgd2hpbGUgKDEpIHtcbiAgICAgICAgICAgICAgICAgIHN3aXRjaCAoX2NvbnRleHQucHJldiA9IF9jb250ZXh0Lm5leHQpIHtcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAwOlxuICAgICAgICAgICAgICAgICAgICAgIHNlbGYuc2V0dXBGaXJzdCgpO1xuICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBfY29udGV4dC5kZWxlZ2F0ZVlpZWxkKHNlbGYuZmlyc3RQYXJ0LCBcInQwXCIsIDIpO1xuXG4gICAgICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgY2FzZSBcImVuZFwiOlxuICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBfY29udGV4dC5zdG9wKCk7XG4gICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICB9LCBfY2FsbGVlKTtcbiAgICAgICAgICAgIH0pKCksXG4gICAgICAgICAgICBkb25lOiBmYWxzZVxuICAgICAgICAgIH07XG5cbiAgICAgICAgY2FzZSAxOlxuICAgICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICB2YWx1ZTogLyojX19QVVJFX18qL19yZWdlbmVyYXRvclJ1bnRpbWUubWFyayhmdW5jdGlvbiBfY2FsbGVlMigpIHtcbiAgICAgICAgICAgICAgdmFyIHN0ZXA7XG4gICAgICAgICAgICAgIHJldHVybiBfcmVnZW5lcmF0b3JSdW50aW1lLndyYXAoZnVuY3Rpb24gX2NhbGxlZTIkKF9jb250ZXh0Mikge1xuICAgICAgICAgICAgICAgIHdoaWxlICgxKSB7XG4gICAgICAgICAgICAgICAgICBzd2l0Y2ggKF9jb250ZXh0Mi5wcmV2ID0gX2NvbnRleHQyLm5leHQpIHtcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAwOlxuICAgICAgICAgICAgICAgICAgICAgIHNlbGYuc2V0dXBGaXJzdCgpO1xuICAgICAgICAgICAgICAgICAgICAgIHN0ZXAgPSBzZWxmLnBhcnRzSXRlcmF0b3IubmV4dCgpO1xuICAgICAgICAgICAgICAgICAgICAgIHNlbGYuc2Vjb25kUGFydCA9IHN0ZXAuZG9uZSA/IFtdIDogc3RlcC52YWx1ZTtcbiAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gX2NvbnRleHQyLmRlbGVnYXRlWWllbGQoc2VsZi5zZWNvbmRQYXJ0LCBcInQwXCIsIDQpO1xuXG4gICAgICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgY2FzZSBcImVuZFwiOlxuICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBfY29udGV4dDIuc3RvcCgpO1xuICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgfSwgX2NhbGxlZTIpO1xuICAgICAgICAgICAgfSkoKSxcbiAgICAgICAgICAgIGRvbmU6IGZhbHNlXG4gICAgICAgICAgfTtcblxuICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICB2YWx1ZTogdW5kZWZpbmVkLFxuICAgICAgICAgICAgZG9uZTogdHJ1ZVxuICAgICAgICAgIH07XG4gICAgICB9XG4gICAgfVxuICB9LCB7XG4gICAga2V5OiBcInJldHVyblwiLFxuICAgIHZhbHVlOiBmdW5jdGlvbiBfcmV0dXJuKCkge1xuICAgICAgaWYgKHRoaXMuY3VycmVudElkeCA9PT0gMSkge1xuICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ1lvdSBtdXN0IHRha2UgYm90aCBwYXJ0cyBvZiBhIGJpc2VjdG9yIG9yIG5laXRoZXIuJ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ym9vbGVhbn1cclxuICAgICAqIEBjb25zdFxyXG4gICAgICogQHByaXZhdGVcclxuICAgICAqL1xyXG4gICAgTG9uZy5wcm90b3R5cGUuX19pc0xvbmdfXztcclxuXHJcbiAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoTG9uZy5wcm90b3R5cGUsIFwiX19pc0xvbmdfX1wiLCB7XHJcbiAgICAgICAgdmFsdWU6IHRydWUsXHJcbiAgICAgICAgZW51bWVyYWJsZTogZmFsc2UsXHJcbiAgICAgICAgY29uZmlndXJhYmxlOiBmYWxzZVxyXG4gICAgfSk7XHJcblxyXG4gICAgLyoqXHJcbiAgICAgKiBAZnVuY3Rpb25cclxuICAgICAqIEBwYXJhbSB7Kn0gb2JqIE9iamVjdFxyXG4gICAgICogQHJldHVybnMge2Jvb2xlYW59XHJcbiAgICAgKiBAaW5uZXJcclxuICAgICAqL1xyXG4gICAgZnVuY3Rpb24gaXNMb25nKG9iaikge1xyXG4gICAgICAgIHJldHVybiAob2JqICYmIG9ialtcIl9faXNMb25nX19cIl0pID09PSB0cnVlO1xyXG4gICAgfVxyXG5cclxuICAgIC8qKlxyXG4gICAgICogVGVzdHMgaWYgdGhlIHNwZWNpZmllZCBvYmplY3QgaXMgYSBMb25nLlxyXG4gICAgICogQGZ1bmN0aW9uXHJcbiAgICAgKiBAcGFyYW0geyp9IG9iaiBPYmplY3RcclxuICAgICAqIEByZXR1cm5zIHtib29sZWFufVxyXG4gICAgICovXHJcbiAgICBMb25nLmlzTG9uZyA9IGlzTG9uZztcclxuXHJcbiAgICAvKipcclxuICAgICAqIEEgY2FjaGUgb2YgdGhlIExvbmcgcmVwcmVzZW50YXRpb25zIG9mIHNtYWxsIGludGVnZXIgdmFsdWVzLlxyXG4gICAgICogQHR5cGUgeyFPYmplY3R9XHJcbiAgICAgKiBAaW5uZXJcclxuICAgICAqL1xyXG4gICAgdmFyIElOVF9DQUNIRSA9IHt9O1xyXG5cclxuICAgIC8qKlxyXG4gICAgICogQSBjYW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Mb25nfVxyXG4gICAgICogQGlubmVyXHJcbiAgICAgKi9cclxuICAgIGZ1bmN0aW9uIGZyb21OdW1iZXIodmFsdWUsIHVuc2lnbmVkKSB7XHJcbiAgICAgICAgaWYgKGlzTmFOKHZhbHVlKSB8fCAhaXNGaW5pdGUodmFsdWUpKVxyXG4gICAgICAgICAgICByZXR1cm4gdW5zaWduZWQgPyBVWkVSTyA6IFpFUk87XHJcbiAgICAgICAgaWYgKHVuc2lnbmVkKSB7XHJcbiAgICAgICAgICAgIGlmICh2YWx1ZSA8IDApXHJcbiAgICAgICAgICAgICAgICByZXR1cm4gVVpFUk87XHJcbiAgICAgICAgICAgIGlmICh2YWx1ZSA+PSBUV09fUFdSXzY0X0RCTClcclxuICAgICAgICAgICAgICAgIHJldHVybiBNQVhfVU5TSUdORURfVkFMVUU7XHJcbiAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgaWYgKHZhbHVlIDw9IC1UV09fUFdSXzYzX0RCTClcclxuICAgICAgICAgICAgICAgIHJldHVybiBNSU5fVkFMVUU7XHJcbiAgICAgICAgICAgIGlmICh2YWx1ZSArIDEgPj0gVFdPX1BXUl82M19EQkwpXHJcbiAgICAgICAgICAgICAgICByZXR1cm4gTUFYX1ZBTFVFO1xyXG4gICAgICAgIH1cclxuICAgICAgICBpZiAodmFsdWUgPCAwKVxyXG4gICAgICAgICAgICByZXR1cm4gZnJvbU51bWJlcigtdmFsdWUsIHVuc2lnbmVkKS5uZWcoKTtcclxuICAgICAgICByZXR1cm4gZnJvbUJpdHMoKHZhbHVlICUgVFdPX1BXUl8zMl9EQkwpIHwgMCwgKHZhbHVlIC8gVFdPX1BXUl8zMl9EQkwpIHwgMCwgdW5zaWduZWQpO1xyXG4gICAgfVxyXG5cclxuICAgIC8qKlxyXG4gICAgICogUmV0dXJucyBhIExvbmcgcmVwcmVzZW50aW5nIHRoZSBnaXZlbiB2YWx1ZSwgcHJvdmlkZWQgdGhhdCBpdCBpcyBhIGZpbml0ZSB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1iZXIocG93X2RibChyYWRpeCwgOCkpO1xyXG5cclxuICAgICAgICB2YXIgcmVzdWx0ID0gWkVSTztcclxuICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IHN0ci5sZW5ndGg7IGkgKz0gOCkge1xyXG4gICAgICAgICAgICB2YXIgc2l6ZSA9IE1hdGgubWluKDgsIHN0ci5sZW5ndGggLSBpKSxcclxuICAgICAgICAgICAgICAgIHZhbHVlID0gcGFyc2VJbnQoc3RyLnN1YnN0cmluZyhpLCBpICsgc2l6ZSksIHJhZGl4KTtcclxuICAgICAgICAgICAgaWYgKHNpemUgPCA4KSB7XHJcbiAgICAgICAgICAgICAgICB2YXIgcG93ZXIgPSBmcm9tTnVtYmVyKHBvd19kYmwocmFkaXgsIHNpemUpKTtcclxuICAgICAgICAgICAgICAgIHJlc3VsdCA9IHJlc3VsdC5tdWwocG93ZXIpLmFkZChmcm9tTnVtYmVyKHZhbHVlKSk7XHJcbiAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICByZXN1bHQgPSByZXN1bHQubXVsKHJhZGl4VG9Qb3dlcik7XHJcbiAgICAgICAgICAgICAgICByZXN1bHQgPSByZXN1bHQuYWRkKGZyb21OdW1iZXIodmFsdWUpKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH1cclxuICAgICAgICByZXN1bHQudW5zaWduZWQgPSB1bnNpZ25lZDtcclxuICAgICAgICByZXR1cm4gcmVzdWx0O1xyXG4gICAgfVxyXG5cclxuICAgIC8qKlxyXG4gICAgICogUmV0dXJucyBhIExvbmcgcmVwcmVzZW50YXRpb24gb2YgdGhlIGdpdmVuIHN0cmluZywgd3JpdHRlbiB1c2luZyB0aGUgc3BlY2lmaWVkIHJhZGl4LlxyXG4gICAgICogQGZ1bmN0aW9uXHJcbiAgICAgKiBAcGFyYW0ge3N0cmluZ30gc3RyIFRoZSB0ZXh0dWFsIHJlcHJlc2VudGF0aW9uIG9mIHRoZSBMb25nXHJcbiAg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9EQkwgKiBUV09fUFdSXzE2X0RCTDtcclxuXHJcbiAgICAvKipcclxuICAgICAqIEB0eXBlIHtudW1iZXJ9XHJcbiAgICAgKiBAY29uc3RcclxuICAgICAqIEBpbm5lclxyXG4gICAgICovXHJcbiAgICB2YXIgVFdPX1BXUl82NF9EQkwgPSBUV09fUFdSXzMyX0RCTCAqIFRXT19QV1JfMzJfREJMO1xyXG5cclxuICAgIC8qKlxyXG4gICAgICogQHR5cGUge251bWJlcn1cclxuICAgICAqIEBjb25zdFxyXG4gICAgICogQGlubmVyXHJcbiAgICAgKi9cclxuICAgIHZhciBUV09fUFdSXzYzX0RCTCA9IFRXT19QV1JfNjRfREJMIC8gMjtcclxuXHJcbiAgICAvKipcclxuICAgICAqIEB0eXBlIHshTG9uZ31cclxuICAgICAqIEBjb25zdFxyXG4gICAgICogQGlubmVyXHJcbiAgICAgKi9cclxuICAgIHZhciBUV09fUFdSXzI0ID0gZnJvbUludChUV09fUFdSXzI0X0RCTCk7XHJcblxyXG4gICAgLyoqXHJcbiAgICAgKiBAdHlwZSB7IUxvbmd9XHJcbiAgICAgKiBAaW5uZXJcclxuICAgICAqL1xyXG4gICAgdmFyIFpFUk8gPSBmcm9tSW50KDApO1xyXG5cclxuICAgIC8qKlxyXG4gICAgICogU2lnbmVkIHplcm8uXHJcbiAgICAgKiBAdHlwZSB7IUxvbmd9XHJcbiAgICAgKi9cclxuICAgIExvbmcuWkVSTyA9IFpFUk87XHJcblxyXG4gICAgLyoqXHJcbiAgICAgKiBAdHlwZSB7IUxvbmd9XHJcbiAgICAgKiBAaW5uZXJcclxuICAgICAqL1xyXG4gICAgdmFyIFVaRVJPID0gZnJvbUludCgwLCB0cnVlKTtcclxuXHJcbiAgICAvKipcclxuICAgICAqIFVuc2lnbmVkIHplcm8uXHJcbiAgICAgKiBAdHlwZSB7IUxvbmd9XHJcbiAgICAgKi9cclxuICAgIExvbmcuVVpFUk8gPSBVWkVSTztcclxuXHJcbiAgICAvKipcclxuICAgICAqIEB0eXBlIHshTG9uZ31cclxuICAgICAqIEBpbm5lclxyXG4gICAgICovXHJcbiAgICB2YXIgT05FID0gZnJvbUludCgxKTtcclxuXHJcbiAgICAvKipcclxuICAgICAqIFNpZ25lZCBvbmUuXHJcbiAgICAgKiBAdHlwZSB7IUxvbmd9XHJcbiAgICAgKi9cclxuICAgIExvbmcuT05FID0gT05FO1xyXG5cclxuICAgIC8qKlxyXG4gICAgICogQHR5cGUgeyFMb25nfVxyXG4gICAgICogQGlubmVyXHJcbiAgICAgKi9cclxuICAgIHZhciBVT05FID0gZnJvbUludCgxLCB0cnVlKTtcclxuXHJcbiAgICAvKipcclxuICAgICAqIFVuc2lnbmVkIG9uZS5cclxuICAgICAqIEB0eXBlIHshTG9uZ31cclxuICAgICAqL1xyXG4gICAgTG9uZy5VT05FID0gVU9ORTtcclxuXHJcbiAgICAvKipcclxuICAgICAqIEB0eXBlIHshTG9uZ31cclxuICAgICAqIEBpbm5lclxyXG4gICAgICovXHJcbiAgICB2YXIgTkVHX09ORSA9IGZyb21JbnQoLTEpO1xyXG5cclxuICAgIC8qKlxyXG4gICAgICogU2lnbmVkIG5lZ2F0aXZlIG9uZS5cclxuICAgICAqIEB0eXBlIHshTG9uZ31cclxuICAgICAqL1xyXG4gICAgTG9uZy5ORUdfT05FID0gTkVHX09ORTtcclxuXHJcbiAgICAvKipcclxuICAgICAqIEB0eXBlIHshTG9uZ31cclxuICAgICAqIEBpbm5lclxyXG4gICAgICovXHJcbiAgICB2YXIgTUFYX1ZBTFVFID0gZnJvbUJpdHMoMHhGRkZGRkZGRnwwLCAweDdGRkZGRkZGfDAsIGZhbHNlKTtcclxuXHJcbiAgICAvKipcclxuICAgICAqIE1heGltdW0gc2lnbmVkIHZhbHVlLlxyXG4gICAgICogQHR5cGUgeyFMb25nfVxyXG4gICAgICovXHJcbiAgICBMb25nLk1BWF9WQUxVRSA9IE1BWF9WQUxVRTtcclxuXHJcbiAgICAvKipcclxuICAgICAqIEB0eXBlIH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yB0byB0aGUgdmVyeSBleHBlbnNpdmUgZW11bGF0ZWQgZGl2LlxyXG4gICAgICAgIHZhciByYWRpeFRvUG93ZXIgPSBmcm9tTnVtYmVyKHBvd19kYmwocmFkaXgsIDYpLCB0aGlzLnVuc2lnbmVkKSxcclxuICAgICAgICAgICAgcmVtID0gdGhpcztcclxuICAgICAgICB2YXIgcmVzdWx0ID0gJyc7XHJcbiAgICAgICAgd2hpbGUgKHRydWUpIHtcclxuICAgICAgICAgICAgdmFyIHJlbURpdiA9IHJlbS5kaXYocmFkaXhUb1Bvd2VyKSxcclxuICAgICAgICAgICAgICAgIGludHZhbCA9IHJlbS5zdWIocmVtRGl2Lm11bChyYWRpeFRvUG93ZXIpKS50b0ludCgpID4+PiAwLFxyXG4gICAgICAgICAgICAgICAgZGlnaXRzID0gaW50dmFsLnRvU3RyaW5nKHJhZGl4KTtcclxuICAgICAgICAgICAgcmVtID0gcmVtRGl2O1xyXG4gICAgICAgICAgICBpZiAocmVtLmlzWmVybygpKVxyXG4gICAgICAgICAgICAgICAgcmV0dXJuIGRpZ2l0cyArIHJlc3VsdDtcclxuICAgICAgICAgICAgZWxzZSB7XHJcbiAgICAgICAgICAgICAgICB3aGlsZSAoZGlnaXRzLmxlbmd0aCA8IDYpXHJcbiAgICAgICAgICAgICAgICAgICAgZGlnaXRzID0gJzAnICsgZGlnaXRzO1xyXG4gICAgICAgICAgICAgICAgcmVzdWx0ID0gJycgKyBkaWdpdHMgKyByZXN1bHQ7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9XHJcbiAgICB9O1xyXG5cclxuICAgIC8qKlxyXG4gICAgICogR2V0cyB0aGUgaGlnaCAzMiBiaXRzIGFzIGEgc2lnbmVkIGludGVnZXIuXHJcbiAgICAgKiBAcmV0dXJucyB7bnVtYmVyfSBTaWduZWQgaGlnaCBiaXRzXHJcbiAgICAgKi9cclxuICAgIExvbmdQcm90b3R5cGUuZ2V0SGlnaEJpdHMgPSBmdW5jdGlvbiBnZ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VudCB0aGUgYWJzb2x1dGUgdmFsdWUgb2YgdGhpcyBMb25nLlxyXG4gICAgICogQHJldHVybnMge251bWJlcn1cclxuICAgICAqL1xyXG4gICAgTG9uZ1Byb3RvdHlwZS5nZXROdW1CaXRzQWJzID0gZnVuY3Rpb24gZ2V0TnVtQml0c0FicygpIHtcclxuICAgICAgICBpZiAodGhpcy5pc05lZ2F0aXZlKCkpIC8vIFVuc2lnbmVkIExvbmdzIGFyZSBuZXZlciBuZWdhdGl2ZVxyXG4gICAgICAgICAgICByZXR1cm4gdGhpcy5lcShNSU5fVkFMVUUpID8gNjQgOiB0aGlzLm5lZygpLmdldE51bUJpdHNBYnMoKTtcclxuICAgICAgICB2YXIgdmFsID0gdGhpcy5oaWdoICE9IDAgPyB0aGlzLmhpZ2ggOiB0aGlzLmxvdztcclxuICAgICAgICBmb3IgKHZhciBiaXQgPSAzMTsgYml0ID4gMDsgYml0LS0pXHJcbiAgICAgICAgICAgIGlmICgodmFsICYgKDEgPDwgYml0KSkgIT0gMClcclxuICAgICAgICAgICAgICAgIGJyZWFrO1xyXG4gICAgICAgIHJldHVybiB0aGlzLmhpZ2ggIT0gMCA/IGJpdCArIDMzIDogYml0ICsgMTtcclxuICAgIH07XHJcblxyXG4gICAgLyoqXHJcbiAgICAgKiBUZXN0cyBpZiB0aGlzIExvbmcncyB2YWx1ZSBlcXVhbHMgemVyby5cclxuICAgICAqIEByZXR1cm5zIHtib29sZWFufVxyXG4gICAgICovXHJcbiAgICBMb25nUHJvdG90eXBlLmlzWmVybyA9IGZ1bmN0aW9uIGlzWmVybygpIHtcclxuICAgICAgICByZXR1cm4gdGhpcy5oaWdoID09PSAwICYmIHRoaXMubG93ID09PSAwO1xyXG4gICAgfTtcclxuXHJcbiAgICAvKipcclxuICAgICAqIFRlc3RzIGlmIHRoaXMgTG9uZydzIHZhbHVlIGlzIG5lZ2F0aXZlLlxyXG4gICAgICogQHJldHVybnMge2Jvb2xlYW59XHJcbiAgICAgKi9cclxuICA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pXHJcbiAgICAgICAgICAgIHRocm93IEVycm9yKCdkaXZpc2lvbiBieSB6ZXJvJyk7XHJcbiAgICAgICAgaWYgKHRoaXMuaXNaZXJvKCkpXHJcbiAgICAgICAgICAgIHJldHVybiB0aGlzLnVuc2lnbmVkID8gVVpFUk8gOiBaRVJPO1xyXG4gICAgICAgIHZhciBhcHByb3gsIHJlbSwgcmVzO1xyXG4gICAgICAgIGlmICghdGhpcy51bnNpZ25lZCkge1xyXG4gICAgICAgICAgICAvLyBUaGlzIHNlY3Rpb24gaXMgb25seSByZWxldmFudCBmb3Igc2lnbmVkIGxvbmdzIGFuZCBpcyBkZXJpdmVkIGZyb20gdGhlXHJcbiAgICAgICAgICAgIC8vIGNsb3N1cmUgbGlicmFyeSBhcyBhIHdob2xlLlxyXG4gICAgICAgICAgICBpZiAodGhpcy5lcShNSU5fVkFMVUUpKSB7XHJcbiAgICAgICAgICAgICAgICBpZiAoZGl2aXNvci5lcShPTkUpIHx8IGRpdmlzb3IuZXEoTkVHX09ORSkpXHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE1JTl9WQUxVRTsgIC8vIHJlY2FsbCB0aGF0IC1NSU5fVkFMVUUgPT0gTUlOX1ZBTFVFXHJcbiAgICAgICAgICAgICAgICBlbHNlIGlmIChkaXZpc29yLmVxKE1JTl9WQUxVRSkpXHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9ORTtcclxuICAgICAgICAgICAgICAgIGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgIC8vIEF0IHRoaXMgcG9pbnQsIHdlIGhhdmUgfG90aGVyfCA+PSAyLCBzbyB8dGhpcy9vdGhlcnwgPCB8TUlOX1ZBTFVFfC5cclxuICAgICAgICAgICAgICAgICAgICB2YXIgaGFsZlRoaXMgPSB0aGlzLnNocigxKTtcclxuICAgICAgICAgICAgICAgICAgICBhcHByb3ggPSBoYWxmVGhpcy5kaXYoZGl2aXNvcikuc2hsKDEpO1xyXG4gICAgICAgICAgICAgICAgICAgIGlmIChhcHByb3guZXEoWkVSTykpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGRpdmlzb3IuaXNOZWdhdGl2ZSgpID8gT05FIDogTkVHX09ORTtcclxuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICByZW0gPSB0aGlzLnN1YihkaXZpc29yLm11bChhcHByb3gpKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmVzID0gYXBwcm94LmFkZChyZW0uZGl2KGRpdmlzb3IpKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHJlcztcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoZGl2aXNvci5lcShNSU5fVkFMVUUpKVxyXG4gICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMudW5zaWduZWQgPyBVWkVSTyA6IFpFUk87XHJcbiAgICAgICAgICAgIGlmICh0aGlzLmlzTmVnYXRpdmUoKSkge1xyXG4gICAgICAgICAgICAgICAgaWYgKGRpdmlzb3IuaXNOZWdhdGl2ZSgpKVxyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLm5lZygpLmRpdihkaXZpc29yLm5lZygpKTtcclxuICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLm5lZygpLmRpdihkaXZpc29yKS5uZWcoKTtcclxuICAgICAgICAgICAgfSBlbHNlIGlmIChkaXZpc29yLmlzTmVnYXRpdmUoKSlcclxuICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmRpdihkaXZpc29yLm5lZygpKS5uZWcoKTtcclxuICAgICAgICAgICAgcmVzID0gWkVSTztcclxuICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAvLyBUaGUgYWxnb3JpdGhtIGJlbG93IGhhcyBub3QgYmVlbiBtYWRlIGZvciB1bnNpZ25lZCBsb25ncy4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YXBwcm94UmVzLm11bChkaXZpc29yKTtcclxuICAgICAgICAgICAgd2hpbGUgKGFwcHJveFJlbS5pc05lZ2F0aXZlKCkgfHwgYXBwcm94UmVtLmd0KHJlbSkpIHtcclxuICAgICAgICAgICAgICAgIGFwcHJveCAtPSBkZWx0YTtcclxuICAgICAgICAgICAgICAgIGFwcHJveFJlcyA9IGZyb21OdW1iZXIoYXBwcm94LCB0aGlzLnVuc2lnbmVkKTtcclxuICAgICAgICAgICAgICAgIGFwcHJveFJlbSA9IGFwcHJveFJlcy5tdWwoZGl2aXNvcik7XHJcbiAgICAgICAgICAgIH1cclxuXHJcbiAgICAgICAgICAgIC8vIFdlIGtub3cgdGhlIGFuc3dlciBjYW4ndCBiZSB6ZXJvLi4uIGFuZCBhY3R1YWxseSwgemVybyB3b3VsZCBjYXVzZVxyXG4gICAgICAgICAgICAvLyBpbmZpbml0ZSByZWN1cnNpb24gc2luY2Ugd2Ugd291bGQgbWFrZSBubyBwcm9ncmVzcy5cclxuICAgICAgICAgICAgaWYgKGFwcHJveFJlcy5pc1plcm8oKSlcclxuICAgICAgICAgICAgICAgIGFwcHJveFJlcyA9IE9ORTtcclxuXHJcbiAgICAgICAgICAgIHJlcyA9IHJlcy5hZGQoYXBwcm94UmVzKTtcclxuICAgICAgICAgICAgcmVtID0gcmVtLnN1YihhcHByb3hSZW0pO1xyXG4gICAgICAgIH1cclxuICAgICAgICByZXR1cm4gcmVzO1xyXG4gICAgfTtcclxuXHJcbiAgICAvKipcclxuICAgICAqIFJldHVybnMgdGhpcyBMb25nIGRpdmlkZWQgYnkgdGhlIHNwZWNpZmllZC4gVGhpcyBpcyBhbiBhbGlhcyBvZiB7QGxpbmsgTG9uZyNkaXZpZGV9LlxyXG4gICAgICogQGZ1bmN0aW9uXHJcbiAgICAgKiBAcGFyYW0geyFMb25nfG51bWJlcnxzdHJpbmd9IGRpdmlzb3IgRGl2aXNvclxyXG4gICAgICogQHJldHVybnMgeyFMb25nfSBRdW90aWVudFx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iAodGhpcy51bnNpZ25lZClcclxuICAgICAgICAgICAgcmV0dXJuIHRoaXM7XHJcbiAgICAgICAgcmV0dXJuIGZyb21CaXRzKHRoaXMubG93LCB0aGlzLmhpZ2gsIHRydWUpO1xyXG4gICAgfTtcclxuXHJcbiAgICAvKipcclxuICAgICAqIENvbnZlcnRzIHRoaXMgTG9uZyB0byBpdHMgYnl0ZSByZXByZXNlbnRhdGlvbi5cclxuICAgICAqIEBwYXJhbSB7Ym9vbGVhbj19IGxlIFdoZXRoZXIgbGl0dGxlIG9yIGJpZyBlbmRpYW4sIGRlZmF1bHRzIHRvIGJpZyBlbmRpYW5cclxuICAgICAqIEByZXR1cm5zIHshQXJyYXkuPG51bWJlcj59IEJ5dGUgcmVwcmVzZW50YXRpb25cclxuICAgICAqL1xyXG4gICAgTG9uZ1Byb3RvdHlwZS50b0J5dGVzID0gZnVuY3Rpb24obGUpIHtcclxuICAgICAgICByZXR1cm4gbGUgPyB0aGlzLnRvQnl0ZXNMRSgpIDogdGhpcy50b0J5dGVzQkUoKTtcclxuICAgIH1cclxuXHJcbiAgICAvKipcclxuICAgICAqIENvbnZlcnRzIHRoaXMgTG9uZyB0byBpdHMgbGl0dGxlIGVuZGlhbiBieXRlIHJlcHJlc2VudGF0aW9uLlxyXG4gICAgICogQHJldHVybnMgeyFBcnJheS48bnVtYmVyPn0gTGl0dGxlIGVuZGlhbiBieXRlIHJlcHJlc2VudGF0aW9uXHJcbiAgICAgKi9cclxuICAgIExvbmdQcm90b3R5cGUudG9CeXRlc0xFID0gZnVuY3Rpb24oKSB7XHJcbiAgICAgICAgdmFyIGhpID0gdGhpcy5oaWdoLFxyXG4gICAgICAgICAgICBsbyA9IHRoaXMubG93O1xyXG4gICAgICAgIHJldHVybiBbXHJcbiAgICAgICAgICAgICBsbyAgICAgICAgICYgMHhmZixcclxuICAgICAgICAgICAgKGxvID4+PiAgOCkgJiAweGZmLFxyXG4gICAgICAgICAgICAobG8gPj4+IDE2KSAmIDB4ZmYsXHJcbiAgICAgICAgICAgIChsbyA+Pj4gMjQpICYgMHhmZixcclxuICAgICAgICAgICAgIGhpICAgICAgICAgJiAweGZmLFxyXG4gICAgICAgICAgICAoaGkgPj4+ICA4KSAmIDB4ZmYsXHJcbiAgICAgICAgICAgIChoaSA+Pj4gMTYpICYgMHhmZixcclxuICAgICAgICAgICAgKGhpID4+PiAyNCkgJiAweGZmXHJcbiAgICAgICAgXTtcclxuICAgIH1cclxuXHJcbiAgICAvKipcclxuICAgICAqIENvbnZlcnRzIHRoaXMgTG9uZyB0byBpdHMgYmlnIGVuZGlhbiBieXRlIHJlcHJlc2VudGF0aW9uLlxyXG4gICAgICogQHJldHVybnMgeyFBcnJheS48bnVtYmVyPn0gQmlnIGVuZGlhbiBieXRlIHJlcHJlc2VudGF0aW9uXHJcbiAgICAgKi9cclxuICAgIExvbmdQcm90b3R5cGUudG9CeXRlc0JFID0gZnVuY3Rpb24oKSB7XHJcbiAgICAgICAgdmFyIGhpID0gdGhpcy5oaWdoLFxyXG4gICAgICAgICAgICBsbyA9IHRoaXMubG93O1xyXG4gICAgICAgIHJldHVybiBbXHJcbiAgICAgICAgICAgIChoaSA+Pj4gMjQpICYgMHhmZixcclxuICAgICAgICAgICAgKGhpID4+PiAxNikgJiAweGZmLFxyXG4gICAgICAgICAgICAoaGkgPj4+ICA4KSAmIDB4ZmYsXHJcbiAgICAgICAgICAgICBoaSAgICAgICAgICYgMHhmZixcclxuICAgICAgICAgICAgKGxvID4+PiAyNCkgJiAweGZmLFxyXG4gICAgICAgICAgICAobG8gPj4+IDE2KSAmIDB4ZmYsXHJcbiAgICAgICAgICAgIChsbyA+Pj4gIDgpICYgMHhmZixcclxuICAgICAgICAgICAgIGxvICAgICAgICAgJiAweGZmXHJcbiAgICAgICAgXTtcclxuICAgIH1cclxuXHJcbiAgICByZXR1cm4gTG9uZztcclxufSk7XHJcbiIsIi8qXG5vYmplY3QtYXNzaWduXG4oYykgU2luZHJlIFNvcmh1c1xuQGxpY2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gICAgICAgICAgICByZXR1cm4gYml0cztcbiAgICAgICAgfVxuICAgICAgICAvLyA0dGhcbiAgICAgICAgYml0cy5sbyA9IChiaXRzLmxvIHwgKHRoaXMuYnVmW3RoaXMucG9zKytdICYgMTI3KSA8PCBpICogNykgPj4+IDA7XG4gICAgICAgIHJldHVybiBiaXRzO1xuICAgIH1cbiAgICBpZiAodGhpcy5sZW4gLSB0aGlzLnBvcyA+IDQpIHsgLy8gZmFzdCByb3V0ZSAoaGkpXG4gICAgICAgIGZvciAoOyBpIDwgNTsgKytpKSB7XG4gICAgICAgICAgICAvLyA2dGguLjEwdGhcbiAgICAgICAgICAgIGJpdHMuaGkgPSAoYml0cy5oaSB8ICh0aGlzLmJ1Zlt0aGlzLnBvc10gJiAxMjcpIDw8IGkgKiA3ICsgMykgPj4+IDA7XG4gICAgICAgICAgICBpZiAodGhpcy5idWZbdGhpcy5wb3MrK10gPCAxMjgpXG4gICAgICAgICAgICAgICAgcmV0dXJuIGJpdHM7XG4gICAgICAgIH1cbiAgICB9IGVsc2Uge1xuICAgICAgICBmb3IgKDsgaSA8IDU7ICsraSkge1xuICAgICAgICAgICAgLyogaXN0YW5idWwgaWdub3JlIGlmICovXG4gICAgICAgICAgICBpZiAodGhpcy5wb3MgPj0gdGhpcy5sZW4pXG4gICAgICAgICAgICAgICAgdGhyb3cgaW5kZXhPdXRPZlJhbmdlKHRoaXMpO1xuICAgICAgICAgICAgLy8gNnRoLi4xMHRoXG4gICAgICAgICAgICBiaXRzLmhpID0gKGJpdHMuaGkgfCAodGhpcy5idWZbdGhpcy5wb3NdICYgMTI3KSA8PCBpICogNyArIDMpID4+PiAwO1xuICAgICAgICAgICAgaWYgKHRoaXMuYnVmW3RoaXMucG9zKytdIDwgMTI4KVxuICAgICAgICAgICAgICAgIHJldHVybiBiaXRzO1xuICAgICAgICB9XG4gICAgfVxuICAgIC8qIGlzdGFuYnVsIGlnbm9yZSBuZXh0ICovXG4gICAgdGhyb3cgRXJyb3IoXCJp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lcXVlc3RDdG9yLCByZXNwb25zZUN0b3IsIHJlcXVlc3QpO1xuXG4gICAgaWYgKCFzZWxmLnJwY0ltcGwpIHtcbiAgICAgICAgc2V0VGltZW91dChmdW5jdGlvbigpIHsgY2FsbGJhY2soRXJyb3IoXCJhbHJlYWR5IGVuZGVkXCIpKTsgfSwgMCk7XG4gICAgICAgIHJldHVybiB1bmRlZmluZWQ7XG4gICAgfVxuXG4gICAgdHJ5IHtcbiAgICAgICAgcmV0dXJuIHNlbGYucnBjSW1wbChcbiAgICAgICAgICAgIG1ldGhvZCxcbiAgICAgICAgICAgIHJlcXVlc3RDdG9yW3NlbGYucmVxdWVzdERlbGltaXRlZCA/IFwiZW5jb2RlRGVsaW1pdGVkXCIgOiBcImVuY29kZVwiXShyZXF1ZXN0KS5maW5pc2goKSxcbiAgICAgICAgICAgIGZ1bmN0aW9uIHJwY0NhbGxiYWNrKGVyciwgcmVzcG9uc2UpIHtcblxuICAgICAgICAgICAgICAgIGlmIChlcnIpIHtcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5lbWl0KFwiZXJyb3JcIiwgZXJyLCBtZXRob2QpO1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gY2FsbGJhY2soZXJyKTtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBpZiAocmVzcG9uc2UgPT09IG51bGwpIHtcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5lbmQoLyogZW5kZWRCeVJQQyAqLyB0cnVlKTtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHVuZGVmaW5lZDtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBpZiAoIShyZXNwb25zZSBpbnN0YW5jZW9mIHJlc3BvbnNlQ3RvcikpIHtcbiAgICAgICAgICAgICAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlc3BvbnNlID0gcmVzcG9uc2VDdG9yW3NlbGYucmVzcG9uc2VEZWxpb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gICAgICAgICAgaWYgKHN0YXRlID09PSBHZW5TdGF0ZVN1c3BlbmRlZFN0YXJ0KSB7XG4gICAgICAgICAgICBzdGF0ZSA9IEdlblN0YXRlQ29tcGxldGVkO1xuICAgICAgICAgICAgdGhyb3cgY29udGV4dC5hcmc7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgY29udGV4dC5kaXNwYXRjaEV4Y2VwdGlvbihjb250ZXh0LmFyZyk7XG5cbiAgICAgICAgfSBlbHNlIGlmIChjb250ZXh0Lm1ldGhvZCA9PT0gXCJyZXR1cm5cIikge1xuICAgICAgICAgIGNvbnRleHQuYWJydXB0KFwicmV0dXJuXCIsIGNvbnRleHQuYXJnKTtcbiAgICAgICAgfVxuXG4gICAgICAgIHN0YXRlID0gR2VuU3RhdGVFeGVjdXRpbmc7XG5cbiAgICAgICAgdmFyIHJlY29yZCA9IHRyeUNhdGNoKGlubmVyRm4sIHNlbGYsIGNvbnRleHQpO1xuICAgICAgICBpZiAocmVjb3JkLnR5cGUgPT09IFwibm9ybWFsXCIpIHtcbiAgICAgICAgICAvLyBJZiBhbiBleGNlcHRpb24gaXMgdGhyb3duIGZyb20gaW5uZXJGbiwgd2UgbGVhdmUgc3RhdGUgPT09XG4gICAgICAgICAgLy8gR2VuU3RhdGVFeGVjdXRpbmcgYW5kIGxvb3AgYmFjayBmb3IgYW5vdGhlciBpbnZvY2F0aW9uLlxuICAgICAgICAgIHN0YXRlID0gY29udGV4dC5kb25lXG4gICAgICAgICAgICA/IEdlblN0YXRlQ29tcGxldGVkXG4gICAgICAgICAgICA6IEdlblN0YXRlU3VzcGVuZGVkWWllbGQ7XG5cbiAgICAgICAgICBpZiAocmVjb3JkLmFyZyA9PT0gQ29udGludWVTZW50aW5lbCkge1xuICAgICAgICAgICAgY29udGludWU7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgIHZhbHVlOiByZWNvcmQuYXJnLFxuICAgICAgICAgICAgZG9uZTogY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cbiAgZnVuY3Rpb24gdmFsdWVzKGl0ZXJhYmxlKSB7XG4gICAgaWYgKGl0ZXJhYmxlKSB7XG4gICAgICB2YXIgaXRlcmF0b3JNZXRob2QgPSBpdGVyYWJsZVtpdGVyYXRvclN5bWJvbF07XG4gICAgICBpZiAoaXRlcmF0b3JNZXRob2QpIHtcbiAgICAgICAgcmV0dXJuIGl0ZXJhdG9yTWV0aG9kLmNhbGwoaXRlcmFibGUpO1xuICAgICAgfVxuXG4gICAgICBpZiAodHlwZW9mIGl0ZXJhYmxlLm5leHQgPT09IFwiZnVuY3Rpb25cIikge1xuICAgICAgICByZXR1cm4gaXRlcmFibGU7XG4gICAgICB9XG5cbiAgICAgIGlmICghaXNOYU4oaXRlcmFibGUubGVuZ3RoKSkge1xuICAgICAgICB2YXIgaSA9IC0xLCBuZXh0ID0gZnVuY3Rpb24gbmV4dCgpIHtcbiAgICAgICAgICB3aGlsZSAoKytpIDwgaXRlcmFibGUubGVuZ3RoKSB7XG4gICAgICAgICAgICBpZiAoaGFzT3duLmNhbGwoaXRlcmFibGUsIGkpKSB7XG4gICAgICAgICAgICAgIG5leHQudmFsdWUgPSBpdGVyYWJsZVtpXTtcbiAgICAgICAgICAgICAgbmV4dC5kb25lID0gZmFsc2U7XG4gICAgICAgICAgICAgIHJldHVybiBuZXh0O1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cblxuICAgICAgICAgIG5leHQudmFsdWUgPSB1bmRlZmluZWQ7XG4gICAgICAgICAgbmV4dC5kb25lID0gdHJ1ZTtcblxuICAgICAgICAgIHJldHVybiBuZXh0O1xuICAgICAgICB9O1xuXG4gICAgICAgIHJldHVybiBuZXh0Lm5leHQgPSBuZXh0O1xuICAgICAgfVxuICAgIH1cblxuICAgIC8vIFJldHVybiBhbiBpdGVyYXRvciB3aXRoIG5vIHZhbHVlcy5cbiAgICByZXR1cm4geyBuZXh0OiBkb25lUmVzdWx0IH07XG4gIH1cbiAgZXhwb3J0cy52YWx1ZXMgPS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VmaW5lZDtcbiAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICB9LFxuXG4gICAgc3RvcDogZnVuY3Rpb24oKSB7XG4gICAgICB0aGlzLmRvbmUgPSB0cnVlO1xuXG4gICAgICB2YXIgcm9vdEVudHJ5ID0gdGhpcy50cnlFbnRyaWVzWzBdO1xuICAgICAgdmFyIHJvb3RSZWNvcmQgPSByb290RW50cnkuY29tcGxldGlvbjtcbiAgICAgIGlmIChyb290UmVjb3JkLnR5cGUgPT09IFwidGhyb3dcIikge1xuICAgICAgICB0aHJvdyByb290UmVjb3JkLmFyZztcbiAgICAgIH1cblxuICAgICAgcmV0dXJuIHRoaXMucnZhbDtcbiAgICB9LFxuXG4gICAgZGlzcGF0Y2hFeGNlcHRpb246IGZ1bmN0aW9uKGV4Y2VwdGlvbikge1xuICAgICAgaWYgKHRoaXMuZG9uZSkge1xuICAgICAgICB0aHJvdyBleGNlcHRpb247XG4gICAgICB9XG5cbiAgICAgIHZhciBjb250ZXh0ID0gdGhpcztcbiAgICAgIGZ1bmN0aW9uIGhhbmRsZShsb2MsIGNhdWdodCkge1xuICAgICAgICByZWNvcmQudHlwZSA9IFwidGhyb3dcIjtcbiAgICAgICAgcmVjb3JkLmFyZyA9IGV4Y2VwdGlvbjtcbiAgICAgICAgY29udGV4dC5uZXh0ID0gbG9jO1xuXG4gICAgICAgIGlmIChjYXVnaHQpIHtcbiAgICAgICAgICAvLyBJZiB0aGUgZGlzcGF0Y2hlZCBleGNlcHRpb24gd2FzIGNhdWdodCBieSBhIGNhdGNoIGJsb2NrLFxuICAgICAgICAgIC8vIHRoZW4gbGV0IHRoYXQgY2F0Y2ggYmxvY2sgaGFuZGxlIHRoZSBleGNlcHRpb24gbm9ybWFsbHkuXG4gICAgICAgICAgY29udGV4dC5tZXRob2QgPSBcIm5leHRcIjtcbiAgICAgICAgICBjb250ZXh0LmFyZyA9IHVuZGVmaW5lZDtcbiAgICAgICAgfVxuXG4gICAgICAgIHJld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ZW50cnkuZmluYWxseUxvYyk7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICB9IGVsc2UgaWYgKGhhc0NhdGNoKSB7XG4gICAgICAgICAgICBpZiAodGhpcy5wcmV2IDwgZW50cnkuY2F0Y2hMb2MpIHtcbiAgICAgICAgICAgICAgcmV0dXJuIGhhbmRsZShlbnRyeS5jYXRjaExvYywgdHJ1ZSk7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICB9IGVsc2UgaWYgKGhhc0ZpbmFsbHkpIHtcbiAgICAgICAgICAgIGlmICh0aGlzLnByZXYgPCBlbnRyeS5maW5hbGx5TG9jKSB7XG4gICAgICAgICAgICAgIHJldHVybiBoYW5kbGUoZW50cnkuZmluYWxseUxvYyk7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFwidHJ5IHN0YXRlbWVudCB3aXRob3V0IGNhdGNoIG9yIGZpbmFsbHlcIik7XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICB9XG4gICAgfSxcblxuICAgIGFicnVwdDogZnVuY3Rpb24odHlwZSwgYXJnKSB7XG4gICAgICBmb3IgKHZhciBpID0gdGhpcy50cnlFbnRyaWVzLmxlbmd0aCAtIDE7IGkgPj0gMDsgLS1pKSB7XG4gICAgICAgIHZhciBlbnRyeSA9IHRoaXMudHJ5RW50cmllc1tpXTtcbiAgICAgICAgaWYgKGVudHJ5LnRyeUxvYyA8PSB0aGlzLnByZXYgJiZcbiAgICAgICAgICAgIGhhc093bi5jYWxsKGVudHJ5LCBcImZpbmFsbHlMb2NcIikgJiZcbiAgICAgICAgICAgIHRoaXMucHJldiA8IGVudHJ5LmZpbmFsbHlMb2MpIHtcbiAgICAgICAgICB2YXIgZmluYWxseUVudHJ5ID0gZW50cnk7XG4gICAgICAgICAgYnJlYWs7XG4gICAgICAgIH1cbiAgICAgIH1cblxuICAgICAgaWYgKGZpbmFsbHlFbnRyeSAmJlxuICAgICAgICAgICh0eXBlID09PSBcImJyZWFrXCIgfHxcbiAgICAgICAgICAgdHlwZSA9PT0gXCJjb250aW51ZVwiKSAmJlxuICAgICAgICAgIGZpbmFsbHlFbnRyeS50cnlMb2MgPD0gYXJnICYmXG4gICAgICAgICAgYXJnIDw9IGZpbmFsbHlFbnRyeS5maW5hbGx5TG9jKSB7XG4gICAgICAgIC8vIElnbm9yZSB0aGUgZmluYWxseSBlbnRyeSBpZiBjb250cm9sIGlzIG5vdCBqdW1waW5nIHRvIGFcbiAgICAgICAgLy8gbG9jYXRpb24gb3V0c2lkZSB0aGUgdHJ5L2NhdGNoIGJsb2NrLlxuICAgICAgICBmaW5hbGx5RW50cnkgPSBudWxsO1xuICAgICAgfVxuXG4gICAgICB2YXIgcmVjb3JkID0gZmluYWxseUVudHJ5ID8gZmluYWxseUVudHJ5LmNvbXBsZXRpb24gOiB7fTtcbiAgICAgIHJlY29yZC50eXBlID0gdHlwZTtcbiAgICAgIHJlY29yZC5hcmcgPSBhcmc7XG5cbiAgICAgIGlmIChmaW5hbGx5RW50cnkpIHtcbiAgICAgICAgdGhpcy5tZXRob2QgPSBcIm5leHRcIjtcbiAgICAgICAgdGhpcy5uZXh0ID0gZmluYWxseUVudHJ5LmZpbmFsbHlMb2M7XG4gICAgICAgIHJldHVybiBDb250aW51ZVNlbnRpbmVsO1xuICAgICAgfVxuXG4gICAgICByZXR1cm4gdGhpcy5jb21wbGV0ZShyZWNvcmQpO1xuICAgIH0sXG5cbiAgICBjb21wbGV0ZTogZnVuY3Rpb24ocmVjb3JkLCBhZnRlckxvYykge1xuICAgICAgaWYgKHJlY29yZC50eXBlID09PSBcInRocm93XCIpIHtcbiAgICAgICAgdGhyb3cgcmVjb3JkLmFyZztcbiAgICAgIH1cblxuICAgICAgaWYgKHJlY29yZC50eXBlID09PSBcImJyZWFrXCIgfHxcbiAgICAgICAgICByZWNvcmQudHlwZSA9PT0gXCJjb250aW51ZVwiKSB7XG4gICAgICAgIHRoaXMubmV4dCA9IHJlY29yZC5hcmc7XG4gICAgICB9IGVsc2UgaWYgKHJlY29yZC50eXBlID09PSBcInJldHVyblwiKSB7XG4gICAgICAgIHRoaXMucnZhbCA9IHRoaXMuYXJnID0gcmVjb3JkLmFyZztcbiAgICAgICAgdGhpcy5tZXRob2QgPSBcInJldHVyblwiO1xuICAgICAgICB0aGlzLm5leHQgPSBcImVuZFwiO1xuICAgICAgfSBlbHNlIGlmIChyZWNvcmQudHlwZSA9PT0gXCJub3JtYWxcIiAmJiBhZnRlckxvYykge1xuICAgICAgICB0aGlzLm5leHQgPSBhZnRlckxvYztcbiAgICAgIH1cblxuICAgICAgcmV0dXJuIENvbnRpbnVlU2VudGluZWw7XG4gICAgfSxcblxuICAgIGZpbmlzaDogZnVuY3Rpb24oZmluYWxseUxvYykge1xuICAgICAgZm9yICh2YXIgaSA9IHRoaXMudHJ5RW50cmllcy5sZW5ndGggLSAxOyBpID49IDA7IC0taSkge1xuICAgICAgICB2YXIgZW50cnkgPSB0aGlzLnRyeUVudHJpZXNbaV07XG4gICAgICAgIGlmIChlbnRyeS5maW5hbGx5TG9jID09PSBmaW5hbGx5TG9jKSB7XG4gICAgICAgICAgdGhpcy5jb21wbGV0ZShlbnRyeS5jb21wbGV0aW9uLCBlbnRyeS5hZnRlckxvYyk7XG4gICAgICAgICAgcmVzZXRUcnlFbnRyeShlbnRyeSk7XG4gICAgICAgICAgcmV0dXJuIENvbnRpbnVlU2VudGluZWw7XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICB9LFxuXG4gICAgXCJjYXRjaFwiOiBmdW5jdGlvbih0cnlMb2MpIHtcbiAgICAgIGZvciAodmFyIGkgPSB0aGlzLnRyeUVudHJpZXMubGVuZ3RoIC0gMTsgaSA+PSAwOyAtLWkpIHtcbiAgICAgICAgdmFyIGVudHJ5ID0gdGhpcy50cnlFbnRyaWVzW2ldO1xuICAgICAgICBpZiAoZW50cnkudHJ5TG9jID09PSB0cnlMb2MpIHtcbi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V4dEltbWVkaWF0ZUlkKys7XG4gIHZhciBhcmdzID0gYXJndW1lbnRzLmxlbmd0aCA8IDIgPyBmYWxzZSA6IHNsaWNlLmNhbGwoYXJndW1lbnRzLCAxKTtcblxuICBpbW1lZGlhdGVJZHNbaWRdID0gdHJ1ZTtcblxuICBuZXh0VGljayhmdW5jdGlvbiBvbk5leHRUaWNrKCkge1xuICAgIGlmIChpbW1lZGlhdGVJZHNbaWRdKSB7XG4gICAgICAvLyBmbi5jYWxsKCkgaXMgZmFzdGVyIHNvIHdlIG9wdGltaXplIGZvciB0aGUgY29tbW9uIHVzZS1jYXNlXG4gICAgICAvLyBAc2VlIGh0dHA6Ly9qc3BlcmYuY29tL2NhbGwtYXBwbHktc2VndVxuICAgICAgaWYgKGFyZ3MpIHtcbiAgICAgICAgZm4uYXBwbHkobnVsbCwgYXJncyk7XG4gICAgICB9IGVsc2Uge1xuICAgICAgICBmbi5jYWxsKG51bGwpO1xuICAgICAgfVxuICAgICAgLy8gUHJldmVudCBpZHMgZnJvbSBsZWFraW5nXG4gICAgICBleHBvcnRzLmNsZWFySW1tZWRpYXRlKGlkKTtcbiAgICB9XG4gIH0pO1xuXG4gIHJldHVybiBpZDtcbn07XG5cbmV4cG9ydHMuY2xlYXJJbW1lZGlhdGUgPSB0eXBlb2YgY2xlYXJJbW1lZGlhdGUgPT09IFwiZnVuY3Rpb25cIiA/IGNsZWFySW1tZWRpYXRlIDogZnVuY3Rpb24oaWQpIHtcbiAgZGVsZXRlIGltbWVkaWF0ZUlkc1tpZF07XG59OyJdfQ== +},{"process/browser.js":714,"timers":752}],753:[function(require,module,exports){ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +'use strict'; + +var punycode = require('punycode'); +var util = require('./util'); + +exports.parse = urlParse; +exports.resolve = urlResolve; +exports.resolveObject = urlResolveObject; +exports.format = urlFormat; + +exports.Url = Url; + +function Url() { + this.protocol = null; + this.slashes = null; + this.auth = null; + this.host = null; + this.port = null; + this.hostname = null; + this.hash = null; + this.search = null; + this.query = null; + this.pathname = null; + this.path = null; + this.href = null; +} + +// Reference: RFC 3986, RFC 1808, RFC 2396 + +// define these here so at least they only have to be +// compiled once on the first module load. +var protocolPattern = /^([a-z0-9.+-]+:)/i, + portPattern = /:[0-9]*$/, + + // Special case for a simple path URL + simplePathPattern = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/, + + // RFC 2396: characters reserved for delimiting URLs. + // We actually just auto-escape these. + delims = ['<', '>', '"', '`', ' ', '\r', '\n', '\t'], + + // RFC 2396: characters not allowed for various reasons. + unwise = ['{', '}', '|', '\\', '^', '`'].concat(delims), + + // Allowed by RFCs, but cause of XSS attacks. Always escape these. + autoEscape = ['\''].concat(unwise), + // Characters that are never ever allowed in a hostname. + // Note that any invalid chars are also handled, but these + // are the ones that are *expected* to be seen, so we fast-path + // them. + nonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape), + hostEndingChars = ['/', '?', '#'], + hostnameMaxLen = 255, + hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/, + hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/, + // protocols that can allow "unsafe" and "unwise" chars. + unsafeProtocol = { + 'javascript': true, + 'javascript:': true + }, + // protocols that never have a hostname. + hostlessProtocol = { + 'javascript': true, + 'javascript:': true + }, + // protocols that always contain a // bit. + slashedProtocol = { + 'http': true, + 'https': true, + 'ftp': true, + 'gopher': true, + 'file': true, + 'http:': true, + 'https:': true, + 'ftp:': true, + 'gopher:': true, + 'file:': true + }, + querystring = require('querystring'); + +function urlParse(url, parseQueryString, slashesDenoteHost) { + if (url && util.isObject(url) && url instanceof Url) return url; + + var u = new Url; + u.parse(url, parseQueryString, slashesDenoteHost); + return u; +} + +Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) { + if (!util.isString(url)) { + throw new TypeError("Parameter 'url' must be a string, not " + typeof url); + } + + // Copy chrome, IE, opera backslash-handling behavior. + // Back slashes before the query string get converted to forward slashes + // See: https://code.google.com/p/chromium/issues/detail?id=25916 + var queryIndex = url.indexOf('?'), + splitter = + (queryIndex !== -1 && queryIndex < url.indexOf('#')) ? '?' : '#', + uSplit = url.split(splitter), + slashRegex = /\\/g; + uSplit[0] = uSplit[0].replace(slashRegex, '/'); + url = uSplit.join(splitter); + + var rest = url; + + // trim before proceeding. + // This is to support parse stuff like " http://foo.com \n" + rest = rest.trim(); + + if (!slashesDenoteHost && url.split('#').length === 1) { + // Try fast path regexp + var simplePath = simplePathPattern.exec(rest); + if (simplePath) { + this.path = rest; + this.href = rest; + this.pathname = simplePath[1]; + if (simplePath[2]) { + this.search = simplePath[2]; + if (parseQueryString) { + this.query = querystring.parse(this.search.substr(1)); + } else { + this.query = this.search.substr(1); + } + } else if (parseQueryString) { + this.search = ''; + this.query = {}; + } + return this; + } + } + + var proto = protocolPattern.exec(rest); + if (proto) { + proto = proto[0]; + var lowerProto = proto.toLowerCase(); + this.protocol = lowerProto; + rest = rest.substr(proto.length); + } + + // figure out if it's got a host + // user@server is *always* interpreted as a hostname, and url + // resolution will treat //foo/bar as host=foo,path=bar because that's + // how the browser resolves relative URLs. + if (slashesDenoteHost || proto || rest.match(/^\/\/[^@\/]+@[^@\/]+/)) { + var slashes = rest.substr(0, 2) === '//'; + if (slashes && !(proto && hostlessProtocol[proto])) { + rest = rest.substr(2); + this.slashes = true; + } + } + + if (!hostlessProtocol[proto] && + (slashes || (proto && !slashedProtocol[proto]))) { + + // there's a hostname. + // the first instance of /, ?, ;, or # ends the host. + // + // If there is an @ in the hostname, then non-host chars *are* allowed + // to the left of the last @ sign, unless some host-ending character + // comes *before* the @-sign. + // URLs are obnoxious. + // + // ex: + // http://a@b@c/ => user:a@b host:c + // http://a@b?@c => user:a host:c path:/?@c + + // v0.12 TODO(isaacs): This is not quite how Chrome does things. + // Review our test case against browsers more comprehensively. + + // find the first instance of any hostEndingChars + var hostEnd = -1; + for (var i = 0; i < hostEndingChars.length; i++) { + var hec = rest.indexOf(hostEndingChars[i]); + if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) + hostEnd = hec; + } + + // at this point, either we have an explicit point where the + // auth portion cannot go past, or the last @ char is the decider. + var auth, atSign; + if (hostEnd === -1) { + // atSign can be anywhere. + atSign = rest.lastIndexOf('@'); + } else { + // atSign must be in auth portion. + // http://a@b/c@d => host:b auth:a path:/c@d + atSign = rest.lastIndexOf('@', hostEnd); + } + + // Now we have a portion which is definitely the auth. + // Pull that off. + if (atSign !== -1) { + auth = rest.slice(0, atSign); + rest = rest.slice(atSign + 1); + this.auth = decodeURIComponent(auth); + } + + // the host is the remaining to the left of the first non-host char + hostEnd = -1; + for (var i = 0; i < nonHostChars.length; i++) { + var hec = rest.indexOf(nonHostChars[i]); + if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) + hostEnd = hec; + } + // if we still have not hit it, then the entire thing is a host. + if (hostEnd === -1) + hostEnd = rest.length; + + this.host = rest.slice(0, hostEnd); + rest = rest.slice(hostEnd); + + // pull out port. + this.parseHost(); + + // we've indicated that there is a hostname, + // so even if it's empty, it has to be present. + this.hostname = this.hostname || ''; + + // if hostname begins with [ and ends with ] + // assume that it's an IPv6 address. + var ipv6Hostname = this.hostname[0] === '[' && + this.hostname[this.hostname.length - 1] === ']'; + + // validate a little. + if (!ipv6Hostname) { + var hostparts = this.hostname.split(/\./); + for (var i = 0, l = hostparts.length; i < l; i++) { + var part = hostparts[i]; + if (!part) continue; + if (!part.match(hostnamePartPattern)) { + var newpart = ''; + for (var j = 0, k = part.length; j < k; j++) { + if (part.charCodeAt(j) > 127) { + // we replace non-ASCII char with a temporary placeholder + // we need this to make sure size of hostname is not + // broken by replacing non-ASCII by nothing + newpart += 'x'; + } else { + newpart += part[j]; + } + } + // we test again with ASCII char only + if (!newpart.match(hostnamePartPattern)) { + var validParts = hostparts.slice(0, i); + var notHost = hostparts.slice(i + 1); + var bit = part.match(hostnamePartStart); + if (bit) { + validParts.push(bit[1]); + notHost.unshift(bit[2]); + } + if (notHost.length) { + rest = '/' + notHost.join('.') + rest; + } + this.hostname = validParts.join('.'); + break; + } + } + } + } + + if (this.hostname.length > hostnameMaxLen) { + this.hostname = ''; + } else { + // hostnames are always lower case. + this.hostname = this.hostname.toLowerCase(); + } + + if (!ipv6Hostname) { + // IDNA Support: Returns a punycoded representation of "domain". + // It only converts parts of the domain name that + // have non-ASCII characters, i.e. it doesn't matter if + // you call it with a domain that already is ASCII-only. + this.hostname = punycode.toASCII(this.hostname); + } + + var p = this.port ? ':' + this.port : ''; + var h = this.hostname || ''; + this.host = h + p; + this.href += this.host; + + // strip [ and ] from the hostname + // the host field still retains them, though + if (ipv6Hostname) { + this.hostname = this.hostname.substr(1, this.hostname.length - 2); + if (rest[0] !== '/') { + rest = '/' + rest; + } + } + } + + // now rest is set to the post-host stuff. + // chop off any delim chars. + if (!unsafeProtocol[lowerProto]) { + + // First, make 100% sure that any "autoEscape" chars get + // escaped, even if encodeURIComponent doesn't think they + // need to be. + for (var i = 0, l = autoEscape.length; i < l; i++) { + var ae = autoEscape[i]; + if (rest.indexOf(ae) === -1) + continue; + var esc = encodeURIComponent(ae); + if (esc === ae) { + esc = escape(ae); + } + rest = rest.split(ae).join(esc); + } + } + + + // chop off from the tail first. + var hash = rest.indexOf('#'); + if (hash !== -1) { + // got a fragment string. + this.hash = rest.substr(hash); + rest = rest.slice(0, hash); + } + var qm = rest.indexOf('?'); + if (qm !== -1) { + this.search = rest.substr(qm); + this.query = rest.substr(qm + 1); + if (parseQueryString) { + this.query = querystring.parse(this.query); + } + rest = rest.slice(0, qm); + } else if (parseQueryString) { + // no query string, but parseQueryString still requested + this.search = ''; + this.query = {}; + } + if (rest) this.pathname = rest; + if (slashedProtocol[lowerProto] && + this.hostname && !this.pathname) { + this.pathname = '/'; + } + + //to support http.request + if (this.pathname || this.search) { + var p = this.pathname || ''; + var s = this.search || ''; + this.path = p + s; + } + + // finally, reconstruct the href based on what has been validated. + this.href = this.format(); + return this; +}; + +// format a parsed object into a url string +function urlFormat(obj) { + // ensure it's an object, and not a string url. + // If it's an obj, this is a no-op. + // this way, you can call url_format() on strings + // to clean up potentially wonky urls. + if (util.isString(obj)) obj = urlParse(obj); + if (!(obj instanceof Url)) return Url.prototype.format.call(obj); + return obj.format(); +} + +Url.prototype.format = function() { + var auth = this.auth || ''; + if (auth) { + auth = encodeURIComponent(auth); + auth = auth.replace(/%3A/i, ':'); + auth += '@'; + } + + var protocol = this.protocol || '', + pathname = this.pathname || '', + hash = this.hash || '', + host = false, + query = ''; + + if (this.host) { + host = auth + this.host; + } else if (this.hostname) { + host = auth + (this.hostname.indexOf(':') === -1 ? + this.hostname : + '[' + this.hostname + ']'); + if (this.port) { + host += ':' + this.port; + } + } + + if (this.query && + util.isObject(this.query) && + Object.keys(this.query).length) { + query = querystring.stringify(this.query); + } + + var search = this.search || (query && ('?' + query)) || ''; + + if (protocol && protocol.substr(-1) !== ':') protocol += ':'; + + // only the slashedProtocols get the //. Not mailto:, xmpp:, etc. + // unless they had them to begin with. + if (this.slashes || + (!protocol || slashedProtocol[protocol]) && host !== false) { + host = '//' + (host || ''); + if (pathname && pathname.charAt(0) !== '/') pathname = '/' + pathname; + } else if (!host) { + host = ''; + } + + if (hash && hash.charAt(0) !== '#') hash = '#' + hash; + if (search && search.charAt(0) !== '?') search = '?' + search; + + pathname = pathname.replace(/[?#]/g, function(match) { + return encodeURIComponent(match); + }); + search = search.replace('#', '%23'); + + return protocol + host + pathname + search + hash; +}; + +function urlResolve(source, relative) { + return urlParse(source, false, true).resolve(relative); +} + +Url.prototype.resolve = function(relative) { + return this.resolveObject(urlParse(relative, false, true)).format(); +}; + +function urlResolveObject(source, relative) { + if (!source) return relative; + return urlParse(source, false, true).resolveObject(relative); +} + +Url.prototype.resolveObject = function(relative) { + if (util.isString(relative)) { + var rel = new Url(); + rel.parse(relative, false, true); + relative = rel; + } + + var result = new Url(); + var tkeys = Object.keys(this); + for (var tk = 0; tk < tkeys.length; tk++) { + var tkey = tkeys[tk]; + result[tkey] = this[tkey]; + } + + // hash is always overridden, no matter what. + // even href="" will remove it. + result.hash = relative.hash; + + // if the relative url is empty, then there's nothing left to do here. + if (relative.href === '') { + result.href = result.format(); + return result; + } + + // hrefs like //foo/bar always cut to the protocol. + if (relative.slashes && !relative.protocol) { + // take everything except the protocol from relative + var rkeys = Object.keys(relative); + for (var rk = 0; rk < rkeys.length; rk++) { + var rkey = rkeys[rk]; + if (rkey !== 'protocol') + result[rkey] = relative[rkey]; + } + + //urlParse appends trailing / to urls like http://www.example.com + if (slashedProtocol[result.protocol] && + result.hostname && !result.pathname) { + result.path = result.pathname = '/'; + } + + result.href = result.format(); + return result; + } + + if (relative.protocol && relative.protocol !== result.protocol) { + // if it's a known url protocol, then changing + // the protocol does weird things + // first, if it's not file:, then we MUST have a host, + // and if there was a path + // to begin with, then we MUST have a path. + // if it is file:, then the host is dropped, + // because that's known to be hostless. + // anything else is assumed to be absolute. + if (!slashedProtocol[relative.protocol]) { + var keys = Object.keys(relative); + for (var v = 0; v < keys.length; v++) { + var k = keys[v]; + result[k] = relative[k]; + } + result.href = result.format(); + return result; + } + + result.protocol = relative.protocol; + if (!relative.host && !hostlessProtocol[relative.protocol]) { + var relPath = (relative.pathname || '').split('/'); + while (relPath.length && !(relative.host = relPath.shift())); + if (!relative.host) relative.host = ''; + if (!relative.hostname) relative.hostname = ''; + if (relPath[0] !== '') relPath.unshift(''); + if (relPath.length < 2) relPath.unshift(''); + result.pathname = relPath.join('/'); + } else { + result.pathname = relative.pathname; + } + result.search = relative.search; + result.query = relative.query; + result.host = relative.host || ''; + result.auth = relative.auth; + result.hostname = relative.hostname || relative.host; + result.port = relative.port; + // to support http.request + if (result.pathname || result.search) { + var p = result.pathname || ''; + var s = result.search || ''; + result.path = p + s; + } + result.slashes = result.slashes || relative.slashes; + result.href = result.format(); + return result; + } + + var isSourceAbs = (result.pathname && result.pathname.charAt(0) === '/'), + isRelAbs = ( + relative.host || + relative.pathname && relative.pathname.charAt(0) === '/' + ), + mustEndAbs = (isRelAbs || isSourceAbs || + (result.host && relative.pathname)), + removeAllDots = mustEndAbs, + srcPath = result.pathname && result.pathname.split('/') || [], + relPath = relative.pathname && relative.pathname.split('/') || [], + psychotic = result.protocol && !slashedProtocol[result.protocol]; + + // if the url is a non-slashed url, then relative + // links like ../.. should be able + // to crawl up to the hostname, as well. This is strange. + // result.protocol has already been set by now. + // Later on, put the first path part into the host field. + if (psychotic) { + result.hostname = ''; + result.port = null; + if (result.host) { + if (srcPath[0] === '') srcPath[0] = result.host; + else srcPath.unshift(result.host); + } + result.host = ''; + if (relative.protocol) { + relative.hostname = null; + relative.port = null; + if (relative.host) { + if (relPath[0] === '') relPath[0] = relative.host; + else relPath.unshift(relative.host); + } + relative.host = null; + } + mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === ''); + } + + if (isRelAbs) { + // it's absolute. + result.host = (relative.host || relative.host === '') ? + relative.host : result.host; + result.hostname = (relative.hostname || relative.hostname === '') ? + relative.hostname : result.hostname; + result.search = relative.search; + result.query = relative.query; + srcPath = relPath; + // fall through to the dot-handling below. + } else if (relPath.length) { + // it's relative + // throw away the existing file, and take the new path instead. + if (!srcPath) srcPath = []; + srcPath.pop(); + srcPath = srcPath.concat(relPath); + result.search = relative.search; + result.query = relative.query; + } else if (!util.isNullOrUndefined(relative.search)) { + // just pull out the search. + // like href='?foo'. + // Put this after the other two cases because it simplifies the booleans + if (psychotic) { + result.hostname = result.host = srcPath.shift(); + //occationaly the auth can get stuck only in host + //this especially happens in cases like + //url.resolveObject('mailto:local1@domain1', 'local2@domain2') + var authInHost = result.host && result.host.indexOf('@') > 0 ? + result.host.split('@') : false; + if (authInHost) { + result.auth = authInHost.shift(); + result.host = result.hostname = authInHost.shift(); + } + } + result.search = relative.search; + result.query = relative.query; + //to support http.request + if (!util.isNull(result.pathname) || !util.isNull(result.search)) { + result.path = (result.pathname ? result.pathname : '') + + (result.search ? result.search : ''); + } + result.href = result.format(); + return result; + } + + if (!srcPath.length) { + // no path at all. easy. + // we've already handled the other stuff above. + result.pathname = null; + //to support http.request + if (result.search) { + result.path = '/' + result.search; + } else { + result.path = null; + } + result.href = result.format(); + return result; + } + + // if a url ENDs in . or .., then it must get a trailing slash. + // however, if it ends in anything else non-slashy, + // then it must NOT get a trailing slash. + var last = srcPath.slice(-1)[0]; + var hasTrailingSlash = ( + (result.host || relative.host || srcPath.length > 1) && + (last === '.' || last === '..') || last === ''); + + // strip single dots, resolve double dots to parent dir + // if the path tries to go above the root, `up` ends up > 0 + var up = 0; + for (var i = srcPath.length; i >= 0; i--) { + last = srcPath[i]; + if (last === '.') { + srcPath.splice(i, 1); + } else if (last === '..') { + srcPath.splice(i, 1); + up++; + } else if (up) { + srcPath.splice(i, 1); + up--; + } + } + + // if the path is allowed to go above the root, restore leading ..s + if (!mustEndAbs && !removeAllDots) { + for (; up--; up) { + srcPath.unshift('..'); + } + } + + if (mustEndAbs && srcPath[0] !== '' && + (!srcPath[0] || srcPath[0].charAt(0) !== '/')) { + srcPath.unshift(''); + } + + if (hasTrailingSlash && (srcPath.join('/').substr(-1) !== '/')) { + srcPath.push(''); + } + + var isAbsolute = srcPath[0] === '' || + (srcPath[0] && srcPath[0].charAt(0) === '/'); + + // put the host back + if (psychotic) { + result.hostname = result.host = isAbsolute ? '' : + srcPath.length ? srcPath.shift() : ''; + //occationaly the auth can get stuck only in host + //this especially happens in cases like + //url.resolveObject('mailto:local1@domain1', 'local2@domain2') + var authInHost = result.host && result.host.indexOf('@') > 0 ? + result.host.split('@') : false; + if (authInHost) { + result.auth = authInHost.shift(); + result.host = result.hostname = authInHost.shift(); + } + } + + mustEndAbs = mustEndAbs || (result.host && srcPath.length); + + if (mustEndAbs && !isAbsolute) { + srcPath.unshift(''); + } + + if (!srcPath.length) { + result.pathname = null; + result.path = null; + } else { + result.pathname = srcPath.join('/'); + } + + //to support request.http + if (!util.isNull(result.pathname) || !util.isNull(result.search)) { + result.path = (result.pathname ? result.pathname : '') + + (result.search ? result.search : ''); + } + result.auth = relative.auth || result.auth; + result.slashes = result.slashes || relative.slashes; + result.href = result.format(); + return result; +}; + +Url.prototype.parseHost = function() { + var host = this.host; + var port = portPattern.exec(host); + if (port) { + port = port[0]; + if (port !== ':') { + this.port = port.substr(1); + } + host = host.substr(0, host.length - port.length); + } + if (host) this.hostname = host; +}; + +},{"./util":754,"punycode":726,"querystring":729}],754:[function(require,module,exports){ +'use strict'; + +module.exports = { + isString: function(arg) { + return typeof(arg) === 'string'; + }, + isObject: function(arg) { + return typeof(arg) === 'object' && arg !== null; + }, + isNull: function(arg) { + return arg === null; + }, + isNullOrUndefined: function(arg) { + return arg == null; + } +}; + +},{}],755:[function(require,module,exports){ +(function (global){(function (){ + +/** + * Module exports. + */ + +module.exports = deprecate; + +/** + * Mark that a method should not be used. + * Returns a modified function which warns once by default. + * + * If `localStorage.noDeprecation = true` is set, then it is a no-op. + * + * If `localStorage.throwDeprecation = true` is set, then deprecated functions + * will throw an Error when invoked. + * + * If `localStorage.traceDeprecation = true` is set, then deprecated functions + * will invoke `console.trace()` instead of `console.error()`. + * + * @param {Function} fn - the function to deprecate + * @param {String} msg - the string to print to the console when `fn` is invoked + * @returns {Function} a new "deprecated" version of `fn` + * @api public + */ + +function deprecate (fn, msg) { + if (config('noDeprecation')) { + return fn; + } + + var warned = false; + function deprecated() { + if (!warned) { + if (config('throwDeprecation')) { + throw new Error(msg); + } else if (config('traceDeprecation')) { + console.trace(msg); + } else { + console.warn(msg); + } + warned = true; + } + return fn.apply(this, arguments); + } + + return deprecated; +} + +/** + * Checks `localStorage` for boolean values for the given `name`. + * + * @param {String} name + * @returns {Boolean} + * @api private + */ + +function config (name) { + // accessing global.localStorage can trigger a DOMException in sandboxed iframes + try { + if (!global.localStorage) return false; + } catch (_) { + return false; + } + var val = global.localStorage[name]; + if (null == val) return false; + return String(val).toLowerCase() === 'true'; +} + +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) + +},{}],756:[function(require,module,exports){ +module.exports = extend + +var hasOwnProperty = Object.prototype.hasOwnProperty; + +function extend() { + var target = {} + + for (var i = 0; i < arguments.length; i++) { + var source = arguments[i] + + for (var key in source) { + if (hasOwnProperty.call(source, key)) { + target[key] = source[key] + } + } + } + + return target +} + +},{}]},{},[1]) +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJicm93c2VyL2FwcC5qcyIsImRpc3QvYXNzZXJ0LWV4aXN0cy5qcyIsImRpc3QvY29uc3RzLmpzIiwiZGlzdC9jb252YXJzLmpzIiwiZGlzdC9jcm9zc2hhaXIuanMiLCJkaXN0L2RlbW8uanMiLCJkaXN0L2VudGl0aWVzLmpzIiwiZGlzdC9lbnRpdGllcy9iYXNlZW50aXR5LmpzIiwiZGlzdC9lbnRpdGllcy9nYW1lcnVsZXMuanMiLCJkaXN0L2VudGl0aW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V4cG9ydHMsIFwiX19lc01vZHVsZVwiLCB7IHZhbHVlOiB0cnVlIH0pO1xuZXhwb3J0cy5Db25WYXJzID0gdm9pZCAwO1xuY29uc3QgZXZlbnRzXzEgPSByZXF1aXJlKFwiZXZlbnRzXCIpO1xuLyoqXG4gKiBNYW5hZ2VzIGNvbnNvbGUgdmFyaWFibGVzLlxuICovXG5jbGFzcyBDb25WYXJzIGV4dGVuZHMgZXZlbnRzXzEuRXZlbnRFbWl0dGVyIHtcbiAgICBjb25zdHJ1Y3RvcigpIHtcbiAgICAgICAgc3VwZXIoLi4uYXJndW1lbnRzKTtcbiAgICAgICAgdGhpcy52YXJzID0gbmV3IE1hcCgpO1xuICAgIH1cbiAgICBsaXN0ZW4oZGVtbykge1xuICAgICAgICBkZW1vLm9uKFwibmV0X1NldENvblZhclwiLCAobXNnKSA9PiB7XG4gICAgICAgICAgICBjb25zdCBjb252YXJzID0gbXNnLmNvbnZhcnM7XG4gICAgICAgICAgICBpZiAoIWNvbnZhcnMpXG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgZm9yIChjb25zdCBjdmFyIG9mIGNvbnZhcnMuY3ZhcnMpIHtcbiAgICAgICAgICAgICAgICBjb25zdCBvbGRWYWx1ZSA9IHRoaXMudmFycy5nZXQoY3Zhci5uYW1lKTtcbiAgICAgICAgICAgICAgICB0aGlzLnZhcnMuc2V0KGN2YXIubmFtZSwgY3Zhci52YWx1ZSk7XG4gICAgICAgICAgICAgICAgY29uc3QgYXJncyA9IHtcbiAgICAgICAgICAgICAgICAgICAgbmFtZTogY3Zhci5uYW1lLFxuICAgICAgICAgICAgICAgICAgICB2YWx1ZTogY3Zhci52YWx1ZSxcbiAgICAgICAgICAgICAgICAgICAgb2xkVmFsdWVcbiAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICAgIHRoaXMuZW1pdChjdmFyLm5hbWUsIGFyZ3MpO1xuICAgICAgICAgICAgICAgIHRoaXMuZW1pdChcImNoYW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ihgZXhwZWN0ZWQgcHJvdG9jb2wgdmVyc2lvbiA0LCBnb3Q6ICR7c3luY0R0by5wcm90b2NvbH1gKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAoc3luY0R0by50b2tlbl9yZWRpcmVjdCAhPSBudWxsKSB7XG4gICAgICAgICAgICB1cmwgPSBuZXcgdXJsXzEuVVJMKHN5bmNEdG8udG9rZW5fcmVkaXJlY3QsIHVybCkudG9TdHJpbmcoKTtcbiAgICAgICAgICAgIGlmICghdXJsLmVuZHNXaXRoKFwiL1wiKSlcbiAgICAgICAgICAgICAgICB1cmwgKz0gXCIvXCI7XG4gICAgICAgIH1cbiAgICAgICAgdGhpcy5oZWFkZXIgPSB7XG4gICAgICAgICAgICBtYWdpYzogXCJITDJERU1PXCIsXG4gICAgICAgICAgICBwcm90b2NvbDogc3luY0R0by5wcm90b2NvbCxcbiAgICAgICAgICAgIG5ldHdvcmtQcm90b2NvbDogMCxcbiAgICAgICAgICAgIHNlcnZlck5hbWU6IGBHT1RWIEJyb2FkY2FzdDogJHt1cmx9YCxcbiAgICAgICAgICAgIGNsaWVudE5hbWU6IFwiR09UViBEZW1vXCIsXG4gICAgICAgICAgICBtYXBOYW1lOiBzeW5jRHRvLm1hcCxcbiAgICAgICAgICAgIGdhbWVEaXJlY3Rvcnk6IFwiY3Nnb1wiLFxuICAgICAgICAgICAgcGxheWJhY2tUaW1lOiAwLFxuICAgICAgICAgICAgcGxheWJhY2tUaWNrczogMCxcbiAgICAgICAgICAgIHBsYXliYWNrRnJhbWVzOiAwLFxuICAgICAgICAgICAgc2lnbm9uTGVuZ3RoOiAwXG4gICAgICAgIH07XG4gICAgICAgIHRoaXMudGlja0ludGVydmFsID0gMSAvIHN5bmNEdG8udHBzO1xuICAgICAgICBsZXQgY2FuY2VsbGVkID0gZmFsc2U7XG4gICAgICAgIHRoaXMuZW1pdChcInN0YXJ0XCIsIHtcbiAgICAgICAgICAgIGNhbmNlbCgpIHtcbiAgICAgICAgICAgICAgICB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gICAgICB0cnkge1xuICAgICAgICAgICAgICAgIGZyYWdtZW50UmVzcG9uc2UgPSBhd2FpdCBodHRwR2V0KGZyYWdtZW50VXJsKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGNhdGNoIHtcbiAgICAgICAgICAgICAgICAvLyBIVFRQIDQwNCBlcnJvcnMgYXJlIGV4cGVjdGVkIC0gZWFjaCBmcmFnbWVudCBvbmx5IGxhc3RzIGZvciBhIGZldyBzZWNvbmRzLlxuICAgICAgICAgICAgICAgIC8vIFdhaXQgZm9yIDEtMiBzZWNzIGJlZm9yZSByZXRyeWluZyB0byBhdm9pZCBzcGFtbWluZyB0aGUgcmVsYXkuXG4gICAgICAgICAgICAgICAgYXdhaXQgbmV3IFByb21pc2UocmVzb2x2ZSA9PiBzZXRUaW1lb3V0KHJlc29sdmUsIDEwMDAgKyBNYXRoLnJhbmRvbSgpICogMTAwMCkpO1xuICAgICAgICAgICAgICAgIGNvbnRpbnVlO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgLy8gV2UgbmVlZCB0byByZXF1ZXN0IHtmcmFnbWVudH0vZnVsbCArIHtmcmFnbWVudH0vZGVsdGFcbiAgICAgICAgICAgIGlmIChmcmFnbWVudFR5cGUgPT0gXCJmdWxsXCIpIHtcbiAgICAgICAgICAgICAgICBmcmFnbWVudFR5cGUgPSBcImRlbHRhXCI7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICBmcmFnbWVudCArPSAxO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgdGhpcy5fYnl0ZWJ1ZiA9IEJ5dGVCdWZmZXIud3JhcChmcmFnbWVudFJlc3BvbnNlLCB0cnVlKTtcbiAgICAgICAgICAgIHdoaWxlICh0aGlzLl9ieXRlYnVmLnJlbWFpbmluZygpID4gMCkge1xuICAgICAgICAgICAgICAgIHRoaXMuX3JlYWRDb21tYW5kKCk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9XG4gICAgcGFyc2VTdHJlYW0oc3RyZWFtKSB7XG4gICAgICAgIHRoaXMuX2hhc0VuZGVkID0gZmFsc2U7XG4gICAgICAgIGNvbnN0IG9uUmVjZWl2ZUNodW5rID0gKGNodW5rKSA9PiB7XG4gICAgICAgICAgICAvLyBlc2xpbnQtZGlzYWJsZS1uZXh0LWxpbmUgQHR5cGVzY3JpcHQtZXNsaW50L25vLXVubmVjZXNzYXJ5LWNvbmRpdGlvblxuICAgICAgICAgICAgaWYgKHRoaXMuX2J5dGVidWYgPT0gbnVsbCkge1xuICAgICAgICAgICAgICAgIHRoaXMuX2J5dGVidWYgPSBCeXRlQnVmZmVyLndyYXAoY2h1bmssIHRydWUpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgdGhpcy5fY2h1bmtzLnB1c2goY2h1bmspO1xuICAgICAgICAgICAgfVxuICAgICAgICB9O1xuICAgICAgICBjb25zdCByZWFkUGFja2V0Q2h1bmsgPSAoKSA9PiB7XG4gICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICAgIC8vIEtlZXAgcmVhZGluZyB1bnRpbCB3ZSBjYW4ndCByZWFkIGFueSBtb3JlXG4gICAgICAgICAgICAgICAgd2hpbGUgKHRoaXMuX2J5dGVidWYucmVtYWluaW5nKCkgPiAwIHx8IHRoaXMuX2NodW5rcy5sZW5ndGggPiAwKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuX2J5dGVidWYubWFyaygpO1xuICAgICAgICAgICAgICAgICAgICB0aGlzLl9yZWFkQ29tbWFuZCgpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGNhdGNoIChlKSB7XG4gICAgICAgICAgICAgICAgaWYgKGUgaW5zdGFuY2VvZiBSYW5nZUVycm9yKSB7XG4gICAgICAgICAgICAgICAgICAgIC8vIFJlc2V0IHRoZSBieXRlIGJ1ZmZlciB0byB0aGUgc3RhcnQgb2YgdGhlIGxhc3QgY29tbWFuZFxuICAgICAgICAgICAgICAgICAgICB0aGlzLl9ieXRlYnVmLm9mZnNldCA9IE1hdGgubWF4KDAsIHRoaXMuX2J5dGVidWYubWFya2VkT2Zmc2V0KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIHN0cmVhbS5vZmYoXCJkYXRhXCIsIG9uUmVjZWl2ZUNodW5rKTtcbiAgICAgICAgICAgICAgICAgICAgY29uc3QgZXJyb3IgPSBlIGluc3RhbmNlb2YgRXJyb3JcbiAgICAgICAgICAgICAgICAgICAgICAgID8gZVxuICAgICAgICAgICAgICAgICAgICAgICAgOiBuZXcgRXJyb3IoYEV4Y2VwdGlvbiBkdXJpbmcgcGFyc2luZzogJHtlfWApO1xuICAgICAgICAgICAgICAgICAgICB0aGlzLl9lbWl0RW5kKHsgZXJyb3IsIGluY29tcGxldGU6IGZhbHNlIH0pO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfTtcbiAgICAgICAgY29uc3QgcmVhZEhlYWRlckNodW5rID0gKCkgPT4ge1xuICAgICAgICAgICAgLy8gV2FpdCBmb3IgZW5vdWdoIGJ5dGVzIGZvciB1cyB0byByZWFkIHRoZSBoZWFkZXJcbiAgICAgICAgICAgIGlmICghdGhpcy5fdHJ5RW5zdXJlUmVtYWluaW5nKDEwNzIpKVxuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIC8vIE9uY2Ugd2UndmUgcmVhZCB0aGUgaGVhZGVyLCByZW1vdmUgdGhpcyBoYW5kbGVyXG4gICAgICAgICAgICBzdHJlYW0ub2ZmKFwiZGF0YVwiLCByZWFkSGVhZGVyQ2h1bmspO1xuICAgICAgICAgICAgY29uc3QgY2FuY2VsbGVkID0gdGhpcy5fcGFyc2VIZWFkZXIoKTtcbiAgICAgICAgICAgIGlmICghY2FuY2VsbGVk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RTdHJlYW0uZnJvbShjaHVuay5idWZmZXIuc2xpY2UoY2h1bmsub2Zmc2V0LCBjaHVuay5saW1pdCkpO1xuICAgICAgICBjb25zdCBtb3ZlID0ge1xuICAgICAgICAgICAgY29tbWFuZE51bWJlcjogMCxcbiAgICAgICAgICAgIHRpY2tDb3VudDogMCxcbiAgICAgICAgICAgIHZpZXdBbmdsZXM6IHsgeDogMCwgeTogMCwgejogMCB9LFxuICAgICAgICAgICAgYWltRGlyZWN0aW9uOiB7IHg6IDAsIHk6IDAsIHo6IDAgfSxcbiAgICAgICAgICAgIGZvcndhcmRNb3ZlOiAwLFxuICAgICAgICAgICAgc2lkZU1vdmU6IDAsXG4gICAgICAgICAgICB1cE1vdmU6IDAsXG4gICAgICAgICAgICBidXR0b25zOiBuZXcgQXJyYXkoKSxcbiAgICAgICAgICAgIGltcHVsc2U6IDAsXG4gICAgICAgICAgICB3ZWFwb25TZWxlY3Q6IDAsXG4gICAgICAgICAgICB3ZWFwb25TdWJUeXBlOiAwLFxuICAgICAgICAgICAgcmFuZG9tU2VlZDogMCxcbiAgICAgICAgICAgIG1vdXNlRGVsdGFYOiAwLFxuICAgICAgICAgICAgbW91c2VEZWx0YVk6IDBcbiAgICAgICAgfTtcbiAgICAgICAgaWYgKGJpdGJ1Zi5yZWFkT25lQml0KCkpIHtcbiAgICAgICAgICAgIG1vdmUuY29tbWFuZE51bWJlciA9IGJpdGJ1Zi5yZWFkVUludDMyKCk7XG4gICAgICAgIH1cbiAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICBtb3ZlLmNvbW1hbmROdW1iZXIgPSAxO1xuICAgICAgICB9XG4gICAgICAgIGlmIChiaXRidWYucmVhZE9uZUJpdCgpKSB7XG4gICAgICAgICAgICBtb3ZlLnRpY2tDb3VudCA9IGJpdGJ1Zi5yZWFkVUludDMyKCk7XG4gICAgICAgIH1cbiAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICBtb3ZlLnRpY2tDb3VudCA9IDE7XG4gICA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bmVCaXQoKSlcbiAgICAgICAgICAgIG1vdmUudXBNb3ZlID0gYml0YnVmLnJlYWRGbG9hdDMyKCk7XG4gICAgICAgIGlmIChiaXRidWYucmVhZE9uZUJpdCgpKSB7XG4gICAgICAgICAgICBjb25zdCBidXR0b25zID0gYml0YnVmLnJlYWRVSW50MzIoKTtcbiAgICAgICAgICAgIGlmIChidXR0b25zICYgKDEgPDwgMCkpXG4gICAgICAgICAgICAgICAgbW92ZS5idXR0b25zLnB1c2goXCJhdHRhY2tcIik7XG4gICAgICAgICAgICBpZiAoYnV0dG9ucyAmICgxIDw8IDEpKVxuICAgICAgICAgICAgICAgIG1vdmUuYnV0dG9ucy5wdXNoKFwianVtcFwiKTtcbiAgICAgICAgICAgIGlmIChidXR0b25zICYgKDEgPDwgMikpXG4gICAgICAgICAgICAgICAgbW92ZS5idXR0b25zLnB1c2goXCJkdWNrXCIpO1xuICAgICAgICAgICAgaWYgKGJ1dHRvbnMgJiAoMSA8PCAzKSlcbiAgICAgICAgICAgICAgICBtb3ZlLmJ1dHRvbnMucHVzaChcImZvcndhcmRcIik7XG4gICAgICAgICAgICBpZiAoYnV0dG9ucyAmICgxIDw8IDQpKVxuICAgICAgICAgICAgICAgIG1vdmUuYnV0dG9ucy5wdXNoKFwiYmFja1wiKTtcbiAgICAgICAgICAgIGlmIChidXR0b25zICYgKDEgPDwgNSkpXG4gICAgICAgICAgICAgICAgbW92ZS5idXR0b25zLnB1c2goXCJ1c2VcIik7XG4gICAgICAgICAgICBpZiAoYnV0dG9ucyAmICgxIDw8IDYpKVxuICAgICAgICAgICAgICAgIG1vdmUuYnV0dG9ucy5wdXNoKFwiY2FuY2VsXCIpO1xuICAgICAgICAgICAgaWYgKGJ1dHRvbnMgJiAoMSA8PCA3KSlcbiAgICAgICAgICAgICAgICBtb3ZlLmJ1dHRvbnMucHVzaChcImxlZnRcIik7XG4gICAgICAgICAgICBpZiAoYnV0dG9ucyAmICgxIDw8IDgpKVxuICAgICAgICAgICAgICAgIG1vdmUuYnV0dG9ucy5wdXNoKFwicmlnaHRcIik7XG4gICAgICAgICAgICBpZiAoYnV0dG9ucyAmICgxIDw8IDkpKVxuICAgICAgICAgICAgICAgIG1vdmUuYnV0dG9ucy5wdXNoKFwibW92ZWxlZnRcIik7XG4gICAgICAgICAgICBpZiAoYnV0dG9ucyAmICgxIDw8IDEwKSlcbiAgICAgICAgICAgICAgICBtb3ZlLmJ1dHRvbnMucHVzaChcIm1vdmVyaWdodFwiKTtcbiAgICAgICAgICAgIGlmIChidXR0b25zICYgKDEgPDwgMTEpKVxuICAgICAgICAgICAgICAgIG1vdmUuYnV0dG9ucy5wdXNoKFwiYXR0YWNrMlwiKTtcbiAgICAgICAgICAgIGlmIChidXR0b25zICYgKDEgPDwgMTIpKVxuICAgICAgICAgICAgICAgIG1vdmUuYnV0dG9ucy5wdXNoKFwicnVuXCIpO1xuICAgICAgICAgICAgaWYgKGJ1dHRvbnMgJiAoMSA8PCAxMykpXG4gICAgICAgICAgICAgICAgbW92ZS5idXR0b25zLnB1c2goXCJyZWxvYWRcIik7XG4gICAgICAgICAgICBpZiAoYnV0dG9ucyAmICgxIDw8IDE0KSlcbiAgICAgICAgICAgICAgICBtb3ZlLmJ1dHRvbnMucHVzaChcImFsdDFcIik7XG4gICAgICAgICAgICBpZiAoYnV0dG9ucyAmICgxIDw8IDE1KSlcbiAgICAgICAgICAgICAgICBtb3ZlLmJ1dHRvbnMucHVzaChcImFsdDJcIik7XG4gICAgICAgICAgICBpZiAoYnV0dG9ucyAmICgxIDw8IDE2KSlcbiAgICAgICAgICAgICAgICBtb3ZlLmJ1dHRvbnMucHVzaChcInNjb3JlXCIpO1xuICAgICAgICAgICAgaWYgKGJ1dHRvbnMgJiAoMSA8PCAxNykpXG4gICAgICAgICAgICAgICAgbW92ZS5idXR0b25zLnB1c2goXCJzcGVlZFwiKTtcbiAgICAgICAgICAgIGlmIChidXR0b25zICYgKDEgPDwgMTgpKVxuICAgICAgICAgICAgICAgIG1vdmUuYnV0dG9ucy5wdXNoKFwid2Fsa1wiKTtcbiAgICAgICAgICAgIGlmIChidXR0b25zICYgKDEgPDwgMTkpKVxuICAgICAgICAgICAgICAgIG1vdmUuYnV0dG9ucy5wdXNoKFwiem9vbVwiKTtcbiAgICAgICAgICAgIGlmIChidXR0b25zICYgKDEgPDwgMjApKVxuICAgICAgICAgICAgICAgIG1vdmUuYnV0dG9ucy5wdXNoKFwid2VhcG9uMVwiKTtcbiAgICAgICAgICAgIGlmIChidXR0b25zICYgKDEgPDwgMjEpKVxuICAgICAgICAgICAgICAgIG1vdmUuYnV0dG9ucy5wdXNoKFwid2VhcG9uMlwiKTtcbiAgICAgICAgICAgIGlmIChidXR0b25zICYgKDEgPDwgMjIpKVxuICAgICAgICAgICAgICAgIG1vdmUuYnV0dG9ucy5wdXNoKFwiYnVsbHJ1c2hcIik7XG4gICAgICAgICAgICBpZiAoYnV0dG9ucyAmICgxIDw8IDIzKSlcbiAgICAgICAgICAgICAgICBtb3ZlLmJ1dHRvbnMucHVzaChcImdyZW5hZGUxXCIpO1xuICAgICAgICAgICAgaWYgKGJ1dHRvbnMgJiAoMSA8PCAyNCkpXG4gICAgICAgICAgICAgICAgbW92ZS5idXR0b25zLnB1c2goXCJncmVuYWRlMlwiKTtcbiAgICAgICAgICAgIGlmIChidXR0b25zICYgKDEgPDwgMjUpKVxuICAgICAgICAgICAgICAgIG1vdmUuYnV0dG9ucy5wdXNoKFwibG9va3NwaW5cIik7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKGJpdGJ1Zi5yZWFkT25lQml0KCkpXG4gICAgICAgICAgICBtb3ZlLmltcHVsc2UgPSBiaXRidWYucmVhZFVJbnQ4KCk7XG4gICAgICAgIGlmIChiaXRidWYucmVhZE9uZUJpdCgpKSB7XG4gICAgICAgICAgICBtb3ZlLndlYXBvblNlbGVjdCA9IGJpdGJ1Zi5yZWFkVUJpdHMoY29uc3RzXzEuTUFYX0VESUNUX0JJVFMpO1xuICAgICAgICAgIC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b3IoYE5vdCBlbm91Z2ggZGF0YSB0byBjb250aW51ZSBwYXJzaW5nLiAke2J5dGVzfSBieXRlcyBuZWVkZWRgKTtcbiAgICAgICAgfVxuICAgIH1cbiAgICBfcmVhZENvbW1hbmQoKSB7XG4gICAgICAgIHRoaXMuX2Vuc3VyZVJlbWFpbmluZyg2KTtcbiAgICAgICAgY29uc3QgY29tbWFuZCA9IHRoaXMuX2J5dGVidWYucmVhZFVpbnQ4KCk7XG4gICAgICAgIGNvbnN0IHRpY2sgPSB0aGlzLl9ieXRlYnVmLnJlYWRJbnQzMigpO1xuICAgICAgICB0aGlzLnBsYXllclNsb3QgPSB0aGlzLl9ieXRlYnVmLnJlYWRVaW50OCgpO1xuICAgICAgICBpZiAodGljayAhPT0gdGhpcy5jdXJyZW50VGljaykge1xuICAgICAgICAgICAgdGhpcy5lbWl0KFwidGlja2VuZFwiLCB0aGlzLmN1cnJlbnRUaWNrKTtcbiAgICAgICAgICAgIHRoaXMuY3VycmVudFRpY2sgPSB0aWNrO1xuICAgICAgICAgICAgdGhpcy5lbWl0KFwidGlja3N0YXJ0XCIsIHRoaXMuY3VycmVudFRpY2spO1xuICAgICAgICB9XG4gICAgICAgIHN3aXRjaCAoY29tbWFuZCkge1xuICAgICAgICAgICAgY2FzZSAyIC8qIERlbW9Db21tYW5kcy5QYWNrZXQgKi86XG4gICAgICAgICAgICBjYXNlIDEgLyogRGVtb0NvbW1hbmRzLlNpZ25vbiAqLzpcbiAgICAgICAgICAgICAgICB0aGlzLl9oYW5kbGVEZW1vUGFja2V0KCk7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIDYgLyogRGVtb0NvbW1hbmRzLkRhdGFUYWJsZXMgKi86XG4gICAgICAgICAgICAgICAgdGhpcy5faGFuZGxlRGF0YVRhYmxlcygpO1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSA5IC8qIERlbW9Db21tYW5kcy5TdHJpbmdUYWJsZXMgKi86XG4gICAgICAgICAgICAgICAgdGhpcy5faGFuZGxlU3RyaW5nVGFibGVzKCk7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIDQgLyogRGVtb0NvbW1hbmRzLkNvbnNvbGVDbWQgKi86IC8vIFRPRE9cbiAgICAgICAgICAgICAgICB0aGlzLl9oYW5kbGVEYXRhQ2h1bmsoKTtcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgNSAvKiBEZW1vQ29tbWFuZHMuVXNlckNtZCAqLzpcbiAgICAgICAgICAgICAgICB0aGlzLl9oYW5kbGVVc2VyQ21kKCk7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIDcgLyogRGVtb0NvbW1hbmRzLlN0b3AgKi86XG4gICAgICAgICAgICAgICAgdGhpcy5jYW5jZWwoKTtcbiAgICAgICAgICAgICAgICB0aGlzLmVtaXQoXCJ0aWNrZW5kXCIsIHRoaXMuY3VycmVudFRpY2spO1xuICAgICAgICAgICAgICAgIHRoaXMuX2VtaXRFbmQoeyBpbmNvbXBsZXRlOiBmYWxzZSB9KTtcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICBjYXNlIDggLyogRGVtb0NvbW1hbmRzLkN1c3RvbURhdGEgKi86XG4gICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFwiQ3VzdG9tIGRhdGEgbm90IHN1cHBvcnRlZFwiKTtcbiAgICAgICAgICAgIGNhc2UgMyAvKiBEZW1vQ29tbWFuZHMuU3luY1RpY2sgKi86XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihgVW5yZWNvZ25pc2VkIGNvbW1hbmQ6ICR7Y29tbWFuZH1gKTtcbiAgICAgICAgfVxuICAgIH1cbiAgICBfcGFyc2VSZWN1cnNlKCkge1x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dGlvbiByZWFkRmllbGRJbmRleChlbnRpdHlCaXRCdWZmZXIsIGxhc3RJbmRleCwgbmV3V2F5KSB7XG4gICAgaWYgKG5ld1dheSAmJiBlbnRpdHlCaXRCdWZmZXIucmVhZE9uZUJpdCgpKSB7XG4gICAgICAgIHJldHVybiBsYXN0SW5kZXggKyAxO1xuICAgIH1cbiAgICBsZXQgcmV0ID0gMDtcbiAgICBpZiAobmV3V2F5ICYmIGVudGl0eUJpdEJ1ZmZlci5yZWFkT25lQml0KCkpIHtcbiAgICAgICAgcmV0ID0gZW50aXR5Qml0QnVmZmVyLnJlYWRVQml0cygzKTtcbiAgICB9XG4gICAgZWxzZSB7XG4gICAgICAgIHJldCA9IGVudGl0eUJpdEJ1ZmZlci5yZWFkVUJpdHMoNyk7XG4gICAgICAgIHN3aXRjaCAocmV0ICYgKDMyIHwgNjQpKSB7XG4gICAgICAgICAgICBjYXNlIDMyOlxuICAgICAgICAgICAgICAgIHJldCA9IChyZXQgJiB+OTYpIHwgKGVudGl0eUJpdEJ1ZmZlci5yZWFkVUJpdHMoMikgPDwgNSk7XG4gICAgICAgICAgICAgICAgYXNzZXJ0KHJldCA+PSAzMik7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBjYXNlIDY0OlxuICAgICAgICAgICAgICAgIHJldCA9IChyZXQgJiB+OTYpIHwgKGVudGl0eUJpdEJ1ZmZlci5yZWFkVUJpdHMoNCkgPDwgNSk7XG4gICAgICAgICAgICAgICAgYXNzZXJ0KHJldCA+PSAxMjgpO1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgY2FzZSA5NjpcbiAgICAgICAgICAgICAgICByZXQgPSAocmV0ICYgfjk2KSB8IChlbnRpdHlCaXRCdWZmZXIucmVhZFVCaXRzKDcpIDw8IDUpO1xuICAgICAgICAgICAgICAgIGFzc2VydChyZXQgPj0gNTEyKTtcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgfVxuICAgIH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dXJuIGVudGl0eTtcbiAgICB9XG4gICAgKmZpbmRBbGxXaXRoVGFibGUodGFibGUpIHtcbiAgICAgICAgZm9yIChjb25zdCBlbnQgb2YgdGhpcy5lbnRpdGllcy52YWx1ZXMoKSkge1xuICAgICAgICAgICAgaWYgKHRhYmxlIGluIGVudC5wcm9wcykge1xuICAgICAgICAgICAgICAgIHlpZWxkIGVudDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cbiAgICAqZmluZEFsbFdpdGhDbGFzcyhrbGFzcykge1xuICAgICAgICBmb3IgKGNvbnN0IGVudCBvZiB0aGlzLmVudGl0aWVzLnZhbHVlcygpKSB7XG4gICAgICAgICAgICBpZiAoZW50IGluc3RhbmNlb2Yga2xhc3MpIHtcbiAgICAgICAgICAgICAgICB5aWVsZCBlbnQ7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9XG4gICAgaGFuZGxlRGF0YVRhYmxlcyhjaHVuaykge1xuICAgICAgICAvLyBlc2xpbnQtZGlzYWJsZS1uZXh0LWxpbmUgbm8tY29uc3RhbnQtY29uZGl0aW9uXG4gICAgICAgIHdoaWxlICh0cnVlKSB7XG4gICAgICAgICAgICBjb25zdCBkZXNjcmlwdG9yID0gbmV0LmZpbmRCeVR5cGUoY2h1bmsucmVhZFZhcmludDMyKCkpO1xuICAgICAgICAgICAgYXNzZXJ0KChkZXNjcmlwdG9yID09PSBudWxsIHx8IGRlc2NyaXB0b3IgPT09IHZvaWQgMCA/IHZvaWQgMCA6IGRlc2NyaXB0b3IubmFtZSkgPT09IFwic3ZjX1NlbmRUYWJsZVwiLCBcImV4cGVjdGVkIFNlbmRUYWJsZSBtZXNzYWdlXCIpO1xuICAgICAgICAgICAgY29uc3QgbGVuZ3RoID0gY2h1bmsucmVhZFZhcmludDMyKCk7XG4gICAgICAgICAgICBjb25zdCBtc2cgPSBkZXNjcmlwdG9yLmNsYXNzLmRlY29kZShuZXcgVWludDhBcnJheShjaHVuay5yZWFkQn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cyh0YWJsZSwgZXhjbHVkZXMpIHtcbiAgICAgICAgY29uc3QgZmxhdHRlbmVkID0gW107XG4gICAgICAgIGZvciAobGV0IGluZGV4ID0gMDsgaW5kZXggPCB0YWJsZS5wcm9wcy5sZW5ndGg7ICsraW5kZXgpIHtcbiAgICAgICAgICAgIGNvbnN0IHByb3AgPSB0YWJsZS5wcm9wc1tpbmRleF07XG4gICAgICAgICAgICBpZiAoKHByb3AuZmxhZ3MgJiBwcm9wc18xLlNQUk9QX0lOU0lERUFSUkFZKSAhPT0gMCB8fFxuICAgICAgICAgICAgICAgIChwcm9wLmZsYWdzICYgcHJvcHNfMS5TUFJPUF9FWENMVURFKSAhPT0gMCB8fFxuICAgICAgICAgICAgICAgIGlzUHJvcEV4Y2x1ZGVkKGV4Y2x1ZGVzLCB0YWJsZSwgcHJvcCkpIHtcbiAgICAgICAgICAgICAgICBjb250aW51ZTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChwcm9wLnR5cGUgPT09IDYgLyogUHJvcFR5cGUuRGF0YVRhYmxlICovKSB7XG4gICAgICAgICAgICAgICAgY29uc3Qgc3ViVGFibGUgPSAoMCwgYXNzZXJ0X2V4aXN0c18xLmRlZmF1bHQpKHRoaXMuX2ZpbmRUYWJsZUJ5TmFtZShwcm9wLmR0TmFtZSkpO1xuICAgICAgICAgICAgICAgIGNvbnN0IGNoaWxkUHJvcHMgPSB0aGlzLl9nYXRoZXJQcm9wcyhzdWJUYWJsZSwgZXhjbHVkZXMpO1xuICAgICAgICAgICAgICAgIGlmICgocHJvcC5mbGFncyAmIHByb3BzXzEuU1BST1BfQ09MTEFQU0lCTEUpID09PSAwKSB7XG4gICAgICAgICAgICAgICAgICAgIGZvciAoY29uc3QgZnAgb2YgY2hpbGRQcm9wcykge1xuICAgICAgICAgICAgICAgICAgICAgICAgZnAuY29sbGFwc2libGUgPSBmYWxzZTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBmbGF0dGVuZWQucHVzaCguLi5jaGlsZFByb3BzKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgIGZsYXR0ZW5lZC5wdXNoKHtcbiAgICAgICAgICAgICAgICAgICAgcHJvcCxcbiAgICAgICAgICAgICAgICAgICAgdGFibGUsXG4gICAgICAgICAgICAgICAgICAgIGRlY29kZTogKDAsIHByb3BzXzEubWFrZURlY29kZXIpKHByb3AsIHByb3AudHlwZSA9PT0gNSAvKiBQcm9wVHlwZS5BcnJheSAqLyA/IHRhYmxlLnByb3BzW2luZGV4IC0gMV0gOiB1bmRlZmluZWQpLFxuICAgICAgICAgICAgICAgICAgICBjb2xsYXBzaWJsZTogdHJ1ZVxuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIC8vIGNvbGxhcHNpYmxlIHByb3BzIHNob3VsZCBjb21lIGFmdGVyIG5vbi1jb2xsYXBzaWJsZVxuICAgICAgICByZXR1cm4gZmxhdHRlbmVkLnNvcnQoKHsgY29sbGFwc2libGU6IGEgfSwgeyBjb2xsYXBzaWJsZTogYiB9KSA9PiAoYSA/IDEgOiAwKSAtIChiID8gMSA6IDApKTtcbiAgICB9XG4gICAgX2ZsYXR0ZW5EYXRhVGFibGUodGFibGUpIHtcbiAgICAgICAgY29uc3QgZmxhdHRlbmVkUHJvcHMgPSB0aGlzLl9nYXRoZXJQcm9wcyh0YWJsZSwgdGhpcy5fZ2F0aGVyRXhjbHVkZXModGFibGUpKTtcbiAgICAgICAgY29uc3QgcHJpb3JpdHlTZXQgPSBuZXcgU2V0KGZsYXR0ZW5lZFByb3BzLm1hcChmcCA9PiBmcC5wcm9wLnByaW9yaXR5KSk7XG4gICAgICAgIHByaW9yaXR5U2V0LmFkZCg2NCk7XG4gICAgICAgIGNvbnN0IHByaW9yaXRpZXMgPSBBcnJheS5mcm9tKHByaW9yaXR5U2V0KS5zb3J0KChhLCBiKSA9PiBhIC0gYik7XG4gICAgICAgIGxldCBzdGFydCA9IDA7XG4gICAgICAgIC8vIE9uIHRoaXMgc3VyZmFjZSB0aGlzIGxvb2tzIGxpa2UgYSBzb3J0IGJ5IHByaW9yaXR5IChvciBtaW4oNjQsIHByaW9yaXR5KVxuICAgICAgICAvLyBmb3IgQ0hBTkdFU19PRlRFTiBwcm9wcykuIEl0J3Mgbm90IGEgc3RhYmxlIHNvcnQgc28gaXQgY2FuJ3QganVzdCBiZVxuICAgICAgICAvLyByZXBsYWNlZCB3aXRoIEpTIEFycmF5I3NvcnRcbiAgICAgICAgZm9yIChjb25zdCBwcmlvcml0eSBvZiBwcmlvcml0aWVzKSB7XG4gICAgICAgICAgICAvLyBlc2xpbnQtZGlzYWJsZS1uZXh0LWxpbmUgbm8tY29uc3RhbnQtY29uZGl0aW9uXG4gICAgICAgICAgICB3aGlsZSAodHJ1ZSkge1xuICAgICAgICAgICAgICAgIGxldCBjdXJyZW50UHJvcDtcbiAgICAgICAgICAgICAgICBmb3IgKGN1cnJlbnRQcm9wID0gc3RhcnQ7IGN1cnJlbnRQcm9wIDwgZmxhdHRlbmVkUHJvcHMubGVuZ3RoOyArK2N1cnJlbnRQcm9wKSB7XG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IHByb3AgPSBmbGF0dGVuZWRQcm9wc1tjdXJyZW50UHJvcF0ucHJvcDtcbiAgICAgICAgICAgICAgICAgICAgaWYgKHByb3AucHJpb3JpdHkgPT09IHByaW9yaXR5IHx8XG4gICAgICAgICAgICAgICAgICAgICAgICAocHJpb3JpdHkgPT09IDY0ICYmIChwcm9wLmZsYWdzICYgcHJvcHNfMS5TUFJPUF9DSEFOR0VTX09GVEVOKSAhPT0gMCkpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzdGFydCAhPT0gY3VycmVudFByb3ApIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCB0ZW1wID0gZmxhdHRlbmVkUHJvcHNbc3RhcnRdO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZsYXR0ZW5lZFByb3BzW3N0YXJ0XSA9IGZsYXR0ZW5lZFByb3BzW2N1cnJlbnRQcm9wXTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbGF0dGVuZWRQcm9wc1tjdXJyZW50UHJvcF0gPSB0ZW1wO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgc3RhcnQrKztcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGlmIChjdXJyZW50UHJvcCA9PT0gZmxhdHRlbmVkUHJvcHMubGVuZ3RoKSB7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gZmxhdHRlbmVkUHJvcHM7XG4gICAgfVxuICAgIF9maW5kVGFibGVCeU5hbWUobmFtZSkge1xuICAgICAgICByZXR1cm4gdGhpcy5kYXRhVGFibGVzLmZpbmQodGFibGUgPT4gdGFibGUubmV0VGFibGVOYW1lID09PSBuYW1lKTtcbiAgICB9XG4gICAgX2FkZEVudGl0eShpbmRleCwgY2xhc3NJZCwgc2VyaWFsTnVtLCBleGlzdGluZ0VudGl0eSwgZW50aXR5QmFzZWxpbmUpIHtcbiAgICAgICAgY29uc3QgYmFzZWxpbmUgPSBlbnRpdHlCYXNlbGluZSB8fCB0aGlzLnN0YXRpY0Jhc2VsaW5lc1tjbGFzc0lkXTtcbiAgICAgICAgaWYgKCFiYXNlbGluZSkge1xuICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKGBubyBiYXNlbGluZSBmb3IgZW50aXR5ICR7aW5kZXh9IChjbGFzcyBJRCAke2NsYXNzSWR9KWApO1xuICAgICAgICB9XG4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gICAgICB2YXJOYW1lLFxuICAgICAgICAgICAgICAgICAgICBvbGRWYWx1ZSxcbiAgICAgICAgICAgICAgICAgICAgbmV3VmFsdWU6IHVwZGF0ZS52YWx1ZVxuICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgaWYgKHJlY29yZENoYW5nZXMpIHtcbiAgICAgICAgICAgIHRoaXMuZW1pdChcImNoYW5nZVwiLCB7XG4gICAgICAgICAgICAgICAgZW50aXR5LFxuICAgICAgICAgICAgICAgIGNoYW5nZXNcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgfVxuICAgIF91cGRhdGVzVG9Qcm9wT2JqZWN0KHRhcmdldCwgdXBkYXRlcykge1xuICAgICAgICBmb3IgKGNvbnN0IHVwZGF0ZSBvZiB1cGRhdGVzKSB7XG4gICAgICAgICAgICBjb25zdCB0YWJsZU5hbWUgPSB1cGRhdGUucHJvcC50YWJsZS5uZXRUYWJsZU5hbWU7XG4gICAgICAgICAgICBjb25zdCB2YXJOYW1lID0gdXBkYXRlLnByb3AucHJvcC52YXJOYW1lO1xuICAgICAgICAgICAgdGFyZ2V0W3RhYmxlTmFtZV0gPSBPYmplY3QuYXNzaWduKHRhcmdldFt0YWJsZU5hbWVdIHx8IHt9LCB7XG4gICAgICAgICAgICAgICAgW3Zhck5hbWVdOiB1cGRhdGUudmFsdWVcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiB0YXJnZXQ7XG4gICAgfVxuICAgIF9oYW5kbGVUZW1wRW50aXRpZXMobXNnKSB7XG4gICAgICAgIGNvbnN0IGVudGl0eUJpdEJ1ZmZlciA9IGJpdGJ1ZmZlcl8xLkJpdFN0cmVhbS5mcm9tKG1zZy5lbnRpdHlEYXRhKTtcbiAgICAgICAgbGV0IGxhc3RDbGFzc0lkID0gLTE7XG4gICAgICAgIGxldCBsYXN0UHJvcHMgPSBudWxsO1xuICAgICAgICAvLyBS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AgICAgICB9XG4gICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIC8vIDBiMTA6IEZIRFJfTEVBVkVQVlNcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgLy8gZXNsaW50LWRpc2FibGUtbmV4dC1saW5lIG5vLWR1cGUtZWxzZS1pZlxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZWxzZSBpZiAoZW50aXR5Qml0QnVmZmVyLnJlYWRPbmVCaXQoKSkge1xuICAgICAgICAgICAgICAgIC8vIDBiMDE6IEZIRFJfRU5URVJQVlNcbiAgICAgICAgICAgICAgICBmcmFtZS5hZGQoZW50aXR5SW5kZXgpO1xuICAgICAgICAgICAgICAgIGNvbnN0IGNsYXNzSWQgPSBlbnRpdHlCaXRCdWZmZXIucmVhZFVCaXRzKHRoaXMuc2VydmVyQ2xhc3NCaXRzKTtcbiAgICAgICAgICAgICAgICBjb25zdCBzZXJpYWxOdW0gPSBlbnRpdHlCaXRCdWZmZXIucmVhZFVCaXRzKGNvbnN0cy5OVU1fTkVUV09SS0VEX0VIQU5ETEVfU0VSSUFMX05VTUJFUl9CSVRTKTtcbiAgICAgICAgICAgICAgICBjb25zdCBleGlzdGluZ0Jhc2VsaW5lID0gdGhpcy5fZW50aXR5QmFzZWxpbmVzW21zZy5iYXNlbGluZV0uZ2V0KGVudGl0eUluZGV4KTtcbiAgICAgICAgICAgICAgICBjb25zdCBlbnRpdHlCYXNlbGluZVByb3BzID0gbXNnLmlzRGVsdGEgJiYgKGV4aXN0aW5nQmFzZWxpbmUgPT09IG51bGwgfHwgZXhpc3RpbmdCYXNlbGluZSA9PT0gdm9pZCAwID8gdm9pZCAwIDogZXhpc3RpbmdCYXNlbGluZS5jbGFzc0lkKSA9PT0gY2xhc3NJZFxuICAgICAgICAgICAgICAgICAgICA/IGV4aXN0aW5nQmFzZWxpbmUucHJvcHNcbiAgICAgICAgICAgICAgICAgICAgOiB1bmRlZmluZWQ7XG4gICAgICAgICAgICAgICAgY29uc3QgZXhpc3RpbmdFbnRpdHkgPSB0aGlzLmVudGl0aWVzLmdldChlbnRpdHlJbmRleCk7XG4gICAgICAgICAgICAgICAgY29uc3QgZW50aXR5ID0gdGhpcy5fYWRkRW50aXR5KGVudGl0eUluZGV4LCBjbGFzc0lkLCBzZXJpYWxOdW0sIGV4aXN0aW5nRW50aXR5LCBlbnRpdHlCYXNlbGluZVByb3BzKTtcbiAgICAgICAgICAgICAgICAvLyBlc2xpbnQtZGlzYWJsZS1uZXh0LWxpbmUgQHR5cGVzY3JpcHQtZXNsaW50L25vLXVuc2FmZS1hcmd1bWVudFxuICAgICAgICAgICAgICAgIHRoaXMuX3JlYWROZXdFbnRpdHkoZW50aXR5Qml0QnVmZmVyLCBlbnRpdHkpO1xuICAgICAgICAgICAgICAgIGlmIChlbnRpdHkgIT09IGV4aXN0aW5nRW50aXR5KSB7XG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IGV2ZW50VmFycyA9IHsgZW50aXR5IH07XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuZW1pdChcImNyZWF0ZVwiLCBldmVudFZhcnMpO1xuICAgICAgICAgICAgICAgICAgICAvLyBTdGlsbCBlbWl0ICdwb3N0Y3JlYXRlJyBmb3IgYmFja3dhcmRzIGNvbXBhdGliaWxpdHlcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5lbWl0KFwicG9zdGNyZWF0ZVwiLCBldmVudFZhcnMpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAvLyBVcGRhdGUgdGhlIE9USEVSIGJhc2VsaW5lIHdpdGggdGhlIG1lcmdlZCByZXN1bHQgb2YgYG9sZCBiYXNlbGluZSArIG5ldyBwcm9wc2BcbiAgICAgICAgICAgICAgICBpZiAobXNnLnVwZGF0ZUJhc2VsaW5lKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuX2VudGl0eUJhc2VsaW5lc1ttc2cuYmFzZWxpbmUgPyAwIDogMV0uc2V0KGVudGl0eUluZGV4LCB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjbGFzc0lkLFxuICAgICAgICAgICAgICAgICAgICAgICAgLy8gZXNsaW50LWRpc2FibGUtbmV4dC1saW5lIEB0eXBlc2NyaXB0LWVzbGludC9uby11bnNhZmUtYXJndW1lbnRcbiAgICAgICAgICAgICAgICAgICAgICAgIHByb3BzOiBjbG9uZVByb3BzKGVudGl0eS5wcm9wcylcbiAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgLy8gMGIwMDogRGVsdGFFbnRcbiAgICAgICAgICAgICAgICBjb25zdCBlbnRpdHkgPSAoMCwgYXNzZXJ0X2V4aXN0c18xLmRlZmF1bHQpKHRoaXMuZW50aXRpZXMuZ2V0KGVudGl0eUluZGV4KSwgYG1pc3NpbmcgY2xpZW50IGVudGl0eSAke2VudGl0eUluZGV4fWApO1xuICAgICAgICAgICAgICAgIGFzc2VydChmcmFtZS5jb250YWlucyhlbnRpdHlJbmRleCksIGBkZWx0YSBvbiBkb3JtYW50IGVudGl0eSAke2VudGl0eUluZGV4fWApO1xuICAgICAgICAgICAgICAgIHRoaXMuX3JlYWROZXdFbnRpdHkoZW50aXR5Qml0QnVmZmVyLCBlbnRpdHkpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIC8vIFJlYWQgZGVsZXRpb25zXG4gICAgICAgIGlmIChtc2cuaXNEZWx0YSkge1xuICAgICAgICAgICAgZW50aXR5SW5kZXggPSAtMTtcbiAgICAgICAgICAgIGNvbnN0IGRlbGV0aW9ucyA9IGVudGl0eUJpdEJ1ZmZlci5yZWFkVUJpdFZhcigpO1xuICAgICAgICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCBkZWxldGlvbnM7ICsraSkge1xuICAgICAgICAgICAgICAgIGVudGl0eUluZGV4ICs9IGVudGl0eU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NsaWVudFNsb3QsIG9sZFBsYXllckluZm8sIHBsYXllckluZm8pIHtcbiAgICAgICAgaWYgKG9sZFBsYXllckluZm8gIT0gbnVsbCkge1xuICAgICAgICAgICAgdGhpcy5fdXNlcklkVG9FbnRpdHkuZGVsZXRlKG9sZFBsYXllckluZm8udXNlcklkKTtcbiAgICAgICAgICAgIHRoaXMuX3N0ZWFtNjRJZFRvRW50aXR5LmRlbGV0ZShvbGRQbGF5ZXJJbmZvLnh1aWQudG9TdHJpbmcoKSk7XG4gICAgICAgICAgICB0aGlzLl9hY2NvdW50TnVtYmVyVG9FbnRpdHkuZGVsZXRlKG9sZFBsYXllckluZm8uZnJpZW5kc0lkKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAocGxheWVySW5mbyAhPSBudWxsKSB7XG4gICAgICAgICAgICB0aGlzLl91c2VySWRUb0VudGl0eS5zZXQocGxheWVySW5mby51c2VySWQsIGNsaWVudFNsb3QgKyAxKTtcbiAgICAgICAgICAgIHRoaXMuX3N0ZWFtNjRJZFRvRW50aXR5LnNldChwbGF5ZXJJbmZvLnh1aWQudG9TdHJpbmcoKSwgY2xpZW50U2xvdCArIDEpO1xuICAgICAgICAgICAgdGhpcy5fYWNjb3VudE51bWJlclRvRW50aXR5LnNldChwbGF5ZXJJbmZvLmZyaWVuZHNJZCwgY2xpZW50U2xvdCArIDEpO1xuICAgICAgICB9XG4gICAgfVxuICAgIF9oYW5kbGVJbnN0YW5jZUJhc2VsaW5lVXBkYXRlKGV2ZW50KSB7XG4gICAgICAgIGlmICghZXZlbnQudXNlckRhdGEpXG4gICAgICAgICAgICByZXR1cm47XG4gICAgICAgIGNvbnN0IGNsYXNzSWQgPSBwYXJzZUludChldmVudC5lbnRyeSwgMTApO1xuICAgICAgICBjb25zdCBiYXNlbGluZUJ1ZiA9IGJpdGJ1ZmZlcl8xLkJpdFN0cmVhbS5mcm9tKGV2ZW50LnVzZXJEYXRhKTtcbiAgICAgICAgaWYgKCF0aGlzLnNlcnZlck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F9waW5rXCIsXG4gICAgICAgIHRhZzogXCJQaW5rIEREUEFUXCJcbiAgICB9LFxuICAgIFwiOTBcIjoge1xuICAgICAgICBuYW1lOiBcImh5X21vdHRsZWRfc2FuZFwiLFxuICAgICAgICB0YWc6IFwiTXVkZGVyXCJcbiAgICB9LFxuICAgIFwiOTJcIjoge1xuICAgICAgICBuYW1lOiBcImh5X3JlZWZcIixcbiAgICAgICAgdGFnOiBcIkN5YW5vc3BhdHRlclwiXG4gICAgfSxcbiAgICBcIjkzXCI6IHtcbiAgICAgICAgbmFtZTogXCJzb19jYXJhbWVsXCIsXG4gICAgICAgIHRhZzogXCJDYXJhbWVsXCJcbiAgICB9LFxuICAgIFwiOTVcIjoge1xuICAgICAgICBuYW1lOiBcInNvX2dyYXNzbGFuZFwiLFxuICAgICAgICB0YWc6IFwiR3Jhc3NsYW5kXCJcbiAgICB9LFxuICAgIFwiOTZcIjoge1xuICAgICAgICBuYW1lOiBcInNvX21vc3NcIixcbiAgICAgICAgdGFnOiBcIkJsdWUgU3BydWNlXCJcbiAgICB9LFxuICAgIFwiOThcIjoge1xuICAgICAgICBuYW1lOiBcInNvX3B1cnBsZVwiLFxuICAgICAgICB0YWc6IFwiVWx0cmF2aW9sZXRcIlxuICAgIH0sXG4gICAgXCI5OVwiOiB7XG4gICAgICAgIG5hbWU6IFwic29fc2FuZFwiLFxuICAgICAgICB0YWc6IFwiU2FuZCBEdW5lXCJcbiAgICB9LFxuICAgIFwiMTAwXCI6IHtcbiAgICAgICAgbmFtZTogXCJzb19zdG9ybWZyb250XCIsXG4gICAgICAgIHRhZzogXCJTdG9ybVwiXG4gICAgfSxcbiAgICBcIjEwMVwiOiB7XG4gICAgICAgIG5hbWU6IFwic29fdG9ybmFkb1wiLFxuICAgICAgICB0YWc6IFwiVG9ybmFkb1wiXG4gICAgfSxcbiAgICBcIjEwMlwiOiB7XG4gICAgICAgIG5hbWU6IFwic29fd2hpdGVvdXRcIixcbiAgICAgICAgdGFnOiBcIldo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AgICAgICBuYW1lOiBcImN1X3B1cnBsZV9odW50c21hblwiLFxuICAgICAgICB0YWc6IFwiVWx0cmF2aW9sZXRcIlxuICAgIH0sXG4gICAgXCI2MjFcIjoge1xuICAgICAgICBuYW1lOiBcInNvX3B1cnBsZV9mYWxjaGlvblwiLFxuICAgICAgICB0YWc6IFwiVWx0cmF2aW9sZXRcIlxuICAgIH0sXG4gICAgXCI2MjJcIjoge1xuICAgICAgICBuYW1lOiBcImFtX2N6djJfbWZcIixcbiAgICAgICAgdGFnOiBcIlBvbHltZXJcIlxuICAgIH0sXG4gICAgXCI2MjNcIjoge1xuICAgICAgICBuYW1lOiBcImFxX2dsb2NrX2RhcmstZmFsbFwiLFxuICAgICAgICB0YWc6IFwiSXJvbndvcmtcIlxuICAgIH0sXG4gICAgXCI2MjRcIjoge1xuICAgICAgICBuYW1lOiBcImN1X3NzZzA4X2RyYWdvbmZpcmVfc2NvcGVcIixcbiAgICAgICAgdGFnOiBcIkRyYWdvbmZpcmVcIlxuICAgIH0sXG4gICAgXCI2MjVcIjoge1xuICAgICAgICBuYW1lOiBcImdzX2R1YWxfYmVyZXR0YXNfZ29sZGVuX3ZlbmljZVwiLFxuICAgICAgICB0YWc6IFwiUm95YWwgQ29uc29ydHNcIlxuICAgIH0sXG4gICAgXCI2MjZcIjoge1xuICAgICAgICBuYW1lOiBcImdzX2ZhbWFzX21lY2hhXCIsXG4gICAgICAgIHRhZzogXCJNZWNoYSBJbmR1c3RyaWVzXCJcbiAgICB9LFxuICAgIFwiNjI3XCI6IHtcbiAgICAgICAgbmFtZTogXCJnc19maW5hbF9wb29sZGVhZHYyXCIsXG4gICAgICAgIHRhZzogXCJDaXJydXNcIlxuICAgIH0sXG4gICAgXCI2MjhcIjoge1xuICAgICAgICBuYW1lOiBcImdzX2czc2cxX3ZpcGVyX3llbGxvd1wiLFxuICAgICAgICB0YWc6IFwiU3RpbmdlclwiXG4gICAgfSxcbiAgICBcIjYyOVwiOiB7XG4gICAgICAgIG5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xcbiAgICBcIjEwMDdcIjoge1xuICAgICAgICBuYW1lOiBcImFtX2hlaXN0X3BsYW5zX3llbGxvd1wiLFxuICAgICAgICB0YWc6IFwiVmF1bHQgSGVpc3RcIlxuICAgIH0sXG4gICAgXCIxMDA4XCI6IHtcbiAgICAgICAgbmFtZTogXCJoeV9ob3VuZHN0b290aF9icm93blwiLFxuICAgICAgICB0YWc6IFwiSG91bmRzdG9vdGhcIlxuICAgIH0sXG4gICAgXCIxMDA5XCI6IHtcbiAgICAgICAgbmFtZTogXCJnc19tYWMxMF9zbmFrZVwiLFxuICAgICAgICB0YWc6IFwiSG90IFNuYWtlc1wiXG4gICAgfSxcbiAgICBcIjEwMTBcIjoge1xuICAgICAgICBuYW1lOiBcImh5X3Bob2VuaXhfdGFnc19saWxhY1wiLFxuICAgICAgICB0YWc6IFwiUGhvZW5peCBDaGFsa1wiXG4gICAgfSxcbiAgICBcIjEwMTFcIjoge1xuICAgICAgICBuYW1lOiBcImFtX3Bob2VuaXhfdGFnc19ibHVlXCIsXG4gICAgICAgIHRhZzogXCJQaG9lbml4IE1hcmtlclwiXG4gICAgfSxcbiAgICBcIjEwMTJcIjoge1xuICAgICAgICBuYW1lOiBcImh5X3Bob2VuaXhfdGFnc19yZWRcIixcbiAgICAgICAgdGFnOiBcIlBob2VuaXggU3RlbmNpbFwiXG4gICAgfSxcbiAgICBcIjEwMTNcIjoge1xuICAgICAgICBuYW1lOiBcInNwX3Bob2VuaXhfdGFnc19wdXJwbGVcIixcbiAgICAgICAgdGFnOiBcIlBob2VuaXggQmxhY2tsaWdodFwiXG4gICAgfSxcbiAgICBcIjEwMTRcIjoge1xuICAgICAgICBuYW1lOiBcImh5X3RpZ2Vyc190YW5cIixcbiAgICAgICAgdGFnOiBcIkNsYXkgQW1idXNoXCJcbiAgICB9LFxuICAgIFwiMTAxNVwiOiB7XG4gICAgICAgIG5hbWU6IFwiYW1fdGlnZXJzX2Jyb3duXCIsXG4gICAgICAgIHRhZzogXCJUaWd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XllclwiLCBcIm1fbGlmZVN0YXRlXCIpO1xuICAgIH1cbiAgICAvKipcbiAgICAgKiBAcmV0dXJucyBsaWZlU3RhdGUgPT0gMFxuICAgICAqL1xuICAgIGdldCBpc0FsaXZlKCkge1xuICAgICAgICByZXR1cm4gdGhpcy5saWZlU3RhdGUgPT09IDAgLyogTGlmZVN0YXRlLkFsaXZlICovO1xuICAgIH1cbiAgICAvKipcbiAgICAgKiBAcmV0dXJucyBVc2VyIGluZm8gYXNzb2NpYXRlZCB3aXRoIHRoaXMgcGxheWVyXG4gICAgICovXG4gICAgZ2V0IHVzZXJJbmZvKCkge1xuICAgICAgICByZXR1cm4gdGhpcy5fZGVtby5lbnRpdGllcy5fdXNlckluZm9UYWJsZS5lbnRyaWVzW3RoaXMuY2xpZW50U2xvdF1cbiAgICAgICAgICAgIC51c2VyRGF0YTtcbiAgICB9XG4gICAgLyoqXG4gICAgICogQHJldHVybnMgVXNlciBJRFxuICAgICAqL1xuICAgIGdldCB1c2VySWQoKSB7XG4gICAgICAgIHJldHVybiB0aGlzLnVzZXJJbmZvLnVzZXJJZDtcbiAgICB9XG4gICAgLyoqXG4gICAgICogQHJldHVybnMgU3RlYW0gSURcbiAgICAgKi9cbiAgICBnZXQgc3RlYW1JZCgpIHtcbiAgICAgICAgcmV0dXJuIHRoaXMudXNlckluZm8uZ3VpZDtcbiAgICB9XG4gICAgLyoqXG4gICAgICogQHJldHVybnMgU3RlYW0gNjQgSURcbiAgICAgKi9cbiAgICBnZXQgc3RlYW02NElkKCkge1xuICAgICAgICBpZiAodGhpcy5fc3RlYW02NElkQ2FjaGUgPT09IHVuZGVmaW5lZClcbiAgICAgICAgICAgIHRoaXMuX3N0ZWFtNjRJZENhY2hlID0gdGhpcy51c2VySW5mby54dWlkLnRvU3RyaW5nKCk7XG4gICAgICAgIHJldHVybiB0aGlzLl9zdGVhbTY0SWRDYWNoZTtcbiAgICB9XG4gICAgLyoqXG4gICAgICogQHJldHVybnMgUGxheWVyIG5hb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0hlYWRTaG90S2lsbHNcIik7XG4gICAgICAgIGNvbnN0IG9iamVjdGl2ZSA9IHRoaXMuZ2V0SW5kZXhlZFByb3BzKFwibV9pTWF0Y2hTdGF0c19PYmplY3RpdmVcIik7XG4gICAgICAgIGNvbnN0IHJvdW5kcyA9IG5ldyBBcnJheSgpO1xuICAgICAgICBmb3IgKGxldCByb3VuZElkeCA9IDA7IHJvdW5kSWR4IDwga2lsbHMubGVuZ3RoOyArK3JvdW5kSWR4KSB7XG4gICAgICAgICAgICByb3VuZHMucHVzaCh7XG4gICAgICAgICAgICAgICAga2lsbHM6IGtpbGxzW3JvdW5kSWR4XSxcbiAgICAgICAgICAgICAgICBkYW1hZ2U6IGRhbWFnZVtyb3VuZElkeF0sXG4gICAgICAgICAgICAgICAgZXF1aXBtZW50VmFsdWU6IGVxdWlwbWVudFZhbHVlW3JvdW5kSWR4XSxcbiAgICAgICAgICAgICAgICBtb25leVNhdmVkOiBtb25leVNhdmVkW3JvdW5kSWR4XSxcbiAgICAgICAgICAgICAgICBraWxsUmV3YXJkOiBraWxsUmV3YXJkW3JvdW5kSWR4XSxcbiAgICAgICAgICAgICAgICBsaXZlVGltZTogbGl2ZVRpbWVbcm91bmRJZHhdLFxuICAgICAgICAgICAgICAgIGRlYXRoczogZGVhdGhzW3JvdW5kSWR4XSxcbiAgICAgICAgICAgICAgICBhc3Npc3RzOiBhc3Npc3RzW3JvdW5kSWR4XSxcbiAgICAgICAgICAgICAgICBoZWFkU2hvdEtpbGxzOiBoZWFkU2hvdEtpbGxzW3JvdW5kSWR4XSxcbiAgICAgICAgICAgICAgICBvYmplY3RpdmU6IG9iamVjdGl2ZVtyb3VuZElkeF1cbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiByb3VuZHM7XG4gICAgfVxuICAgIC8qKlxuICAgICAqIEByZXR1cm5zIE9iamVjdCByZXByZXNlbnRpbmcgdXNlci1jdXN0b21pc2FibGUgY3Jvc3NoYWlyIHN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gIGV2ZW50LnBhaW50S2l0ID1cbiAgICAgICAgICAgIGV2ZW50LndlYXBvbl9mYXV4aXRlbWlkICE9IFwiXCJcbiAgICAgICAgICAgICAgICA/IGl0ZW1kZWZzXzEucGFpbnRLaXRJbmRleE1hcFtMb25nLmZyb21TdHJpbmcoZXZlbnQud2VhcG9uX2ZhdXhpdGVtaWQsIHRydWUpXG4gICAgICAgICAgICAgICAgICAgIC5zaGlmdFJpZ2h0VW5zaWduZWQoMTYpXG4gICAgICAgICAgICAgICAgICAgIC5hbmQoMHhmZmZmKVxuICAgICAgICAgICAgICAgICAgICAudG9TdHJpbmcoKV1cbiAgICAgICAgICAgICAgICA6IG51bGw7XG4gICAgICAgIGV2ZW50Lm9yaWdpbmFsT3duZXIgPSBlbnRpdGllcy5nZXRCeVN0ZWFtNjRJZChldmVudC53ZWFwb25fb3JpZ2luYWxvd25lcl94dWlkKTtcbiAgICB9XG4gICAgZWxzZSBpZiAoZXZlbnROYW1lID09PSBcInBsYXllcl9ibGluZFwiKSB7XG4gICAgICAgIGV2ZW50LnBsYXllciA9IGVudGl0aWVzLmdldEJ5VXNlcklkKGV2ZW50LnVzZXJpZCk7XG4gICAgICAgIGV2ZW50LmF0dGFja2VyRW50aXR5ID0gZW50aXRpZXMuZ2V0QnlVc2VySWQoZXZlbnQuYXR0YWNrZXIpO1xuICAgICAgICBldmVudC5lbnRpdHkgPSBlbnRpdGllcy5lbnRpdGllcy5nZXQoZXZlbnQuZW50aXR5aWQpO1xuICAgIH1cbiAgICBlbHNlIGlmIChldmVudE5hbWUgPT09IFwicGxheWVyX2NoYW5nZW5hbWVcIikge1xuICAgICAgICBldmVudC5wbGF5ZXIgPSBlbnRpdGllcy5nZXRCeVVzZXJJZChldmVudC51c2VyaWQpO1xuICAgIH1cbiAgICBlbHNlIGlmIChldmVudE5hbWUgPT09IFwicGxheWVyX2NoYXRcIikge1xuICAgICAgICBldmVudC5wbGF5ZXIgPSBlbnRpdGllcy5nZXRCeVVzZXJJZChldmVudC51c2VyaWQpO1xuICAgIH1cbiAgICBlbHNlIGlmIChldmVudE5hbWUgPT09IFwicGxheWVyX2Nvbm5lY3RfZnVsbFwiKSB7XG4gICAgICAgIGV2ZW50LnBsYXllciA9IGVudGl0aWVzLmdldEJ5VXNlcklkKGV2ZW50LnVzZXJpZCk7XG4gICAgfVxuICAgIGVsc2UgaWYgKGV2ZW50TmFtZSA9PT0gXCJwbGF5ZXJfZGVhdGhcIikge1xuICAgICAgICBldmVudC5wbGF5ZXIgPSBlbnRpdGllcy5nZXRCeVVzZXJJZChldmVudC51c2VyaWQpO1xuICAgICAgICBldmVudC5hdHRhY2tlckVudGl0eSA9IGVudGl0aWVzLmdldEJ5VXNlcklkKGV2ZW50LmF0dGFja2VyKTtcbiAgICAgICAgZXZlbnQuYXNzaXN0ZXJFbnRpdHkgPSBlbnRpdGllcy5nZXRCeVVzZXJJZChldmVudC5hc3Npc3Rlcik7XG4gICAgICAgIGV2ZW50Lml0ZW1EZWZpbml0aW9uID1cbiAgICAgICAgICAgIGV2ZW50LndlYXBvbl9mYXV4aXRlbWlkICE9IFwiXCJcbiAgICAgICAgICAgICAgICA/IGl0ZW1kZWZzXzEuaXRlbURlZmluaXRpb25JbmRleE1hcFtMb25nLmZyb21TdHJpbmcoZXZlbnQud2VhcG9uX2ZhdXhpdGVtaWQsIHRydWUpXG4gICAgICAgICAgICAgICAgICAgIC5hbmQoMHhmZmZmKVxuICAgICAgICAgICAgICAgICAgICAudG9TdHJpbmcoKV1cbiAgICAgICAgICAgICAgICA6IG51bGw7XG4gICAgICAgIGV2ZW50LnBhaW50S2l0ID1cbiAgICAgICAgICAgIGV2ZW50LndlYXBvbl9mYXV4aXRlbWlkICE9IFwiXCJcbiAgICAgICAgICAgICAgICA/IGl0ZW1kZWZzXzEucGFpbnRLaXRJbmRleE1hcFtMb25nLmZyb21TdHJpbmcoZXZlbnQud2VhcG9uX2ZhdXhpdGVtaWQsIHRydWUpXG4gICAgICAgICAgICAgICAgICA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ZXJJZChldmVudC51c2VyaWQpO1xuICAgIH1cbiAgICBlbHNlIGlmIChldmVudE5hbWUgPT09IFwicGxheWVyX2p1bXBcIikge1xuICAgICAgICBldmVudC5wbGF5ZXIgPSBlbnRpdGllcy5nZXRCeVVzZXJJZChldmVudC51c2VyaWQpO1xuICAgIH1cbiAgICBlbHNlIGlmIChldmVudE5hbWUgPT09IFwicGxheWVyX3NwYXduXCIpIHtcbiAgICAgICAgZXZlbnQucGxheWVyID0gZW50aXRpZXMuZ2V0QnlVc2VySWQoZXZlbnQudXNlcmlkKTtcbiAgICB9XG4gICAgZWxzZSBpZiAoZXZlbnROYW1lID09PSBcInBsYXllcl90ZWFtXCIpIHtcbiAgICAgICAgZXZlbnQucGxheWVyID0gZW50aXRpZXMuZ2V0QnlVc2VySWQoZXZlbnQudXNlcmlkKTtcbiAgICB9XG4gICAgZWxzZSBpZiAoZXZlbnROYW1lID09PSBcInJvdW5kX212cFwiKSB7XG4gICAgICAgIGV2ZW50LnBsYXllciA9IGVudGl0aWVzLmdldEJ5VXNlcklkKGV2ZW50LnVzZXJpZCk7XG4gICAgfVxuICAgIGVsc2UgaWYgKGV2ZW50TmFtZSA9PT0gXCJzbW9rZWdyZW5hZGVfZGV0b25hdGVcIikge1xuICAgICAgICBldmVudC5wbGF5ZXIgPSBlbnRpdGllcy5nZXRCeVVzZXJJZChldmVudC51c2VyaWQpO1xuICAgICAgICBldmVudC5lbnRpdHkgPSBlbnRpdGllcy5lbnRpdGllcy5nZXQoZXZlbnQuZW50aXR5aWQpO1xuICAgIH1cbiAgICBlbHNlIGlmIChldmVudE5hbWUgPT09IFwic21va2VncmVuYWRlX2V4cGlyZWRcIikge1xuICAgICAgICBldmVudC5wbGF5ZXIgPSBlbnRpdGllcy5nZXRCeVVzZXJJZChldmVudC51c2VyaWQpO1xuICAgICAgICBldmVudC5lbnRpdHkgPSBlbnRpdGllcy5lbnRpdGllcy5nZXQoZXZlbnQuZW50aXR5aWQpO1xuICAgIH1cbiAgICBlbHNlIGlmIChldmVudE5hbWUgPT09IFwic3Vydml2YWxfcGFyYWRyb3BfYnJlYWtcIikge1xuICAgICAgICBldmVudC5lbnRpdHkgPSBlbnRpdGllcy5lbnRpdGllcy5nZXQoZXZlbnQuZW50aXR5aWQpO1xuICAgIH1cbiAgICBlbHNlIGlmIChldmVudE5hbWUgPT09IFwic3Vydml2YWxfcGFyYWRyb3Bfc3Bhd25cIikge1xuICAgICAgICBldmVudC5lbnRpdHkgPSBlbnRpdGllcy5lbnRpdGllcy5nZXQoZXZlbnQuZW50aXR5aWQpO1xuICAgIH1cbiAgICBlbHNlIGlmIChldmVudE5hbWUgPT09IFwidG91cm5hbWVudF9yZXdhcmRcIikge1xuICAgICAgICBldmVudC5pdGVtRGVmaW5pdGlvbiA9IGl0ZW1kZWZzXzEuaXRlbURlZmluaXRpb25JbmRleE1hcFtldmVudC5kZWZpbmRleF0gfHwgbnVsbDtcbiAgICAgICAgZXZlbnQuZW50aXR5ID0gZW50aXRpZXMuZ2V0QnlBY2NvdW50SWQoZXZlbnQuYWNjb3VudGlkKTtcbiAgICB9XG4gICAgZWxzZSBpZiAoZXZlbnROYW1lID09PSBcIndlYXBvbl9maXJlXCIpIHtcbiAgICAgICAgZXZlbnQucGxheWVyID0gZW50aXRpZXMuZ2V0QnlVc2VySWQoZXZlbnQudXNlcmlkKTtcbiAgICB9XG4gICAgZWxzZSBpZiAoZXZlbnROYW1lID09PSBcIndlYXBvbl9maXJlX29uX2VtcHR5XCIpIHtcbiAgICAgICAgZXZlbnQucGxheWVyID0gZW50aXRpZXMuZ2V0QnlVc2VySWQoZXZlbnQudXNlcmlkKTtcbiAgICB9XG4gICAgZWxzZSBpZiAoZXZlbnROYW1lID09PSBcIndlYXBvbl9vdXRvZmFtbW9cIikge1xuICAgICAgICBldmVudC5wbGF5ZXIgPSBlbnRpdGllcy5nZXRCeVVzZXJJZChldmVudC51c2VyaWQpO1xuICAgIH1cbiAgICBlbHNlIGlmIChldmVudE5hbWU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gICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgRXZlbnRLZXlUeXBlLlRZUEVfRkxPQVQ6XG4gICAgICAgICAgICAgICAgICAgIGV2ZW50W2tleU5hbWVdID0gdmFsdWUudmFsRmxvYXQ7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgRXZlbnRLZXlUeXBlLlRZUEVfTE9ORzpcbiAgICAgICAgICAgICAgICAgICAgZXZlbnRba2V5TmFtZV0gPSB2YWx1ZS52YWxMb25nO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIEV2ZW50S2V5VHlwZS5UWVBFX1NIT1JUOlxuICAgICAgICAgICAgICAgICAgICBldmVudFtrZXlOYW1lXSA9IHZhbHVlLnZhbFNob3J0O1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIEV2ZW50S2V5VHlwZS5UWVBFX0JZVEU6XG4gICAgICAgICAgICAgICAgICAgIGV2ZW50W2tleU5hbWVdID0gdmFsdWUudmFsQnl0ZTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSBFdmVudEtleVR5cGUuVFlQRV9CT09MOlxuICAgICAgICAgICAgICAgICAgICBldmVudFtrZXlOYW1lXSA9IHZhbHVlLnZhbEJvb2w7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgRXZlbnRLZXlUeXBlLlRZUEVfVUlOVDY0OlxuICAgICAgICAgICAgICAgICAgICBldmVudFtrZXlOYW1lXSA9IHZhbHVlLnZhbFVpbnQ2NDtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSBFdmVudEtleVR5cGUuVFlQRV9XU1RSSU5HOlxuICAgICAgICAgICAgICAgICAgICBldmVudFtrZXlOYW1lXSA9IHZhbHVlL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4ge1xuICAgICAgICAgICAgY29uc3QgZXZlbnQgPSB0aGlzLmdhbWVFdmVudExpc3RbbXNnLmV2ZW50aWRdO1xuICAgICAgICAgICAgaWYgKCFldmVudCkge1xuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGNvbnN0IGV2ZW50VmFycyA9IGV2ZW50Lm1lc3NhZ2VUb09iamVjdChtc2cpO1xuICAgICAgICAgICAgLy8gYnVmZmVyIGdhbWUgZXZlbnRzIHVudGlsIHRoZSBlbmQgb2YgdGhlIHRpY2tcbiAgICAgICAgICAgIHRoaXMuX3RpY2tFdmVudHMucHVzaCh7XG4gICAgICAgICAgICAgICAgbmFtZTogZXZlbnQubmFtZSxcbiAgICAgICAgICAgICAgICBldmVudDogKDAsIGV2ZW50dHlwZXNfMS5hbm5vdGF0ZUV2ZW50KShlbnRpdGllcywgZXZlbnQubmFtZSwgZXZlbnRWYXJzKVxuICAgICAgICAgICAgfSk7XG4gICAgICAgIH0pO1xuICAgICAgICBkZW1vLm9uKFwidGlja2VuZFwiLCAoKSA9PiB7XG4gICAgICAgICAgICB0aGlzLl90aWNrRXZlbnRzLmZvckVhY2goZXZlbnQgPT4ge1xuICAgICAgICAgICAgICAgIHRoaXMuZW1pdChldmVudC5uYW1lLCBldmVudC5ldmVudCk7XG4gICAgICAgICAgICAgICAgdGhpcy5lbWl0KFwiZXZlbnRcIiwge1xuICAgICAgICAgICAgICAgICAgICBuYW1lOiBldmVudC5uYW1lLFxuICAgICAgICAgICAgICAgICAgICAvLyBlc2xpbnQtZGlzYWJsZS1uZXh0LWxpbmUgQHR5cGVzY3JpcHQtZXNsaW50L25vLXVuc2FmZS1hc3NpZ25tZW50XG4gICAgICAgICAgICAgICAgICAgIGV2ZW50OiBldmVudC5ldmVudFxuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB0aGlzLl90aWNrRXZlbnRzID0gW107XG4gICAgICAgI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sZVwiLCB7IHZhbHVlOiB0cnVlIH0pO1xuZXhwb3J0cy5JY2VLZXkgPSB2b2lkIDA7XG5jbGFzcyBJY2VLZXkge1xuICAgIC8vIENyZWF0ZSBhIG5ldyBJQ0Uga2V5IHdpdGggdGhlIHNwZWNpZmllZCBsZXZlbC5cbiAgICBjb25zdHJ1Y3RvcihsZXZlbCkge1xuICAgICAgICB0aGlzLmNpcGhlckhvbGRlciA9IG5ldyBVaW50OEFycmF5KDgpO1xuICAgICAgICB0aGlzLnBsYWluSG9sZGVyID0gbmV3IFVpbnQ4QXJyYXkoOCk7XG4gICAgICAgIGlmICghSWNlS2V5LnNwQm94SW5pdGlhbGlzZWQpIHtcbiAgICAgICAgICAgIHRoaXMuc3BCb3hJbml0KCk7XG4gICAgICAgICAgICBJY2VLZXkuc3BCb3hJbml0aWFsaXNlZCA9IHRydWU7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKGxldmVsIDwgMSkge1xuICAgICAgICAgICAgdGhpcy5zaXplID0gMTtcbiAgICAgICAgICAgIHRoaXMucm91bmRzID0gODtcbiAgICAgICAgfVxuICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgIHRoaXMuc2l6ZSA9IGxldmVsO1xuICAgICAgICAgICAgdGhpcy5yb3VuZHMgPSBsZXZlbCAqIDE2O1xuICAgICAgICB9XG4gICAgICAgIHRoaXMua2V5U2NoZWR1bGUgPSBbXTtcbiAgICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCB0aGlzLnJvdW5kczsgaSsrKSB7XG4gICAgICAgICAgICB0aGlzLmtleVNjaGVkdWxlW2ldID0gW107XG4gICAgICAgICAgICBmb3IgKGxldCBqID0gMDsgaiA8IDM7IGorKykge1xuICAgICAgICAgICAgICAgIHRoaXMua2V5U2NoZWR1bGVbaV1bal0gPSAwO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfVxuICAgIC8vIFJldHVybiB0aGUga2V5IHNpemUsIGluIGJ5dGVzLlxuICAgIGtleVNpemUoKSB7XG4gICAgICAgIHJldHVybiB0aGlzLnNpemUgKiA4O1xuICAgIH1cbiAgICAvLyBSZXR1cm4gdGhlIGJsb2NrIHNpemUsIGluIGJ5dGVzLlxuICAgIGJsb2NrU2l6ZSgpIHtcbiAgICAgICAgcmV0dXJuIDg7XG4gICAgfVxuICAgIC8vIFNldCB0aGUga2V5IHNjaGVkdWxlIG9mIGFuIElDRSBrZXkuXG4gICAgc2V0KGtleSkge1xuICAgICAgICBjb25zdCBrYiA9IG5ldyBVaW50MTZBcnJheSg0KTtcbiAgICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCA0OyBpKyspXG4gICAgICAgICAgICBrYltpXSA9IDA7XG4gICAgICAgIGlmICh0aGlzLnJvdW5kcyA9PT0gOCkge1xuICAgICAgICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCA0OyBpKyspXG4gICAgICAgICAgICAgICAga2JbMyAtIGldID0gKChrZXlbaSAqIDJdICYgMHhmZikgPDwgOCkgfCAoa2V5W2kgKiAyICsgMV0gJiAweGZmKTtcbiAgICAgICAgICAgIHRoaXMuc2NoZWR1bGVCdWlsZChrYiwgMCwgMCk7XG4gICAgICAgICAgICByZXR1cm47XG4gICAgICAgIH1cbiAgICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCB0aGlzLnNpemU7IGkrKykge1xuICAgICAgICAgICAgZm9yIChsZXQgaiA9IDA7IGogPCA0OyBqKyspXG4gICAgICAgICAgICAgICAga2JbMyAtIGpdID1cbiAgICAgICAgICAgICAgICAgICAgKChrZXlbaSAqIDggKyBqICogMl0gJiAweGZmKSA8PCA4KSB8XG4gICAgICAgICAgICAgICAgICAgICAgICAoa2V5W2kgKiA4ICsgaiAqIDIgKyAxXSAmIDB4ZmYpO1xuICAgICAgICAgICAgdGhpcy5zY2hlZHVsZUJ1aWxkKGtiLCBpICogOCwgMCk7XG4gICAgICAgICAgICB0aGlzLnNjaGVkdWxlQnVpbGQoa2IsIHRoaXMucm91bmRzIC0gOCAtIGkgKiA4LCA4KTtcbiAgICAgICAgfVxuICAgIH1cbiAgICAvLyBDbGVhciB0aGUga2V5IHNjaGVkdWxlIHRvIHByZXZlbnQgbWVtb3J5IHNub29waW5nLlxuICAgIGNsZWFyKCkge1xuICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IHRoaXMucm91bmRzOyBpKyspXG4gICAgICAgICAgICBmb3IgKGxldCBqID0gMDsgaiA8IDM7IGorKylcbiAgICAgICAgICAgICAgICB0aGlzLmtleVNjaGVkdWxlW2ldW2pdID0gMDtcbiAgICB9XG4gICAgLy8gRW5jcnlwdCBhIGJsb2NrIG9mIDggYnl0ZXMgb2YgZGF0YS5cbiAgICBlbmNyeXB0KHBsYWludGV4dCwgY2lwaGVydGV4dCkge1xuICAgICAgICBsZXQgaTtcbiAgICAgICAgbGV0IGwgPSAwO1xuICAgICAgICBsZXQgciA9IDA7XG4gICAgICAgIGZvciAoaSA9IDA7IGkgPCA0OyBpKyspIHtcbiAgICAgICAgICAgIGwgfD0gKHBsYWludGV4dFtpXSAmIDB4ZmYpIDw8ICgyNCAtIGkgKiA4KTtcbiAgICAgICAgICAgIHIgfD0gKHBsYWludGV4dFtpICsgNF0gJiAweGZmKSA8PCAoMjQgLSBpICogOCk7XG4gICAgICAgIH1cbiAgICAgICAgZm9yIChpID0gMDsgaSA8IHRoaXMucm91bmRzOyBpICs9IDIpIHtcbiAgICAgICAgICAgIGwgXj0gdGhpcy5yb3VuZEZ1bmMociwgdGhpcy5rZXlTY2hlZHVsZVtpXSk7XG4gICAgICAgICAgICByIF49IHRoaXMucm91bmRGdW5jKGwsIHRoaXMua2V5U2NoZWR1bGVbaSArIDFdKTtcbiAgICAgICAgfVxuICAgICAgICBmb3IgKGkgPSAwOyBpIDwgNDsgaSsrKSB7XG4gICAgICAgICAgICBjaXBoZXJ0ZXh0WzMgLSBpXSA9IE51bWJlcihyICYgMHhmZik7XG4gICAgICAgICAgICBjaXBoZXJ0ZXh0WzcgLSBpXSA9IE51bWJlcihsICYgMHhmZik7XG4gICAgICAgICAgICByID4+Pj0gODtcbiAgICAgICAgICAgIGwgPj4+PSA4O1xuICAgICAgICB9XG4gICAgfVxuICAgIC8vIERlY3J5cHQgYSBibG9jayBvZiA4IGJ5dGVzIG9mIGRhdGEuXG4gICAgZGVjcnlwdChjaXBoZXJ0ZXh0LCBwbGFpbnRleHQpIHtcbiAgICAgICAgbGV0IGk7XG4gICAgICAgIGxldCBsID0gMDtcbiAgICAgICAgbGV0IHIgPSAwO1xuICAgICAgICBmb3IgKGkgPSAwOyBpIDwgNDsgaSsrKSB7XG4gICAgICAgICAgICBsIHw9IChjaXBoZXJ0ZXh0W2ldICYgMHhmZikgPDwgKDI0IC0gaSAqIDgpO1xuICAgICAgICAgICAgciB8PSAoY2lwaGVydGV4dFtpICsgNF0gJiAweGZmKSA8PCAoMjQgLSBpICogOCk7XG4gICAgICAgIH1cbiAgICAgICAgZm9yIChpID0gdGhpcy5yb3VuZHMgLSAxOyBpID4gMDsgaSAtPSAyKSB7XG4gICAgICAgICAgICBsIF49IHRoaXMucm91bmRGdW5jKHIsIHRoaXMua2V5U2NoZWR1bGVbaV0pO1xuICAgICAgICAgICAgciBePSB0aGlzLnJvdW5kRnVuYyhsLCB0aGlzLmtleVNjaGVkdWxlW2kgLSAxXSk7XG4gICAgICAgIH1cbiAgICAgICAgZm9yIChpID0gMDsgaSA8IDQ7IGkrKykge1xuICAgICAgICAgICAgcGxhaW50ZXh0WzMgLSBpXSA9IE51bWJlcihyICYgMHhmZik7XG4gICAgICAgICAgICBwbGFpbnRleHRbNyAtIGldID0gTnVtYmVyKGwgJiAweGZmKTtcbiAgICAgICAgICAgIHIgPj4+PSA4O1xuICAgICAgICAgICAgbCA+Pj49IDg7XG4gICAgICAgIH1cbiAgICB9XG4gICAgZGVjcnlwdFVpbnQ4QXJyYXkoY2lwaGVyQXJyYXksIHBsYWluQXJyYXksIGZyb20sIHRvKSB7XG4gICAgICAgIGlmIChmcm9tID09IG51bGwpXG4gICAgICAgICAgICBmcm9tID0gMDtcbiAgICAgICAgaWYgKHRvID09IG51bGwpXG4gICAgICAgICAgICB0byA9IGNpcGhlckFycmF5Lmxlbmd0aDtcbiAgICAgICAgbGV0IGsgPSAwO1xuICAgICAgICAvLyBkZWNyeXB0IGZ1bGwgYmxvY2tzXG4gICAgICAgIHdoaWxlIChmcm9tICsgOCA8PSB0bykge1xuICAgICAgICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCA4OyBpKyspIHtcbiAgICAgICAgICAgICAgICB0aGlzLmNpcGhlckhvbGRlcltpXSA9IGNpcGhlckFycmF5W2Zyb20gKyBpXTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHRoaXMuZGVjcnlwdCh0aGlzLmNpcGhlckhvbGRlciwgdGhpcy5wbGFpbkhvbGRlcik7XG4gICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IDg7IGkrKykge1xuICAgICAgICAgICAgICAgIHBsYWluQXJyYXlbayArIGldID0gdGhpcy5wbGFpbkhvbGRlcltpXTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGsgKz0gODtcbiAgICAgICAgICAgIGZyb20gKz0gODtcbiAgICAgICAgfVxuICAgICAgICAvLyByZW1haW5pbmcgYnl0ZXMgZG8gbm90IGdldCBlbmNyeXB0aW9uLCBqdXN0IGNvcHkgdGhlbVxuICAgICAgICBpZiAoKCh0byAtIGZyb20pICYgMHg3KSAhPT0gMCkge1xuICAgICAgICAgICAgZm9yIChsZXQgaSA9IGZyb207IGkgPCB0bzsgaSsrKSB7XG4gICAgICAgICAgICAgICAgcGxhaW5BcnJheVtrKytdID0gY2lwaGVyQXJyYXlbaV07XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9XG4gICAgLy8gOC1iaXQgR2Fsb2lzIEZpZWxkIG11bHRpcGxpY2F0aW9uIG9mIGEgYnkgYiwgbW9kdWxvIG0uXG4gICAgLy8gSnVzdCBsaWtlIGFyaXRobW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IT09IDApXG4gICAgICAgICAgICAgICAgcmVzIHw9IEljZUtleS5wQm94W2ldO1xuICAgICAgICAgICAgaSsrO1xuICAgICAgICAgICAgeCA+Pj49IDE7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHJlcztcbiAgICB9XG4gICAgLy8gSW5pdGlhbGlzZSB0aGUgc3Vic3RpdHV0aW9uL3Blcm11dGF0aW9uIGJveGVzLlxuICAgIHNwQm94SW5pdCgpIHtcbiAgICAgICAgSWNlS2V5LnNwQm94ID0gW107XG4gICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgNDsgaSsrKSB7XG4gICAgICAgICAgICBJY2VLZXkuc3BCb3hbaV0gPSBbXTtcbiAgICAgICAgICAgIGZvciAobGV0IGogPSAwOyBqIDwgMTAyNDsgaisrKSB7XG4gICAgICAgICAgICAgICAgSWNlS2V5LnNwQm94W2ldW2pdID0gMDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IDEwMjQ7IGkrKykge1xuICAgICAgICAgICAgY29uc3QgY29sID0gKGkgPj4+IDEpICYgMHhmZjtcbiAgICAgICAgICAgIGNvbnN0IHJvdyA9IChpICYgMHgxKSB8ICgoaSAmIDB4MjAwKSA+Pj4gOCk7XG4gICAgICAgICAgICBsZXQgeDtcbiAgICAgICAgICAgIHggPVxuICAgICAgICAgICAgICAgIHRoaXMuZ2ZfZXhwNyhjb2wgXiBJY2VLZXkuc1hvclswXVtyb3ddLCBJY2VLZXkuc01vZFswXVtyb3ddKSA8PCAyNDtcbiAgICAgICAgICAgIEljZUtleS5zcEJveFswXVtpXSA9IHRoaXMucGVybTMyKHgpO1xuICAgICAgICAgICAgeCA9XG4gICAgICAgICAgICAgICAgdGhpcy5nZl9leHA3KGNvbCBeIEljZUtleS5zWG9yWzFdW3Jvd10sIEljZUtleS5zTW9kWzFdW3Jvd10pIDw8IDE2O1xuICAgICAgICAgICAgSWNlS2V5LnNwQm94WzFdW2ldID0gdGhpcy5wZXJtMzIoeCk7XG4gICAgICAgICAgICB4ID0gdGhpcy5nZl9leHA3KGNvbCBeIEljZUtleS5zWG9yWzJdW3Jvd10sIEljZUtleS5zTW9kWzJdW3Jvd10pIDw8IDg7XG4gICAgICAgICAgICBJY2VLZXkuc3BCb3hbMl1baV0gPSB0aGlzLnBlcm0zMih4KTtcbiAgICAgICAgICAgIHggPSB0aGlzLmdmX2V4cDcoY29sIF4gSWNlS2V5LnNYb3JbM11bcm93XSwgSWNlS2V5LnNNb2RbM11bcm93XSk7XG4gICAgICAgICAgICBJY2VLZXkuc3BCb3hbM11baV0gPSB0aGlzLnBlcm0zMih4KTtcbiAgICAgICAgfVxuICAgIH1cbiAgICAvLyBTZXQgOCByb3VuZHMgW24sIG4rN10gb2YgdGhlIGtleSBzY2hlZHVsZSBvZiBhbiBJQ0Uga2V5LlxuICAgIHNjaGVkdWxlQnVpbGQoa2IsIG4sIGtyb3RJZHgpIHtcbiAgICAgICAgbGV0IGk7XG4gICAgICAgIGZvciAoaSA9IDA7IGkgPCA4OyBpKyspIHtcbiAgICAgICAgICAgIGxldCBqO1xuICAgICAgICAgICAgY29uc3Qga3IgPSBJY2VLZXkua2V5cm90W2tyb3RJZHggKyBpXTtcbiAgICAgICAgICAgIGNvbnN0IHN1YmtleSA9IHRoaXMua2V5U2NoZWR1bGVbbiArIGldO1xuICAgICAgICAgICAgZm9yIChqID0gMDsgaiA8IDM7IGorKylcbiAgICAgICAgICAgICAgICB0aGlzLmtleVNjaGVkdWxlW24gKyBpXVtqXSA9IDA7XG4gICAgICAgICAgICBmb3IgKGogPSAwOyBqIDwgMTU7IGorKykge1xuICAgICAgICAgICAgICAgIGxldCBrO1xuICAgICAgICAgICAgICAgIGNvbnN0IGN1clNrID0gaiAlIDM7XG4gICAgICAgICAgICAgICAgZm9yIChrID0gMDsgayA8IDQ7IGsrKykge1xuICAgICAgICAgICAgICAgICAgICBjb25zdCBjdXJLYiA9IGtiWyhrciArIGspICYgM107XG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IGJpdCA9IGN1cktiICYgMTtcbiAgICAgICAgICAgICAgICAgICAgc3Via2V5W2N1clNrXSA9IChzdWJrZXlbY3VyU2tdIDw8IDEpIHwgYml0O1xuICAgICAgICAgICAgICAgICAgICBrYlsoa3IgKyBrKSAmIDNdID0gKGN1cktiID4+PiAxKSB8ICgoYml0IF4gMSkgPDwgMTUpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cbiAgICAvLyBUaGUgc2luZ2xlIHJvdW5kIElDRSBmIGZ1bmN0aW9uLlxuICAgIHJvdW5kRnVuYyhwLCBzdWJrZXkpIHtcbiAgICAgICAgY29uc3QgdGwgPSAoKHAgPj4+IDE2KSAmIDB4M2ZmKSB8ICgoKHAgPj4+IDE0KSB8IChwIDw8IDE4KSkgJiAweGZmYzAwKTtcbiAgICAgICAgY29uc3QgdHIgPSAocCAmIDB4M2ZmKSB8ICgocCA8PCAyKSAmIDB4ZmZjMDApO1xuICAgICAgICBsZXQgYWwgPSBzdWJrZXlbMl0gJiAodGwgXiB0cik7XG4gICAgICAgIGxldCBhciA9IGFsIF4gdHI7XG4gICAgICAgIGFsIF49IHRsO1xuICAgICAgICBhbCBePSBzdWJrZXlbMF07XG4gICAgICAgIGFyIF49IHN1YmtleVsxXTtcbiAgICAgICAgcmV0dXJuIChJY2VLZXkuc3BCb3hbMF1bYWwgPj4+IDEwXSB8XG4gICAgICAgICAgICBJY2VLZXkuc3BCb3hbMV1bYWwgJiAweDNmZl0gfFxuICAgICAgICAgICAgSWNlS2V5LnNwQm94WzJdW2FyID4+PiAxMF0gfFxuICAgICAgICAgICAgSWNlS2V5LnNwQm94WzNdW2FyICYgMHgzZmZdKTtcbiAgICB9XG59XG5leHBvcnRzLkljZUtleSA9IEljZUtleTtcbkljZUtleS5zcEJveEluaXRpYWxpc2VkID0gZmFsc2U7XG5JY2VLZXkuc01vZCA9IF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MuU1BST1BfVkFSSU5UKSAhPT0gMCkge1xuICAgICAgICBpZiAoKHNlbmRQcm9wLmZsYWdzICYgZXhwb3J0cy5TUFJPUF9VTlNJR05FRCkgIT09IDApIHtcbiAgICAgICAgICAgIHJldHVybiBiaXRidWYgPT4gYml0YnVmLnJlYWRVVmFySW50MzIoKTtcbiAgICAgICAgfVxuICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgIHJldHVybiBiaXRidWYgPT4gYml0YnVmLnJlYWRWYXJJbnQzMigpO1xuICAgICAgICB9XG4gICAgfVxuICAgIGVsc2Uge1xuICAgICAgICBjb25zdCBudW1CaXRzID0gc2VuZFByb3AubnVtQml0cztcbiAgICAgICAgaWYgKChzZW5kUHJvcC5mbGFncyAmIGV4cG9ydHMuU1BST1BfVU5TSUdORUQpICE9PSAwKSB7XG4gICAgICAgICAgICBpZiAoKHNlbmRQcm9wLmZsYWdzICYgZXhwb3J0cy5TUFJPUF9OT1NDQUxFKSAhPT0gMCAmJlxuICAgICAgICAgICAgICAgIHNlbmRQcm9wLm51bUJpdHMgPT09IGNvbnN0c18xLk5VTV9ORVRXT1JLRURfRUhBTkRMRV9CSVRTKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGJpdGJ1ZiA9PiBuZXcgZW50aXR5aGFuZGxlXzEuRW50aXR5SGFuZGxlKGJpdGJ1Zi5yZWFkVUJpdHMobnVtQml0cykpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZWxzZSBpZiAobnVtQml0cyA9PT0gMSkge1xuICAgICAgICAgICAgICAgIHJldHVybiBiaXRidWYgPT4gYml0YnVmLnJlYWRPbmVCaXQoKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgIHJldHVybiBiaXRidWYgPT4gYml0YnVmLnJlYWRVQml0cyhudW1CaXRzKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgIHJ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mICgoc2VuZFByb3AuZmxhZ3MgJiBleHBvcnRzLlNQUk9QX1VOU0lHTkVEKSAhPT0gMCkge1xuICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFwiNjQtYml0IHVuc2lnbmVkIHZhcmludCBub3QgaW1wbGVtZW50ZWRcIik7IC8vIFRPRE9cbiAgICAgICAgfVxuICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcIjY0LWJpdCBzaWduZWQgdmFyaW50IG5vdCBpbXBsZW1lbnRlZFwiKTsgLy8gVE9ET1xuICAgICAgICB9XG4gICAgfVxuICAgIGVsc2Uge1xuICAgICAgICBjb25zdCBoaWdoQml0cyA9IHNlbmRQcm9wLm51bUJpdHMgLSAzMjtcbiAgICAgICAgaWYgKChzZW5kUHJvcC5mbGFncyAmIGV4cG9ydHMuU1BST1BfVU5TSUdORUQpICE9PSAwKSB7XG4gICAgICAgICAgICByZXR1cm4gYml0YnVmID0+IHtcbiAgICAgICAgICAgICAgICBjb25zdCBsb3dJbnQgPSBiaXRidWYucmVhZFVCaXRzKDMyKTtcbiAgICAgICAgICAgICAgICBjb25zdCBoaWdoSW50ID0gYml0YnVmLnJlYWRVQml0cyhoaWdoQml0cyk7XG4gICAgICAgICAgICAgICAgcmV0dXJuIExvbmcuZnJvbUJpdHMobG93SW50LCBoaWdoSW50LCBmYWxzZSk7XG4gICAgICAgICAgICB9O1xuICAgICAgICB9XG4gICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgcmV0dXJuIGJpdGJ1ZiA9PiB7XG4gICAgICAgICAgICAgICAgY29uc3QgbmVnID0gYml0YnVmLnJlYWRPbmVCaXQoKTtcbiAgICAgICAgICAgICAgICBjb25zdCBsb3dJbnQgPSBiaXRidWYucmVhZFVCaXRzKDMyKTtcbiAgICAgICAgICAgICAgICBjb25zdCBoaWdoSW50ID0gYml0YnVmLnJlYWRVQml0cyhoaWdoQml0cyAtIDEpO1xuICAgICAgICAgICAgICAgIHJldHVybiBMb25nLmZyb21CaXRzKGxvd0ludCwgaGlnaEludCwgIW5lZyk7XG4gICAgICAgICAgICB9O1xuICAgICAgICB9XG4gICAgfVxufVxuZnVuY3Rpb24gbWFrZVZhbHVlRGVjb2RlcihzZW5kUHJvcCkge1xuICAgIHN3aXRjaCAoc2VuZFByb3AudHlwZSkge1xuICAgICAgICBjYXNlIDAgLyogUHJvcFR5cGUuSW50ICovOlxuICAgICAgICAgICAgcmV0dXJuIG1ha2VJbnREZWNvZGVyKHNlbmRQcm9wKTtcbiAgICAgICAgY2FzZSAxIC8qIFByb3BUeXBlLkZsb2F0ICovOlxuICAgICAgICAgICAgcmV0dXJuIG1ha2VGbG9hdERlY29kZXIoc2VuZFByb3ApO1xuICAgICAgICBjYXNlIDIgLyogUHJvcFR5cGUuVmVjdG9yICovOlxuICAgICAgICAgICAgcmV0dXJuIG1ha2VWZWN0b3JEZWNvZGVyKHNlbmRQcm9wKTtcbiAgICAgICAgY2FzZSAzIC8qIFByb3BUeXBlLlZlY3RvclhZICovOlxuICAgICAgICAgICAgcmV0dXJuIG1ha2VWZWN0b3JYWURlY29kZXIoc2VuZFByb3ApO1xuICAgICAgICBjYXNlIDQgLyogUHJvcFR5cGUuU3RyaW5nICovOlxuICAgICAgICAgICAgcmV0dXJuIG1ha2VTdHJpbmdEZWNvZGVyKHNlbmRQcm9wKTtcbiAgICAgICAgY2FzZSA3IC8qIFByb3BUeXBlLkludDY0ICovOlxuICAgICAgICAgICAgcmV0dXJuIG1ha2VJbnQ2NERlY29kZXIoc2VuZFByb3ApO1xuICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKGBVbnN1cHBvcnRlZCBzZW5kIHByb3AgdHlwZSAke3NlbmRQcm9wLnR5cGV9YCk7XG4gICAgfVxufVxuZnVuY3Rpb24gbWFrZUFycmF5RGVjb2RlcihzZW5kUHJvcCwgYXJyYXlFbGVtZW50UHJvcCkge1xuICAgIGNvbnN0IG1heEV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ZWZpbmVkID8gcmVhZGVyLmxlbiA6IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlR2FtZVNlcnZlclBpbmcoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnBpbmcgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmlwID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuaW5zdGFuY2VzID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2IsIF9jO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUdhbWVTZXJ2ZXJQaW5nKCk7XG4gICAgICAgIG1lc3NhZ2UucGluZyA9IChfYSA9IG9iamVjdC5waW5nKSAhPT0gbnVsbCAmJiBfYSAhPT0gdm9pZCAwID8gX2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AgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VEYXRhQ2VudGVyUGluZygpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZGF0YUNlbnRlcklkID0gcmVhZGVyLmZpeGVkMzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnBpbmcgPSByZWFkZXIuc2ludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCBfYjtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VEYXRhQ2VudGVyUGluZygpO1xuICAgICAgICBtZXNzYWdlLmRhdGFDZW50ZXJJZCA9IChfYSA9IG9iamVjdC5kYXRhQ2VudGVySWQpICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6IDA7XG4gICAgICAgIG1lc3NhZ2UucGluZyA9IChfYiA9IG9iamVjdC5waW5nKSAhPT0gbnVsbCAmJiBfYiAhPT0gdm9pZCAwID8gX2IgOiAwO1xuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9XG59O1xuZnV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U2VhcmNoU3RhdGlzdGljKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5nYW1lVHlwZSA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnNlYXJjaFRpbWVBdmcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5wbGF5ZXJzU2VhcmNoaW5nID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2IsIF9jO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZURldGFpbGVkU2VhcmNoU3RhdGlzdGljKCk7XG4gICAgICAgIG1lc3NhZ2UuZ2FtZVR5cGUgPSAoX2EgPSBvYmplY3QuZ2FtZVR5cGUpICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6IDA7XG4gICAgICAgIG1lc3NhZ2Uuc2VhcmNoVGltZUF2ZyA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W5nKG1lc3NhZ2UucGxheWVyTmFtZSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UucGxheWVyRG9iICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDMyKS51aW50MzIobWVzc2FnZS5wbGF5ZXJEb2IpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnBsYXllckZsYWcgIT09IFwiXCIpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNDIpLnN0cmluZyhtZXNzYWdlLnBsYXllckZsYWcpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnBsYXllckxvY2F0aW9uICE9PSBcIlwiKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDUwKS5zdHJpbmcobWVzc2FnZS5wbGF5ZXJMb2NhdGlvbik7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UucGxheWVyRGVzYyAhPT0gXCJcIikge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig1OCkuc3RyaW5nKG1lc3NhZ2UucGxheWVyRGVzYyk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VUb3VybmFtZW50UGxheWVyKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5hY2NvdW50SWQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5wbGF5ZXJOaWNrID0gcmVhZGVyLnN0cmluZygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucGxheWVyTmFtZSA9IHJlYWRlci5zdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnBsYXllckRvYiA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA1OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnBsYXllckZsYWcgPSByZWFkZXIuc3RyaW5nKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5wbGF5ZXJMb2NhdGlvbiA9IHJlYWRlci5zdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA3OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnBsYXllckRlc2MgPSByZWFkZXIuc3RyaW5nKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2l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DIpLmZvcmsoKSkubGRlbGltKCk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VUb3VybmFtZW50VGVhbSgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudGVhbUlkID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50ZWFtVGFnID0gcmVhZGVyLnN0cmluZygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudGVhbUZsYWcgPSByZWFkZXIuc3RyaW5nKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50ZWFtTmFtZSA9IHJlYWRlci5zdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYW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mVudE5hbWUpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmV2ZW50VGltZVN0YXJ0ICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDMyKS51aW50MzIobWVzc2FnZS5ldmVudFRpbWVTdGFydCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuZXZlbnRUaW1lRW5kICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDQwKS51aW50MzIobWVzc2FnZS5ldmVudFRpbWVFbmQpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmV2ZW50UHVibGljICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDQ4KS5pbnQzMihtZXNzYWdlLmV2ZW50UHVibGljKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5ldmVudFN0YWdlSWQgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNTYpLmludDMyKG1lc3NhZ2UuZXZlbnRTdGFnZUlkKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5ldmVudFN0YWdlTmFtZSAhPT0gXCJcIikge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig2Nikuc3RyaW5nKG1lc3NhZ2UuZXZlbnRTdGFnZU5hbWUpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmFjdGl2ZVNlY3Rpb25JZCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig3MikudWludDMyKG1lc3NhZ2UuYWN0aXZlU2VjdGlvbklkKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZVRvdXJuYW1lbnRFdmVudCgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZXZlbnRJZCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZXZlbnRUYWcgPSByZWFkZXIuc3RyaW5nKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5ldmVudE5hbWUgPSByZWFkZXIuc3RyaW5nKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5ldmVudFRpbWVTdGFydCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA1OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmV2ZW50VGltZUVuZCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA2OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmV2ZW50UHVibGljID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5ldmVudFN0YWdlSWQgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA4OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmV2ZW50U3RhZ2VOYW1lID0gcmVhZGVyLnN0cmluZygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDk6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuYWN0aXZlU2VjdGlvbklkID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2IsIF9jLCBfZCwgX2UsIF9mLCBfZywgX2gsIF9qO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZVRvdXJuYW1lbnRFdmVudCgpO1xuICAgICAgICBtZXNzYWdlLmV2ZW50SWQgPSAoX2EgPSBvYmplY3QuZXZlbnRJZCkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogMDtcbiAgICAgICAgbWVzc2FnZS5ldmVudFRhZyA9IChfYiA9IG9iamVjdC5ldmVudFRhZykgIT09IG51bGwgJiYgX2IgIT09IHZvaWQgMCA/IF9iIDogX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ubGluZTogMCxcbiAgICAgICAgcGxheWVyc1NlYXJjaGluZzogMCxcbiAgICAgICAgc2VydmVyc0F2YWlsYWJsZTogMCxcbiAgICAgICAgb25nb2luZ01hdGNoZXM6IDAsXG4gICAgICAgIHNlYXJjaFRpbWVBdmc6IDAsXG4gICAgICAgIHNlYXJjaFN0YXRpc3RpY3M6IFtdLFxuICAgICAgICBtYWluUG9zdFVybDogXCJcIixcbiAgICAgICAgcmVxdWlyZWRBcHBpZFZlcnNpb246IDAsXG4gICAgICAgIHByaWNlc2hlZXRWZXJzaW9uOiAwLFxuICAgICAgICB0d2l0Y2hTdHJlYW1zVmVyc2lvbjogMCxcbiAgICAgICAgYWN0aXZlVG91cm5hbWVudEV2ZW50aWQ6IDAsXG4gICAgICAgIGFjdGl2ZVN1cnZleUlkOiAwLFxuICAgICAgICBydGltZTMyQ3VyOiAwLFxuICAgICAgICBydGltZTMyRXZlbnRTdGFydDogMFxuICAgIH07XG59XG5leHBvcnRzLkdsb2JhbFN0YXRpc3RpY3MgPSB7XG4gICAgZW5jb2RlKG1lc3NhZ2UsIHdyaXRlciA9IG1pbmltYWxfMS5Xcml0ZXIuY3JlYXRlKCkpIHtcbiAgICAgICAgaWYgKG1lc3NhZ2UucGxheWVyc09ubGluZSAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig4KS51aW50MzIobWVzc2FnZS5wbGF5ZXJzT25saW5lKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5zZXJ2ZXJzT25saW5lICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDE2KS51aW50MzIobWVzc2FnZS5zZXJ2ZXJzT25saW5lKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5wbGF5ZXJzU2VhcmNoaW5nICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDI0KS51aW50MzIobWVzc2FnZS5wbGF5ZXJzU2VhcmNoaW5nKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5zZXJ2ZXJzQXZhaWxhYmxlICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDMyKS51aW50MzIobWVzc2FnZS5zZXJ2ZXJzQXZhaWxhYmxlKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5vbmdvaW5nTWF0Y2hlcyAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig0MCkudWludDMyKG1lc3NhZ2Uub25nb2luZ01hdGNoZXMpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnNlYXJjaFRpbWVBdmcgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNDgpLnVpbnQzMihtZXNzYWdlLnNlYXJjaFRpbWVBdmcpO1xuICAgICAgICB9XG4gICAgICAgIGZvciAoY29uc3QgdiBvZiBtZXNzYWdlLnNlYXJjaFN0YXRpc3RpY3MpIHtcbiAgICAgICAgICAgIGV4cG9ydHMuRGV0YWlsZWRTZWFyY2hTdGF0aXN0aWMuZW5jb2RlKHYsIHdyaXRlci51aW50MzIoNTgpLmZvcmsoKSkubGRlbGltKCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UubWFpblBvc3RVcmwgIT09IFwiXCIpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNjYpLnN0cmluZyhtZXNzYWdlLm1haW5Qb3N0VXJsKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5yZXF1aXJlZEFwcGlkVmVyc2lvbiAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig3MikudWludDMyKG1lc3NhZ2UucmVxdWlyZWRBcHBpZFZlcnNpb24pO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnByaWNlc2hlZXRWZXJzaW9uICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDgwKS51aW50MzIobWVzc2FnZS5wcmljZXNoZWV0VmVyc2lvbik7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UudHdpdGNoU3RyZWFtc1ZlcnNpb24gIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoODgpLnVpbnQzMihtZXNzYWdlLnR3aXRjaFN0cmVhbXNWZXJzaW9uKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5hY3RpdmVUb3VybmFtZW50RXZlbnRpZCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig5NikudWludDMyKG1lc3NhZ2UuYWN0aXZlVG91cm5hbWVudEV2ZW50aWQpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmFjdGl2ZVN1cnZleUlkICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDEwNCkudWludDMyKG1lc3NhZ2UuYWN0aXZlU3VydmV5SWQpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnJ0aW1lMzJDdXIgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTEyKS51aW50MzIobWVzc2FnZS5ydGltZTMyQ3VyKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5ydGltZTMyRXZlbnRTdGFydCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigxMjApLnVpbnQzMihtZXNzYWdlLnJ0aW1lMzJFdmVudFN0YXJ0KTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUdsb2JhbFN0YXRpc3RpY3MoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnBsYXllcnNPbmxpbmUgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zZXJ2ZXJzT25saW5lID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucGxheWVyc1NlYXJjaGluZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnNlcnZlcnNBdmFpbGFibGUgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5vbmdvaW5nTWF0Y2hlcyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA2OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnNlYXJjaFRpbWVBdmcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zZWFyY2hTdGF0aXN0aWNzLnB1c2goZXhwb3J0cy5EZXRhaWxlZFNlYXJjaFN0YXRpc3RpYy5kZWNvZGUocmVhZGVyLCByZWFkZXIudWludDMyKCkpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA4OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm1haW5Qb3N0VXJsID0gcmVhZGVyLnN0cmluZygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDk6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucmVxdWlyZWRBcHBpZFZlcnNpb24gPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTA6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucHJpY2VzaGVldFZlcnNpb24gPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudHdpdGNoU3RyZWFtc1ZlcnNpb24gPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuYWN0aXZlVG91cm5hbWVudEV2ZW50aWQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuYWN0aXZlU3VydmV5SWQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTQ6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucnRpbWUzMkN1ciA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxNTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5ydGltZTMyRXZlbnRTdGFydCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iLCBfYywgX2QsIF9lLCBfZiwgX2csIF9oLCBfaiwgX2ssIF9sLCBfbSwgX28sIF9wLCBfcTtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VHbG9iYWxTdGF0aXN0aWNzKCk7XG4gICAgICAgIG1lc3NhZ2UucGxheWVyc09ubGluZSA9IChfYSA9IG9iamVjdC5wbGF5ZXJzT25saW5lKSAhPT0gbnVsbCAmJiBfYSAhPT0gdm9pZCAwID8gX2EgOiAwO1xuICAgICAgICBtZXNzYWdlLnNlcnZlcnNPbmxpbmUgPSAoX2IgPSBvYmplY3Quc2VydmVyc09ubGluZSkgIT09IG51bGwgJiYgX2IgIT09IHZvaWQgMCA/IF9iIDogMDtcbiAgICAgICAgbWVzc2FnZS5wbGF5ZXJzU2VhcmNoaW5nID0gKF9jID0gb2JqZWN0LnBsYXllc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09IFwiXCIpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTApLnN0cmluZyhtZXNzYWdlLm5hbWUpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmlka2V5ICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDE2KS51aW50MzIobWVzc2FnZS5pZGtleSk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VPcGVyYXRpb25hbFN0YXRpc3RpY0Rlc2NyaXB0aW9uKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5uYW1lID0gcmVhZGVyLnN0cmluZygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuaWRrZXkgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVH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cbiAgICAgICAgd3JpdGVyLmxkZWxpbSgpO1xuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZU9wZXJhdGlvbmFsU3RhdGlzdGljRWxlbWVudCgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuaWRrZXkgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgaWYgKCh0YWcgJiA3KSA9PT0gMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZW5kMiA9IHJlYWRlci51aW50MzIoKSArIHJlYWRlci5wb3M7XG4gICAgICAgICAgICAgICAgICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZDIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnZhbHVlcy5wdXNoKHJlYWRlci5pbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAg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gICAgICBpZiAobWVzc2FnZS5wYWNrZXRpZCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig4KS5pbnQzMihtZXNzYWdlLnBhY2tldGlkKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5tc3RpbWVzdGFtcCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigxNikuaW50MzIobWVzc2FnZS5tc3RpbWVzdGFtcCk7XG4gICAgICAgIH1cbiAgICAgICAgZm9yIChjb25zdCB2IG9mIG1lc3NhZ2UudmFsdWVzKSB7XG4gICAgICAgICAgICBleHBvcnRzLk9wZXJhdGlvbmFsU3RhdGlzdGljRWxlbWVudC5lbmNvZGUodiwgd3JpdGVyLnVpbnQzMigyNikuZm9yaygpKS5sZGVsaW0oKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZU9wZXJhdGlvbmFsU3RhdGlzdGljc1BhY2tldCgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucGFja2V0aWQgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm1zdGltZXN0YW1wID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS52YWx1ZXMucHVzaChleHBvcnRzLk9wZXJhdGlvbmFsU3RhdGlzdGljRWxlbWVudC5kZWNvZGUocmVhZGVyLCByZWFkZXIudWludDMyKCkpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iLCBfYztcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VPcGVyYXRpb25hbFN0YXRpc3RpY3NQYWNrZXQoKTtcbiAgICAgICAgbWVzc2FnZS5wYWNrZXRpZCA9IChfYSA9IG9iamVjdC5wYWNrZXRpZCkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogMDtcbiAgICAgICAgbWVzc2FnZS5tc3RpbWVzdGFtcCA9IChfYiA9IG9iamVjdC5tc3RpbWVzdGFtcCkgIT09IG51bGwgJiYgX2IgIT09IHZvaWQgMCA/IF9iIDogMDtcbiAgICAgICAgbWVzc2FnZS52YWx1ZXMgPVxuICAgICAgICAgICAgKChfYyA9IG9iamVjdC52YWx1ZXMpID09PSBudWxsIHx8IF9jID09PSB2b2lkIDAgPyB2b2lkIDAgOiBfYy5tYXAoZSA9PiBleHBvcnRzLk9wZXJhdGlvbmFsU3RhdGlzdGljRWxlbWVudC5mcm9tUGFydGlhbChlKSkpIHx8IFtdO1xuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9XG59O1xuZnVuY3Rpb24gY3JlYXRlQmFzZVBsYXllclJhbmtpbmdJbmZvKCkge1xuICAgIHJldHVybiB7XG4gICAgICAgIGFjY291bnRJZDogMCxcbiAgICAgICAgcmFua0lkOiAwLFxuICAgICAgICB3aW5zOiAwLFxuICAgICAgICByYW5rQ2hhbmdlOiAwLFxuICAgICAgICByYW5rVHlwZUlkOiAwLFxuICAgICAgICB0dkNvbnRyb2w6IDBcbiAgICB9O1xufVxuZXhwb3J0cy5QbGF5ZXJSYW5raW5nSW5mbyA9IHtcbiAgICBlbmNvZGUobWVzc2FnZSwgd3JpdGVyID0gbWluaW1hbF8xLldyaXRlci5jcmVhdGUoKSkge1xuICAgICAgICBpZiAobWVzc2FnZS5hY2NvdW50SWQgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoOCkudWludDMyKG1lc3NhZ2UuYWNjb3VudElkKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5yYW5rSWQgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTYpLnVpbnQzMihtZXNzYWdlLnJhbmtJZCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2Uud2lucyAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigyNCkudWludDMyKG1lc3NhZ2Uud2lucyk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UucmFua0NoYW5nZSAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigzNykuZmxvYXQobWVzc2FnZS5yYW5rQ2hhbmdlKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5yYW5rVHlwZUlkICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDQ4KS51aW50MzIobWVzc2FnZS5yYW5rVHlwZUlkKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS50dkNvbnRyb2wgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNTYpLnVpbnQzMihtZXNzYWdlLnR2Q29udHJvbCk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VQbGF5ZXJSYW5raW5nSW5mbygpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuYWNjb3VudElkID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucmFua0lkID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uud2lucyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnJhbmtDaGFuZ2UgPSByZWFkZXIuZmxvYXQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA2OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnJhbmtUeXBlSWQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50dkNvbnRyb2wgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCBfYiwgX2MsIF9kLCBfZSwgX2Y7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlUGxheWVyUmFua2luZ0luZm8oKTtcbiAgICAgICAgbWVzc2FnZS5hY2NvdW50SWQgPSAoX2EgPSBvYmplY3QuYWNjb3VudElkKSAhPT0gbnVsbCAmJiBfYSAhPT0gdm9pZCAwID8gX2EgOiAwO1xuICAgICAgICBtZXNzYWdlLnJhbmtJZCA9IChfYiA9IG9iamVjdC5yYW5rSWQpICE9PSBudWxsICYmIF9iICE9PSB2b2lkIDAgPyBfYiA6IDA7XG4gICAgICAgIG1lc3NhZ2Uud2lucy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AwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDMyKS51aW50MzIobWVzc2FnZS5jbWRMZWFkZXIpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiB3cml0ZXI7XG4gICAgfSxcbiAgICBkZWNvZGUoaW5wdXQsIGxlbmd0aCkge1xuICAgICAgICBjb25zdCByZWFkZXIgPSBpbnB1dCBpbnN0YW5jZW9mIG1pbmltYWxfMS5SZWFkZXIgPyBpbnB1dCA6IG5ldyBtaW5pbWFsXzEuUmVhZGVyKGlucHV0KTtcbiAgICAgICAgbGV0IGVuZCA9IGxlbmd0aCA9PT0gdW5kZWZpbmVkID8gcmVhZGVyLmxlbiA6IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlUGxheWVyQ29tbWVuZGF0aW9uSW5mbygpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuY21kRnJpZW5kbHkgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5jbWRUZWFjaGluZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmNtZExlYWRlciA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAg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Ckge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMih2KTtcbiAgICAgICAgfVxuICAgICAgICB3cml0ZXIubGRlbGltKCk7XG4gICAgICAgIGlmIChtZXNzYWdlLmZlYXR1cmVkRGlzcGxheUl0ZW1EZWZpZHggIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNjQpLnVpbnQzMihtZXNzYWdlLmZlYXR1cmVkRGlzcGxheUl0ZW1EZWZpZHgpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiB3cml0ZXI7XG4gICAgfSxcbiAgICBkZWNvZGUoaW5wdXQsIGxlbmd0aCkge1xuICAgICAgICBjb25zdCByZWFkZXIgPSBpbnB1dCBpbnN0YW5jZW9mIG1pbmltYWxfMS5SZWFkZXIgPyBpbnB1dCA6IG5ldyBtaW5pbWFsXzEuUmVhZGVyKGlucHV0KTtcbiAgICAgICAgbGV0IGVuZCA9IGxlbmd0aCA9PT0gdW5kZWZpbmVkID8gcmVhZGVyLmxlbiA6IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlUGxheWVyTWVkYWxzSW5mbygpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDc6XG4gICAgICAgICAgICAgICAgICAgIGlmICgodGFnICYgNykgPT09IDIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGVuZDIgPSByZWFkZXIudWludDMyKCkgKyByZWFkZXIucG9zO1xuICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5kaXNwbGF5SXRlbXNEZWZpZHgucHVzaChyZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5kaXNwbGF5SXRlbXNEZWZpZHgucHVzaChyZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgODpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5mZWF0dXJlZERpc3BsYXlJdGVtRGVmaWR4ID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2I7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlUGxheWVyTWVkYWxzSW5mbygpO1xuICAgICAgICBtZXNzYWdlLmRpc3BsYXlJdGVtc0RlZmlkeCA9ICgoX2EgPSBvYmplY3QuZGlzcGxheUl0ZW1zRGVmaWR4KSA9PT0gbnVsbCB8fCBfYSA9PT0gdm9pZCAwID8gdm9pZCAwIDogX2EubWFwKGUgPT4gZSkpIHx8IFtdO1xuICAgICAgICBtZXNzYWdlLmZlYXR1cmVkRGlzcGxheUl0ZW1EZWZpZHggPSAoX2IgPSBvYmplY3QuZmVhdHVyZWREaXNwbGF5SXRlbURlZmlkeCkgIT09IG51bGwgJiYgX2IgIT09IHZvaWQgMCA/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bGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VBY2NvdW50QWN0aXZpdHkoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmFjdGl2aXR5ID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubW9kZSA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm1hcCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm1hdGNoaWQgPSByZWFkZXIudWludDY0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCBfYiwgX2M7XG4gICAgICAgIG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lc3NhZ2UudGVhbUlkQ3QgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTYpLmludDMyKG1lc3NhZ2UudGVhbUlkQ3QpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnRlYW1JZFQgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMjQpLmludDMyKG1lc3NhZ2UudGVhbUlkVCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuZXZlbnRTdGFnZUlkICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDMyKS5pbnQzMihtZXNzYWdlLmV2ZW50U3RhZ2VJZCk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VUb3VybmFtZW50TWF0Y2hTZXR1cCgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZXZlbnRJZCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudGVhbUlkQ3QgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnRlYW1JZFQgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmV2ZW50U3RhZ2VJZCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2IsIF9jLCBfZDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VUb3VybmFtZW50TWF0Y2hTZXR1cCgpO1xuICAgICAgICBtZXNzYWdlLmV2ZW50SWQgPSAoX2EgPSBvYmplY3QuZXZlbnRJZCkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogMDtcbiAgICAgICAgbWVzc2FnZS50ZWFtSWRDdCA9IChfYiA9IG9iamVjdC50ZWFtSWRDdCkgIT09IG51bGwgJiYgX2IgIT09IHZvaWQgMCA/IF9iIDogMDtcbiAgICAgICAgbWVzc2FnZS50ZWFtSWRUID0gKF9jID0gb2JqZWN0LnRlYW1JZFQpICE9PSBudWxsICYmIF9jICE9PSB2b2lkIDAgPyBfYyA6IDA7XG4gICAgICAgIG1lc3NhZ2UuZXZlbnRT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AgICAgICAgICAgd3JpdGVyLnVpbnQzMig4KS51aW50MzIobWVzc2FnZS50dlVkcFBvcnQpO1xuICAgICAgICB9XG4gICAgICAgIGlmICghbWVzc2FnZS50dldhdGNoS2V5LmlzWmVybygpKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDE2KS51aW50NjQobWVzc2FnZS50dldhdGNoS2V5KTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS50dlNsb3RzICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDI0KS51aW50MzIobWVzc2FnZS50dlNsb3RzKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS50dkNsaWVudHMgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMzIpLnVpbnQzMihtZXNzYWdlLnR2Q2xpZW50cyk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UudHZQcm94aWVzICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDQwKS51aW50MzIobWVzc2FnZS50dlByb3hpZXMpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnR2VGltZSAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig0OCkudWludDMyKG1lc3NhZ2UudHZUaW1lKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5nYW1lVHlwZSAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig2NCkudWludDMyKG1lc3NhZ2UuZ2FtZVR5cGUpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmdhbWVNYXBncm91cCAhPT0gXCJcIikge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig3NCkuc3RyaW5nKG1lc3NhZ2UuZ2FtZU1hcGdyb3VwKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5nYW1lTWFwICE9PSBcIlwiKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDgyKS5zdHJpbmcobWVzc2FnZS5nYW1lTWFwKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAoIW1lc3NhZ2UudHZNYXN0ZXJTdGVhbWlkLmlzWmVybygpKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDg4KS51aW50NjQobWVzc2FnZS50dk1hc3RlclN0ZWFtaWQpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnR2TG9jYWxTbG90cyAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig5NikudWludDMyKG1lc3NhZ2UudHZMb2NhbFNsb3RzKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS50dkxvY2FsQ2xpZW50cyAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigxMDQpLnVpbnQzMihtZXNzYWdlLnR2TG9jYWxDbGllbnRzKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS50dkxvY2FsUHJveGllcyAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigxMTIpLnVpbnQzMihtZXNzYWdlLnR2TG9jYWxQcm94aWVzKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS50dlJlbGF5U2xvdHMgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTIwKS51aW50MzIobWVzc2FnZS50dlJlbGF5U2xvdHMpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnR2UmVsYXlDbGllbnRzICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDEyOCkudWludDMyKG1lc3NhZ2UudHZSZWxheUNsaWVudHMpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnR2UmVsYXlQcm94aWVzICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDEzNikudWludDMyKG1lc3NhZ2UudHZSZWxheVByb3hpZXMpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnR2UmVsYXlBZGRyZXNzICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDE0NCkudWludDMyKG1lc3NhZ2UudHZSZWxheUFkZHJlc3MpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnR2UmVsYXlQb3J0ICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDE1MikudWludDMyKG1lc3NhZ2UudHZSZWxheVBvcnQpO1xuICAgICAgICB9XG4gICAgICAgIGlmICghbWVzc2FnZS50dlJlbGF5U3RlYW1pZC5pc1plcm8oKSkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigxNjApLnVpbnQ2NChtZXNzYWdlLnR2UmVsYXlTdGVhbWlkKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5mbGFncyAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigxNjgpLnVpbnQzMihtZXNzYWdlLmZsYWdzKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZVNlcnZlckhsdHZJbmZvKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50dlVkcFBvcnQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50dldhdGNoS2V5ID0gcmVhZGVyLnVpbnQ2NCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudHZTbG90cyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnR2Q2xpZW50cyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA1OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnR2UHJveGllcyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA2OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnR2VGltZSA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA4OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmdhbWVUeXBlID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDk6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZ2FtZU1hcGdyb3VwID0gcmVhZGVyLnN0cmluZygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDEwOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmdhbWVNYXAgPSByZWFkZXIuc3RyaW5nKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudHZNYXN0ZXJTdGVhbWlkID0gcmVhZGVyLnVpbnQ2NCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDEyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnR2TG9jYWxTbG90cyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50dkxvY2FsQ2xpZW50cyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50dkxvY2FsUHJveGllcyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxNTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50dlJlbGF5U2xvdHMgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTY6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudHZSZWxheUNsaWVudHMgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTc6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudHZSZWxheVByb3hpZXMgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTg6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudHZSZWxheUFkZHJlc3MgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTk6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudHZSZWxheVBvcnQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjA6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudHZSZWxheVN0ZWFtaWQgPSByZWFkZXIudWludDY0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZmxhZ3MgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCBfYiwgX2MsIF9kLCBfZSwgX2YsIF9nLCBfaCwgX2osIF9rLCBfbCwgX20sIF9vLCBfcCwgX3EsIF9yLCBfcztcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VTZXJ2ZXJIbHR2SW5mbygpO1xuICAgICAgICBtZXNzYWdlLnR2VWRw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AgICAgICB3cml0ZXIudWludDMyKDE2KS51aW50MzIobWVzc2FnZS5iKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5jICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDI0KS51aW50MzIobWVzc2FnZS5jKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5kICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDMyKS51aW50MzIobWVzc2FnZS5kKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5iaXRzICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDQwKS51aW50MzIobWVzc2FnZS5iaXRzKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS50b2tlbiAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig0OCkudWludDMyKG1lc3NhZ2UudG9rZW4pO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiB3cml0ZXI7XG4gICAgfSxcbiAgICBkZWNvZGUoaW5wdXQsIGxlbmd0aCkge1xuICAgICAgICBjb25zdCByZWFkZXIgPSBpbnB1dCBpbnN0YW5jZW9mIG1pbmltYWxfMS5SZWFkZXIgPyBpbnB1dCA6IG5ldyBtaW5pbWFsXzEuUmVhZGVyKGlucHV0KTtcbiAgICAgICAgbGV0IGVuZCA9IGxlbmd0aCA9PT0gdW5kZWZpbmVkID8gcmVhZGVyLmxlbiA6IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlSXBBZGRyZXNzTWFzaygpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuYSA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmIgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5jID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA1OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmJpdHMgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50b2tlbiA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iLCBfYywgX2QsIF9lLCBfZjtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VJcEFkZHJlc3NNYXNrKCk7XG4gICAgICA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uICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmRlbHRhICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDE2KS5pbnQzMihtZXNzYWdlLmRlbHRhKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5hYnNvbHV0ZSA9PT0gdHJ1ZSkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigyNCkuYm9vbChtZXNzYWdlLmFic29sdXRlKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNNc2dDc2dvU3RlYW1Vc2VyU3RhdENoYW5nZSgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZWNzZ29zdGVhbXVzZXJzdGF0ID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5kZWx0YSA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmV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YgKG1lc3NhZ2UuaXRlbUF0dHJEZWZpZHggIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTYpLnVpbnQzMihtZXNzYWdlLml0ZW1BdHRyRGVmaWR4KTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5pdGVtQXR0ckRlbHRhVmFsdWUgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMjQpLnVpbnQzMihtZXNzYWdlLml0ZW1BdHRyRGVsdGFWYWx1ZSk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VNYXRjaEVuZEl0ZW1VcGRhdGVzKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5pdGVtSWQgPSByZWFkZXIudWludDY0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5pdGVtQXR0ckRlZmlkeCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLml0ZW1BdHRyRGVsdGFWYWx1ZSA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZU1hdGNoRW5kSXRlbVVwZGF0ZXMoKTtcbiAgICAgICAgbWVzc2FnZS5pdGVtSWQgPVxuICAgICAgICAgICAgb2JqZWN0Lml0ZW1JZCAhPT0gdW5kZWZpbmVkICYmIG9iamVjdC5pdGVtSWQgIT09IG51bGxcbiAgICAgICAgICAgICAgICA/IExvbmcuZnJvbVZhbHVlKG9iamVjdC5pdGVtSWQpXG4gICAgICAgICAgICAgICAgOiBMb25nLlVaRVJPO1xuICAgICAgICBtZXNzYWdlLml0ZW1BdHRyRGVmaWR4ID0gKF9hID0gb2JqZWN0Lml0ZW1BdHRyRGVmaWR4KSAhPT0gbnVsbCAmJiBfYSAhPT0gdm9pZCAwID8gX2EgOiAwO1xuICAgICAgICBtZXNzYWdlLml0ZW1BdHRyRGVsdGFWYWx1ZSA9IChfYiA9IG9iamVjdC5pdGVtQXR0ckRlbHRhVmFsdWUpICE9PSBudWxsICYmIF9iICE9PSB2b2lkIDAgPyBfYiA6IDA7XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH1cbn07XG5mdW5jdGlvbiBjcmVhdGVCYXNlU2NvcmVMZWFk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WFkZXIgPSBpbnB1dCBpbnN0YW5jZW9mIG1pbmltYWxfMS5SZWFkZXIgPyBpbnB1dCA6IG5ldyBtaW5pbWFsXzEuUmVhZGVyKGlucHV0KTtcbiAgICAgICAgbGV0IGVuZCA9IGxlbmd0aCA9PT0gdW5kZWZpbmVkID8gcmVhZGVyLmxlbiA6IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlU2NvcmVMZWFkZXJib2FyZERhdGEoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnF1ZXN0SWQgPSByZWFkZXIudWludDY0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zY29yZSA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmFjY291bnRlbnRyaWVzLnB1c2goZXhwb3J0cy5TY29yZUxlYWRlcmJvYXJkRGF0YV9BY2NvdW50RW50cmllcy5kZWNvZGUocmVhZGVyLCByZWFkZXIudWludDMyKCkpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA1OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm1hdGNoZW50cmllcy5wdXNoKGV4cG9ydHMuU2NvcmVMZWFkZXJib2FyZERhdGFfRW50cnkuZGVjb2RlKHJlYWRlciwgcmVhZGVyLnVpbnQzMigpKSk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCBfYiwgX2M7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlU2NvcmVMZWFkZXJib2FyZERhdGEoKTtcbiAgICAgICAgbWVzc2FnZS5xdWVzdElkID1cbiAgICAgICAgICAgIG9iamVjdC5xdWVzdElkICE9PSB1bmRlZmluZWQgJiYgb2JqZWN0LnF1ZXN0SWQgIT09IG51bGxcbiAgICAgICAgICAgICAgICA/IExvbmcuZnJvbVZhbHVlKG9iamVjdC5xdWVzdElkKVxuICAgICAgICAgICAgICAgIDogTG9uZy5VWkVSTztcbiAgICAgICAgbWVzc2FnZS5zY29yZSA9IChfYSA9IG9iamVjdC5zY29yZSkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogMDtcbiAgICAgICAgbWVzc2FnZS5hY2NvdW50ZW50cmllcyA9XG4gICAgICAgICAgICAoKF9iID0gb2JqZWN0LmFjY291bnRlbnRyaWVzKSA9PT0gbnVsbCB8fCBfYiA9PT0gdm9pZCAwID8gdm9pZCAwIDogX2IubWFwKGUgPT4gZXhwb3J0cy5TY29yZUxlYWRlcmJvYXJkRGF0YV9BY2NvdW50RW50cmllcy5mcm9tUGFydGlhbChlKSkpIHx8IFtdO1xuICAgICAgICBtZXNzYWdlLm1hdGNoZW50cmllcyA9XG4gICAgICAgICAgICAoKF9jID0gb2JqZWN0Lm1hdGNoZW50cmllcykgPT09IG51bGwgfHwgX2MgPT09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VuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudmFsID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2I7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlU2NvcmVMZWFkZXJib2FyZERhdGFfRW50cnkoKTtcbiAgICAgICAgbWVzc2FnZS50YWcgPSAoX2EgPSBvYmplY3QudGFnKSAhPT0gbnVsbCAmJiBfYSAhPT0gdm9pZCAwID8gX2EgOiAwO1xuICAgICAgICBtZXNzYWdlLnZhbCA9IChfYiA9IG9iamVjdC52YWwpICE9PSBudWxsICYmIF9iICE9PSB2b2lkIDAgPyBfYiA6IDA7XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH1cbn07XG5mdW5jdGlvbiBjcmVhdGVCYXNlU2NvcmVMZWFkZXJib2FyZERhdGFfQWNjb3VudEVudHJpZXMoKSB7XG4gICAgcmV0dXJuIHsgYWNjb3VudGlkOiAwLCBlbnRyaWVzOiBbXSB9O1xufVxuZX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Y291bnRpZCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmVudHJpZXMucHVzaChleHBvcnRzLlNjb3JlTGVhZGVyYm9hcmREYXRhX0VudHJ5LmRlY29kZShyZWFkZXIsIHJlYWRlci51aW50MzIoKSkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2I7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlU2NvcmVMZWFkZXJib2FyZERhdGFfQWNjb3VudEVudHJpZXMoKTtcbiAgICAgICAgbWVzc2FnZS5hY2NvdW50aWQgPSAoX2EgPSBvYmplY3QuYWNjb3VudGlkKSAhPT0gbnVsbCAmJiBfYSAhPT0gdm9pZCAwID8gX2EgOiAwO1xuICAgICAgICBtZXNzYWdlLmVudHJpZXMgPVxuICAgICAgICAgICAgKChfYiA9IG9iamVjdC5lbnRyaWVzKSA9PT0gbnVsbCB8fCBfYiA9PT0gdm9pZCAwID8gdm9pZCAwIDogX2IubWFwKGUgPT4gZXhwb3J0cy5TY29yZUxlYWRlcmJvYXJkRGF0YV9FbnRyeS5mcm9tUGFydGlhbChlKSkpIHx8IFtdO1xuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9XG59O1xuZnVuY3Rpb24gY3JlYXRlQmFzZVBsYXllclF1ZXN0RGF0YSgpIHtcbiAgICByZXR1cm4ge1xuICAgIC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c3NhZ2UgPSBjcmVhdGVCYXNlUGxheWVyUXVlc3REYXRhKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5xdWVzdGVyQWNjb3VudElkID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucXVlc3RJdGVtRGF0YS5wdXNoKGV4cG9ydHMuUGxheWVyUXVlc3REYXRhX1F1ZXN0SXRlbURhdGEuZGVjb2RlKHJlYWRlciwgcmVhZGVyLnVpbnQzMigpKSk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS54cFByb2dyZXNzRGF0YS5wdXNoKGV4cG9ydHMuWHBQcm9ncmVzc0RhdGEuZGVjb2RlKHJlYWRlciwgcmVhZGVyLnVpbnQzMigpKSk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50aW1lUGxheWVkID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubW1HYW1lTW9kZSA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA2OlxuICAgICAgICAgICAgICAgICAgICBtZXNz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F1ZXN0Qm9udXNQb2ludHNFYXJuZWQpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiB3cml0ZXI7XG4gICAgfSxcbiAgICBkZWNvZGUoaW5wdXQsIGxlbmd0aCkge1xuICAgICAgICBjb25zdCByZWFkZXIgPSBpbnB1dCBpbnN0YW5jZW9mIG1pbmltYWxfMS5SZWFkZXIgPyBpbnB1dCA6IG5ldyBtaW5pbWFsXzEuUmVhZGVyKGlucHV0KTtcbiAgICAgICAgbGV0IGVuZCA9IGxlbmd0aCA9PT0gdW5kZWZpbmVkID8gcmVhZGVyLmxlbiA6IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlUGxheWVyUXVlc3REYXRhX1F1ZXN0SXRlbURhdGEoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnF1ZXN0SWQgPSByZWFkZXIudWludDY0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5xdWVzdE5vcm1hbFBvaW50c0Vhcm5lZCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucXVlc3RCb251c1BvaW50c0Vhcm5lZCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFk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5nQ3Q6IGZhbHNlLFxuICAgICAgICBtYXRjaE91dGNvbWU6IDAsXG4gICAgICAgIHJvdW5kc1dvbjogMCxcbiAgICAgICAgcm91bmRzTG9zdDogMCxcbiAgICAgICAgc3RhdFNjb3JlOiAwLFxuICAgICAgICBzdGF0RGVhdGhzOiAwLFxuICAgICAgICBzdGF0TXZwczogMCxcbiAgICAgICAgZW5lbXlLaWxsczogMCxcbiAgICAgICAgZW5lbXlIZWFkc2hvdHM6IDAsXG4gICAgICAgIGVuZW15MmtzOiAwLFxuICAgICAgICBlbmVteTNrczogMCxcbiAgICAgICAgZW5lbXk0a3M6IDAsXG4gICAgICAgIHRvdGFsRGFtYWdlOiAwLFxuICAgICAgICBlbmdhZ2VtZW50c0VudHJ5Q291bnQ6IDAsXG4gICAgICAgIGVuZ2FnZW1lbnRzRW50cnlXaW5zOiAwLFxuICAgICAgICBlbmdhZ2VtZW50czF2MUNvdW50OiAwLFxuICAgICAgICBlbmdhZ2VtZW50czF2MVdpbnM6IDAsXG4gICAgICAgIGVuZ2FnZW1lbnRzMXYyQ291bnQ6IDAsXG4gICAgICAgIGVuZ2FnZW1lbnRzMXYyV2luczogMCxcbiAgICAgICAgdXRpbGl0eUNvdW50OiAwLFxuICAgICAgICB1dGlsaXR5U3VjY2VzczogMCxcbiAgICAgICAgZmxhc2hDb3VudDogMCxcbiAgICAgICAgZmxhc2hTdWNjZXNzOiAwLFxuICAgICAgICBtYXRlczogW11cbiAgICB9O1xufVxuZXhwb3J0cy5EZWVwUGxheWVyU3RhdHNFbnRyeSA9IHtcbiAgICBlbmNvZGUobWVzc2FnZSwgd3JpdGVyID0gbWluaW1hbF8xLldyaXRlci5jcmVhdGUoKSkge1xuICAgICAgICBpZiAobWVzc2FnZS5hY2NvdW50aWQgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoOCkudWludDMyKG1lc3NhZ2UuYWNjb3VudGlkKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAoIW1lc3NhZ2UubWF0Y2hJZC5pc1plcm8oKSkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigxNikudWludDY0KG1lc3NhZ2UubWF0Y2hJZCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UubW1HYW1lTW9kZSAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigyNCkudWludDMyKG1lc3NhZ2UubW1HYW1lTW9kZSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UubWFwaWQgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMzIpLnVpbnQzMihtZXNzYWdlLm1hcGlkKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5iU3RhcnRpbmdDdCA9PT0gdHJ1ZSkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig0MCkuYm9vbChtZXNzYWdlLmJTdGFydGluZ0N0KTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5tYXRjaE91dGNvbWUgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNDgpLnVpbnQzMihtZXNzYWdlLm1hdGNoT3V0Y29tZSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2Uucm91bmRzV29uICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDU2KS51aW50MzIobWVzc2FnZS5yb3VuZHNXb24pO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnJvdW5kc0xvc3QgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNjQpLnVpbnQzMihtZXNzYWdlLnJvdW5kc0xvc3QpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnN0YXRTY29yZSAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig3MikudWludDMyKG1lc3NhZ2Uuc3RhdFNjb3JlKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5zdGF0RGVhdGhzICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDk2KS51aW50MzIobWVzc2FnZS5zdGF0RGVhdGhzKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5zdGF0TXZwcyAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigxMDQpLnVpbnQzMihtZXNzYWdlLnN0YXRNdnBzKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5lbmVteUtpbGxzICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDExMikudWludDMyKG1lc3NhZ2UuZW5lbXlLaWxscyk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuZW5lbXlIZWFkc2hvdHMgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTIwKS51aW50MzIobWVzc2FnZS5lbmVteUhlYWRzaG90cyk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuZW5lbXkya3MgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTI4KS51aW50MzIobWVzc2FnZS5lbmVteTJrcyk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuZW5lbXkza3MgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTM2KS51aW50MzIobWVzc2FnZS5lbmVteTNrcyk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuZW5lbXk0a3MgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTQ0KS51aW50MzIobWVzc2FnZS5lbmVteTRrcyk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UudG90YWxEYW1hZ2UgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTUyKS51aW50MzIobWVzc2FnZS50b3RhbERhbWFnZSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuZW5nYWdlbWVudHNFbnRyeUNvdW50ICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDE4NCkudWludDMyKG1lc3NhZ2UuZW5nYWdlbWVudHNFbnRyeUNvdW50KTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5lbmdhZ2VtZW50c0VudHJ5V2lucyAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigxOTIpLnVpbnQzMihtZXNzYWdlLmVuZ2FnZW1lbnRzRW50cnlXaW5zKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5lbmdhZ2VtZW50czF2MUNvdW50ICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDIwMCkudWludDMyKG1lc3NhZ2UuZW5nYWdlbWVudHMxdjFDb3VudCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuZW5nYWdlbWVudHMxdjFXaW5zICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDIwOCkudWludDMyKG1lc3NhZ2UuZW5nYWdlbWVudHMxdjFXaW5zKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5lbmdhZ2VtZW50czF2MkNvdW50ICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDIxNikudWludDMyKG1lc3NhZ2UuZW5nYWdlbWVudHMxdjJDb3VudCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuZW5nYWdlbWVudHMxdjJXaW5zICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDIyNCkudWludDMyKG1lc3NhZ2UuZW5nYWdlbWVudHMxdjJXaW5zKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS51dGlsaXR5Q291bnQgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMjMyKS51aW50MzIobWVzc2FnZS51dGlsaXR5Q291bnQpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnV0aWxpdHlTdWNjZXNzICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDI0MCkudWludDMyKG1lc3NhZ2UudXRpbGl0eVN1Y2Nlc3MpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmZsYXNoQ291bnQgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMjU2KS51aW50MzIobWVzc2FnZS5mbGFzaENvdW50KTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5mbGFzaFN1Y2Nlc3MgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMjY0KS51aW50MzIobWVzc2FnZS5mbGFzaFN1Y2Nlc3MpO1xuICAgICAgICB9XG4gICAgICAgIHdyaXRlci51aW50MzIoMjc0KS5mb3JrKCk7XG4gICAgICAgIGZvciAoY29uc3QgdiBvZiBtZXNzYWdlLm1hdGVzKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKHYpO1xuICAgICAgICB9XG4gICAgICAgIHdyaXRlci5sZGVsaW0oKTtcbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VEZWVwUGxheWVyU3RhdHNFbnRyeSgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuYWNjb3VudGlkID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubWF0Y2hJZCA9IHJlYWRlci51aW50NjQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm1tR2FtZU1vZGUgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5tYXBpZCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA1OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmJTdGFydGluZ0N0ID0gcmVhZGVyLmJvb2woKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA2OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm1hdGNoT3V0Y29tZSA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA3OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnJvdW5kc1dvbiA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA4OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnJvdW5kc0xvc3QgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgOTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zdGF0U2NvcmUgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc3RhdERlYXRocyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zdGF0TXZwcyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5lbmVteUtpbGxzID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDE1OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmVuZW15SGVhZHNob3RzID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDE2OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmVuZW15MmtzID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDE3OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmVuZW15M2tzID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDE4OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmVuZW15NGtzID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDE5OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnRvdGFsRGFtYWdlID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDIzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmVuZ2FnZW1lbnRzRW50cnlDb3VudCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5lbmdhZ2VtZW50c0VudHJ5V2lucyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyNTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5lbmdhZ2VtZW50czF2MUNvdW50ID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI2OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmVuZ2FnZW1lbnRzMXYxV2lucyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyNzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5lbmdhZ2VtZW50czF2MkNvdW50ID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI4OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmVuZ2FnZW1lbnRzMXYyV2lucyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS51dGlsaXR5Q291bnQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzA6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudXRpbGl0eVN1Y2Nlc3MgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZmxhc2hDb3VudCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5mbGFzaFN1Y2Nlc3MgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzQ6XG4gICAgICAgICAgICAgICAgICAgIGlmICgodGFnICYgNykgPT09IDIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGVuZDIgPSByZWFkZXIudWludDMyKCkgKyByZWFkZXIucG9zO1xuICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5tYXRlcy5wdXNoKHJlYWRlci51aW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm1hdGVzLnB1c2gocmVhZGVyLnVpbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2IsIF9jLCBfZCwgX2UsIF9mLCBfZywgX2gsIF9qLCBfaywgX2wsIF9tLCBfbywgX3AsIF9xLCBfciwgX3MsIF90LCBfdSwgX3YsIF93LCBfeCwgX3ksIF96LCBfMCwgXzEsIF8yO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZURlZXBQbGF5ZXJTdGF0c0VudHJ5KCk7XG4gICAgICAgIG1lc3NhZ2UuYWNjb3VudGlkID0gKF9hID0gb2JqZWN0LmFjY291bnRpZCkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogMDtcbiAgICAgICAgbWVzc2FnZS5tYXRjaElkID1cbiAgICAgICAgICAgIG9iamVjdC5tYXRjaElkICE9PSB1bmRlZmluZWQgJiYgb2JqZWN0Lm1hdGNoSWQgIT09IG51bGxcbiAgICAgICAgICAgICAgICA/IExvbmcuZnJvbVZhbHVlKG9iamVjdC5tYXRjaElkKVxuICAgICAgICAgICAgICAgIDogTG9uZy5VWkVSTztcbiAgICAgICAgbWVzc2FnZS5tbUdhbWVNb2RlID0gKF9iID0gb2JqZWN0Lm1tR2FtZU1vZGUpICE9PSBudWxsICYmIF9iICE9PSB2b2lkIDAgPyBfYiA6IDA7XG4gICAgICAgIG1lc3NhZ2UubWFwaWQgPSAoX2MgPSBvYmplY3QubW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WNjb3VudGlkOiAwLFxuICAgICAgICBtYXRjaElkOiBMb25nLlVaRVJPLFxuICAgICAgICBldmVudElkOiAwLFxuICAgICAgICBldmVudFR5cGU6IDAsXG4gICAgICAgIGJQbGF5aW5nQ3Q6IGZhbHNlLFxuICAgICAgICB1c2VyUG9zWDogMCxcbiAgICAgICAgdXNlclBvc1k6IDAsXG4gICAgICAgIHVzZXJQb3NaOiAwLFxuICAgICAgICB1c2VyRGVmaWR4OiAwLFxuICAgICAgICBvdGhlclBvc1g6IDAsXG4gICAgICAgIG90aGVyUG9zWTogMCxcbiAgICAgICAgb3RoZXJQb3NaOiAwLFxuICAgICAgICBvdGhlckRlZmlkeDogMCxcbiAgICAgICAgZXZlbnREYXRhOiAwXG4gICAgfTtcbn1cbmV4cG9ydHMuRGVlcFBsYXllck1hdGNoRXZlbnQgPSB7XG4gICAgZW5jb2RlKG1lc3NhZ2UsIHdyaXRlciA9IG1pbmltYWxfMS5Xcml0ZXIuY3JlYXRlKCkpIHtcbiAgICAgICAgaWYgKG1lc3NhZ2UuYWNjb3VudGlkICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDgpLnVpbnQzMihtZXNzYWdlLmFjY291bnRpZCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKCFtZXNzYWdlLm1hdGNoSWQuaXNaZXJvKCkpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTYpLnVpbnQ2NChtZXNzYWdlLm1hdGNoSWQpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmV2ZW50SWQgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMjQpLnVpbnQzMihtZXNzYWdlLmV2ZW50SWQpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmV2ZW50VHlwZSAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigzMikudWludDMyKG1lc3NhZ2UuZXZlbnRUeXBlKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5iUGxheWluZ0N0ID09PSB0cnVlKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDQwKS5ib29sKG1lc3NhZ2UuYlBsYXlpbmdDdCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UudXNlclBvc1ggIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNDgpLmludDMyKG1lc3NhZ2UudXNlclBvc1gpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnVzZXJQb3NZICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDU2KS5pbnQzMihtZXNzYWdlLnVzZXJQb3NZKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS51c2VyUG9zWiAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig5NikuaW50MzIobWVzc2FnZS51c2VyUG9zWik7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UudXNlckRlZmlkeCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig2NCkudWludDMyKG1lc3NhZ2UudXNlckRlZmlkeCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2Uub3RoZXJQb3NYICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDcyKS5pbnQzMihtZXNzYWdlLm90aGVyUG9zWCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2Uub3RoZXJQb3NZICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDgwKS5pbnQzMihtZXNzYWdlLm90aGVyUG9zWSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2Uub3RoZXJQb3NaICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDEwNCkuaW50MzIobWVzc2FnZS5vdGhlclBvc1opO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLm90aGVyRGVmaWR4ICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDg4KS51aW50MzIobWVzc2FnZS5vdGhlckRlZmlkeCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuZXZlbnREYXRhICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDExMikuaW50MzIobWVzc2FnZS5ldmVudERhdGEpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiB3cml0ZXI7XG4gICAgfSxcbiAgICBkZWNvZGUoaW5wdXQsIGxlbmd0aCkge1xuICAgICAgICBjb25zdCByZWFkZXIgPSBpbnB1dCBpbnN0YW5jZW9mIG1pbmltYWxfMS5SZWFkZXIgPyBpbnB1dCA6IG5ldyBtaW5pbWFsXzEuUmVhZGVyKGlucHV0KTtcbiAgICAgICAgbGV0IGVuZCA9IGxlbmd0aCA9PT0gdW5kZWZpbmVkID8gcmVhZGVyLmxlbiA6IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlRGVlcFBsYXllck1hdGNoRXZlbnQoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmFjY291bnRpZCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm1hdGNoSWQgPSByZWFkZXIudWludDY0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5ldmVudElkID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZXZlbnRUeXBlID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuYlBsYXlpbmdDdCA9IHJlYWRlci5ib29sKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS51c2VyUG9zWCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDc6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudXNlclBvc1kgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS51c2VyUG9zWiA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDg6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudXNlckRlZmlkeCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA5OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm90aGVyUG9zWCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDEwOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm90aGVyUG9zWSA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDEzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm90aGVyUG9zWiA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDExOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm90aGVyRGVmaWR4ID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDE0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmV2ZW50RGF0YSA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2IsIF9jLCBfZCwgX2UsIF9mLCBfZywgX2gsIF9qLCBfaywgX2wsIF9tLCBfbztcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VEZWVwUGxheWVyTWF0Y2hFdmVudCgpO1xuICAgICAgICBtZXNzYWdlLmFjY291bnRpZCA9IChfYSA9IG9iamVjdC5hY2NvdW50aWQpICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6IDA7XG4gICAgICAgIG1lc3NhZ2UubWF0Y2hJZCA9XG4gICAgICAgICAgICBvYmplY3QubWF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+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnBsYXllclF1ZXN0RGF0YS5wdXNoKGV4cG9ydHMuUGxheWVyUXVlc3REYXRhLmRlY29kZShyZWFkZXIsIHJlYWRlci51aW50MzIoKSkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuYmluYXJ5RGF0YSA9IHJlYWRlci5ieXRlcygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubW1HYW1lTW9kZSA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm1pc3Npb25sYnNkYXRhID0gZXhwb3J0cy5TY29yZUxlYWRlcmJvYXJkRGF0YS5kZWNvZGUocmVhZGVyLCByZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2IsIF9jO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNNc2dHQ1NlcnZlclF1ZXN0VXBkYXRlRGF0YSgpO1xuICAgICAgICBtZXNzYWdlLnBsYXllclF1ZXN0RGF0YSA9XG4gICAgICAgICAgICAo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AgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucGFja2V0aWQgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm5hbWVrZXlzLnB1c2goZXhwb3J0cy5PcGVyYXRpb25hbFN0YXRpc3RpY0Rlc2NyaXB0aW9uLmRlY29kZShyZWFkZXIsIHJlYWRlci51aW50MzIoKSkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucGFja2V0cy5wdXNoKGV4cG9ydHMuT3BlcmF0aW9uYWxTdGF0aXN0aWNzUGFja2V0LmRlY29kZShyZWFkZXIsIHJlYWRlci51aW50MzIoKSkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2IsIF9jO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNNc2dHQ0NTdHJpa2UxNVYyTWF0Y2htYWtpbmdHQ09wZXJhdGlvbmFsU3RhdHMoKTtcbiAgICAgICAgbWVzc2FnZS5wYWNrZXRpZCA9IChfYSA9IG9iamVjdC5wYWNrZXRpZCkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogMDtcbiAgICA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KTtcbiAgICAgICAgfVxuICAgICAgICBpZiAoIW1lc3NhZ2UuZXhjaGFuZ2UuaXNaZXJvKCkpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMjQpLnVpbnQ2NChtZXNzYWdlLmV4Y2hhbmdlKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNNc2dHQ0NTdHJpa2UxNVYyTWF0Y2htYWtpbmdHQzJTZXJ2ZXJDb25maXJtKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50b2tlbiA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnN0YW1wID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZXhjaGFuZ2UgPSByZWFkZXIudWludDY0KCk7XG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mV0dXJuIHtcbiAgICAgICAgYWNjb3VudElkczogW10sXG4gICAgICAgIGdhbWVUeXBlOiAwLFxuICAgICAgICB0aWNrZXREYXRhOiBcIlwiLFxuICAgICAgICBjbGllbnRWZXJzaW9uOiAwLFxuICAgICAgICB0b3VybmFtZW50TWF0Y2g6IHVuZGVmaW5lZCxcbiAgICAgICAgcHJpbWVPbmx5OiBmYWxzZSxcbiAgICAgICAgdHZDb250cm9sOiAwLFxuICAgICAgICBsb2JieUlkOiBMb25nLlVaRVJPXG4gICAgfTtcbn1cbmV4cG9ydHMuQ01zZ0dDQ1N0cmlrZTE1VjJNYXRjaG1ha2luZ1N0YXJ0ID0ge1xuICAgIGVuY29kZShtZXNzYWdlLCB3cml0ZXIgPSBtaW5pbWFsXzEuV3JpdGVyLmNyZWF0ZSgpKSB7XG4gICAgICAgIHdyaXRlci51aW50MzIoMTApLmZvcmsoKTtcbiAgICAgICAgZm9yIChjb25zdCB2IG9mIG1lc3NhZ2UuYWNjb3VudElkcykge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMih2KTtcbiAgICAgICAgfVxuICAgICAgICB3cml0ZXIubGRlbGltKCk7XG4gICAgICAgIGlmIChtZXNzYWdlLmdhbWVUeXBlICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDE2KS51aW50MzIobWVzc2FnZS5nYW1lVHlwZSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UudGlja2V0RGF0YSAhPT0gXCJcIikge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigyNikuc3RyaW5nKG1lc3NhZ2UudGlja2V0RGF0YSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuY2xpZW50VmVyc2lvbiAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigzMikudWludDMyKG1lc3NhZ2UuY2xpZW50VmVyc2lvbik7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UudG91cm5hbWVudE1hdGNoICE9PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgIGV4cG9ydHMuVG91cm5hbWVudE1hdGNoU2V0dXAuZW5jb2RlKG1lc3NhZ2UudG91cm5hbWVudE1hdGNoLCB3cml0ZXIudWludDMyKDQyKS5mb3JrKCkpLmxkZWxpbSgpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnByaW1lT25seSA9PT0gdHJ1ZSkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig0OCkuYm9vbChtZXNzYWdlLnByaW1lT25seSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UudHZDb250cm9sICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDU2KS51aW50MzIobWVzc2FnZS50dkNvbnRyb2wpO1xuICAgICAgICB9XG4gICAgICAgIGlmICghbWVzc2FnZS5sb2JieUlkLmlzWmVybygpKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDY0KS51aW50NjQobWVzc2FnZS5sb2JieUlkKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNNc2dHQ0NTdHJpa2UxNVYyTWF0Y2htYWtpbmdTdGFydCgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIGlmICgodGFnICYgNykgPT09IDIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGVuZDIgPSByZWFkZXIudWludDMyKCkgKyByZWFkZXIucG9zO1xuICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5hY2NvdW50SWRzLnB1c2gocmVhZGVyLnVpbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuYWNjb3VudElkcy5wdXNoKHJlYWRlci51aW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmdhbWVUeXBlID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudGlja2V0RGF0YSA9IHJlYWRlci5zdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmNsaWVudFZlcnNpb24gPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50b3VybmFtZW50TWF0Y2ggPSBleHBvcnRzLlRvdXJuYW1lbnRNYXRjaFNldHVwLmRlY29kZShyZWFkZXIsIHJlYWRlci51aW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5wcmltZU9ubHkgPSByZWFkZXIuYm9vbCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDc6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudHZDb250cm9sID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDg6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubG9iYnlJZCA9IHJlYWRlci51aW50NjQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iLCBfYywgX2QsIF9lLCBfZjtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMk1hdGNobWFraW5nU3RhcnQoKTtcbiAgICAgICAgbWVzc2FnZS5hY2NvdW50SWRzID0gKChfYSA9IG9iamVjdC5hY2NvdW50SWRzKSA9PT0gbnVsbCB8fCBfYSA9PT0gdm9pZCAwID8gdm9pZCAwIDogX2EubWFwKGUgPT4gZSkpIHx8IFtdO1xuICAgICAgICBtZXNzYWdlLmdhbWVUeXBlID0gKF9iID0gb2JqZWN0LmdhbWVUeXBlKSAhPT0gbnVsbCAmJiBfYiAhPT0gdm9pZCAwID8gX2IgOiAwO1xuICAgICAgICBtZXNzYWdlLnRpY2tldERhdGEgPSAoX2MgPSBvYmplY3QudGlja2V0RGF0YSkgIT09IG51bGwgJiYgX2MgIT09IHZvaWQgMCA/IF9jIDogXCJcIjtcbiAgICAgICAgbWVzc2FnZS5jbGllbnRWZXJzaW9uID0gKF9kID0gb2JqZWN0LmNsaWVudFZlcnNpb24pICE9PSBudWxsICYmIF9kICE9PSB2b2lkIDAgPyBfZCA6IDA7XG4gICAgICAgIG1lc3NhZ2UudG91cm5hbWVudE1hdGNoID1cbiAgICAgICAgICAgIG9iamVjdC50b3VybmFtZW50TWF0Y2ggIT09IHVuZGVmaW5lZCAmJiBvYmplY3QudG91cm5hbWVudE1hdGNoICE9PSBudWxsXG4gICAgICAgICAgICAgICAgPyBleHBvcnRzLlRvdXJuYW1lbnRNYXRjaFNldHVwLmZyb21QYXJ0aWFsKG9iamVjdC50b3VybmFtZW50TWF0Y2gpXG4gICAgICAgICAgICAgICAgOiB1bmRlZmluZWQ7XG4gICAgICAgIG1lc3NhZ2UucHJpbWVPbmx5ID0gKF9lID0gb2JqZWN0LnByaW1lT25seSkgIT09IG51bGwgJiYgX2UgIT09IHZvaWQgMCA/IF9lIDogZmFsc2U7XG4gICAgICAgIG1lc3NhZ2UudHZDb250cm9sID0gKF9mID0gb2JqZWN0LnR2Q29udHJvbCkgIT09IG51bGwgJiYgX2YgIT09IHZvaWQgMCA/IF9mIDogMDtcbiAgICAgICAgbWVzc2FnZS5sb2JieUlkID1cbiAgICAgICAgICAgIG9iamVjdC5sb2JieUlkICE9PSB1bmRlZmluZWQgJiYgb2JqZWN0LmxvYmJ5SWQgIT09IG51bGxcbiAgICAgICAgICAgICAgICA/IExvbmcuZnJvbVZhbHVlKG9iamVjdC5sb2JieUlkKVxuICAgICAgICAgICAgICAgIDogTG9uZy5VW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7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNNc2dHQ0NTdHJpa2UxNVYyTWF0Y2htYWtpbmdDbGllbnQyU2VydmVyUGluZygpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZ2FtZXNlcnZlcnBpbmdzLnB1c2goZXhwb3J0cy5HYW1lU2VydmVyUGluZy5kZWNvZGUocmVhZGVyLCByZWFkZXIudWludDMyKCkpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm9mZnNldEluZGV4ID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5maW5hbEJhdGNoID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5kYXRhQ2VudGVyUGluZ3MucHVzaChleHBvcnRzLkRhdGFDZW50ZXJQaW5nLmRlY29kZShyZWFkZXIsIHJlYWRlci51aW50MzIoKSkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uub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mluZWQsXG4gICAgICAgIG5vdGVzOiBbXSxcbiAgICAgICAgcGVuYWx0eUFjY291bnRJZFNlc3Npb25zR3JlZW46IFtdLFxuICAgICAgICBpbnN1ZmZpY2llbnRsZXZlbFNlc3Npb25zOiBbXSxcbiAgICAgICAgdnNuY2hlY2tBY2NvdW50SWRTZXNzaW9uczogW10sXG4gICAgICAgIGxhdW5jaGVyTWlzbWF0Y2hTZXNzaW9uczogW10sXG4gICAgICAgIGluc2VjdXJlQWNjb3VudElkU2Vzc2lvbnM6IFtdXG4gICAgfTtcbn1cbmV4cG9ydHMuQ01zZ0dDQ1N0cmlrZTE1VjJNYXRjaG1ha2luZ0dDMkNsaWVudFVwZGF0ZSA9IHtcbiAgICBlbmNvZGUobWVzc2FnZSwgd3JpdGVyID0gbWluaW1hbF8xLldyaXRlci5jcmVhdGUoKSkge1xuICAgICAgICBpZiAobWVzc2FnZS5tYXRjaG1ha2luZyAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig4KS5pbnQzMihtZXNzYWdlLm1hdGNobWFraW5nKTtcbiAgICAgICAgfVxuICAgICAgICB3cml0ZXIudWludDMyKDE4KS5mb3JrKCk7XG4gICAgICAgIGZvciAoY29uc3QgdiBvZiBtZXNzYWdlLndhaXRpbmdBY2NvdW50SWRTZXNzaW9ucykge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMih2KTtcbiAgICAgICAgfVxuICAgICAgICB3cml0ZXIubGRlbGltKCk7XG4gICAgICAgIGlmIChtZXNzYWdlLmVycm9yICE9PSBcIlwiKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDI2KS5zdHJpbmcobWVzc2FnZS5lcnJvcik7XG4gICAgICAgIH1cbiAgICAgICAgd3JpdGVyLnVpbnQzMig1MCkuZm9yaygpO1xuICAgICAgICBmb3IgKGNvbnN0IHYgb2YgbWVzc2FnZS5vbmdvaW5nbWF0Y2hBY2NvdW50SWRTZXNzaW9ucykge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMih2KTtcbiAgICAgICAgfVxuICAgICAgICB3cml0ZXIubGRlbGltKCk7XG4gICAgICAgIGlmIChtZXNzYWdlLmdsb2JhbFN0YXRzICE9PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgIGV4cG9ydHMuR2xvYmFsU3RhdGlzdGljcy5lbmNvZGUobWVzc2FnZS5nbG9iYWxTdGF0cywgd3JpdGVyLnVpbnQzMig1OCkuZm9yaygpKS5sZGVsaW0oKTtcbiAgICAgICAgfVxuICAgICAgICB3cml0ZXIudWludDMyKDY2KS5mb3JrKCk7XG4gICAgICAgIGZvciAoY29uc3QgdiBvZiBtZXNzYWdlLmZhaWxwaW5nQWNjb3VudElkU2Vzc2lvbnMpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIodik7XG4gICAgICAgIH1cbiAgICAgICAgd3JpdGVyLmxkZWxpbSgpO1xuICAgICAgICB3cml0ZXIudWludDMyKDc0KS5mb3JrKCk7XG4gICAgICAgIGZvciAoY29uc3QgdiBvZiBtZXNzYWdlLnBlbmFsdHlBY2NvdW50SWRTZXNzaW9ucykge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMih2KTtcbiAgICAgICAgfVxuICAgICAgICB3cml0ZXIubGRlbGltKCk7XG4gICAgICAgIHdyaXRlci51aW50MzIoODIpLmZvcmsoKTtcbiAgICAgICAgZm9yIChjb25zdCB2IG9mIG1lc3NhZ2UuZmFpbHJlYWR5QWNjb3VudElkU2Vzc2lvbnMpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIodik7XG4gICAgICAgIH1cbiAgICAgICAgd3JpdGVyLmxkZWxpbSgpO1xuICAgICAgICB3cml0ZXIudWludDMyKDkwKS5mb3JrKCk7XG4gICAgICAgIGZvciAoY29uc3QgdiBvZiBtZXNzYWdlLnZhY2Jhbm5lZEFjY291bnRJZFNlc3Npb25zKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKHYpO1xuICAgICAgICB9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AgICAgIH1cbiAgICAgICAgd3JpdGVyLmxkZWxpbSgpO1xuICAgICAgICB3cml0ZXIudWludDMyKDEzOCkuZm9yaygpO1xuICAgICAgICBmb3IgKGNvbnN0IHYgb2YgbWVzc2FnZS5sYXVuY2hlck1pc21hdGNoU2Vzc2lvbnMpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIodik7XG4gICAgICAgIH1cbiAgICAgICAgd3JpdGVyLmxkZWxpbSgpO1xuICAgICAgICB3cml0ZXIudWludDMyKDE0NikuZm9yaygpO1xuICAgICAgICBmb3IgKGNvbnN0IHYgb2YgbWVzc2FnZS5pbnNlY3VyZUFjY291bnRJZFNlc3Npb25zKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKHYpO1xuICAgICAgICB9XG4gICAgICAgIHdyaXRlci5sZGVsaW0oKTtcbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMk1hdGNobWFraW5nR0MyQ2xpZW50VXBkYXRlKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5tYXRjaG1ha2luZyA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIGlmICgodGFnICYgNykgPT09IDIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGVuZDIgPSByZWFkZXIudWludDMyKCkgKyByZWFkZXIucG9zO1xuICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS53YWl0aW5nQWNjb3VudElkU2Vzc2lvbnMucHVzaChyZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS53YWl0aW5nQWNjb3VudElkU2Vzc2lvbnMucHVzaChyZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5lcnJvciA9IHJlYWRlci5zdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA2OlxuICAgICAgICAgICAgICAgICAgICBpZiAoKHRhZyAmIDcpID09PSAyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBlbmQyID0gcmVhZGVyLnVpbnQzMigpICsgcmVhZGVyLnBvcztcbiAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uub25nb2luZ21hdGNoQWNjb3VudElkU2Vzc2lvbnMucHVzaChyZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5vbmdvaW5nbWF0Y2hBY2NvdW50SWRTZXNzaW9ucy5wdXNoKHJlYWRlci51aW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA3OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmdsb2JhbFN0YXRzID0gZXhwb3J0cy5HbG9iYWxTdGF0aXN0aWNzLmRlY29kZShyZWFkZXIsIHJlYWRlci51aW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgODpcbiAgICAgICAgICAgICAgICAgICAgaWYgKCh0YWcgJiA3KSA9PT0gMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZW5kMiA9IHJlYWRlci51aW50MzIoKSArIHJlYWRlci5wb3M7XG4gICAgICAgICAgICAgICAgICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZDIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmZhaWxwaW5nQWNjb3VudElkU2Vzc2lvbnMucHVzaChyZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5mYWlscGluZ0FjY291bnRJZFNlc3Npb25zLnB1c2gocmVhZGVyLnVpbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDk6XG4gICAgICAgICAgICAgICAgICAgIGlmICgodGFnICYgNykgPT09IDIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGVuZDIgPSByZWFkZXIudWludDMyKCkgKyByZWFkZXIucG9zO1xuICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5wZW5hbHR5QWNjb3VudElkU2Vzc2lvbnMucHVzaChyZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5wZW5hbHR5QWNjb3VudElkU2Vzc2lvbnMucHVzaChyZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTA6XG4gICAgICAgICAgICAgICAgICAgIGlmICgodGFnICYgNykgPT09IDIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGVuZDIgPSByZWFkZXIudWludDMyKCkgKyByZWFkZXIucG9zO1xuICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5mYWlscmVhZHlBY2NvdW50SWRTZXNzaW9ucy5wdXNoKHJlYWRlci51aW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmZhaWxyZWFkeUFjY291bnRJZFNlc3Npb25zLnB1c2gocmVhZGVyLnVpbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDExOlxuICAgICAgICAgICAgICAgICAgICBpZiAoKHRhZyAmIDcpID09PSAyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBlbmQyID0gcmVhZGVyLnVpbnQzMigpICsgcmVhZGVyLnBvcztcbiAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudmFjYmFubmVkQWNjb3VudElkU2Vzc2lvbnMucHVzaChyZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS52YWNiYW5uZWRBY2NvdW50SWRTZXNzaW9ucy5wdXNoKHJlYWRlci51aW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zZXJ2ZXJJcGFkZHJlc3NNYXNrID0gZXhwb3J0cy5JcEFkZHJlc3NNYXNrLmRlY29kZShyZWFkZXIsIHJlYWRlci51aW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uubm90ZXMucHVzaChleHBvcnRzLkNNc2dHQ0NTdHJpa2UxNVYyTWF0Y2htYWtpbmdHQzJDbGllbnRVcGRhdGVfTm90ZS5kZWNvZGUocmVhZGVyLCByZWFkZXIudWludDMyKCkpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxNDpcbiAgICAgICAgICAgICAgICAgICAgaWYgKCh0YWcgJiA3KSA9PT0gMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZW5kMiA9IHJlYWRlci51aW50MzIoKSArIHJlYWRlci5wb3M7XG4gICAgICAgICAgICAgICAgICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZDIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnBlbmFsdHlBY2NvdW50SWRTZXNzaW9uc0dyZWVuLnB1c2gocmVhZGVyLnVpbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucGVuYWx0eUFjY291bnRJZFNlc3Npb25zR3JlZW4ucHVzaChyZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTU6XG4gICAgICAgICAgICAgICAgICAgIGlmICgodGFnICYgNykgPT09IDIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGVuZDIgPSByZWFkZXIudWludDMyKCkgKyByZWFkZXIucG9zO1xuICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5pbnN1ZmZpY2llbnRsZXZlbFNlc3Npb25zLnB1c2gocmVhZGVyLnVpbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuaW5zdWZmaWNpZW50bGV2ZWxTZXNzaW9ucy5wdXNoKHJlYWRlci51aW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxNjpcbiAgICAgICAgICAgICAgICAgICAgaWYgKCh0YWcgJiA3KSA9PT0gMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZW5kMiA9IHJlYWRlci51aW50MzIoKSArIHJlYWRlci5wb3M7XG4gICAgICAgICAgICAgICAgICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZDIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnZzbmNoZWNrQWNjb3VudElkU2Vzc2lvbnMucHVzaChyZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS52c25jaGVja0FjY291bnRJZFNlc3Npb25zLnB1c2gocmVhZGVyLnVpbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDE3OlxuICAgICAgICAgICAgICAgICAgICBpZiAoKHRhZyAmIDcpID09PSAyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBlbmQyID0gcmVhZGVyLnVpbnQzMigpICsgcmVhZGVyLnBvcztcbiAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubGF1bmNoZXJNaXNtYXRjaFNlc3Npb25zLnB1c2gocmVhZGVyLnVpbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubGF1bmNoZXJNaXNtYXRjaFNlc3Npb25zLnB1c2gocmVhZGVyLnVpbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDE4OlxuICAgICAgICAgICAgICAgICAgICBpZiAoKHRhZyAmIDcpID09PSAyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBlbmQyID0gcmVhZGVyLnVpbnQzMigpICsgcmVhZGVyLnBvcztcbiAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuaW5zZWN1cmVBY2NvdW50SWRTZXNzaW9ucy5wdXNoKHJlYWRlci51aW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmluc2VjdXJlQWNjb3VudElkU2Vzc2lvbnMucHVzaChyZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCBfYiwgX2MsIF9kLCBfZSwgX2YsIF9nLCBfaCwgX2osIF9rLCBfbCwgX20sIF9vLCBfc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IHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMzcpLmZsb2F0KG1lc3NhZ2UuZGlzdGFuY2UpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiB3cml0ZXI7XG4gICAgfSxcbiAgICBkZWNvZGUoaW5wdXQsIGxlbmd0aCkge1xuICAgICAgICBjb25zdCByZWFkZXIgPSBpbnB1dCBpbnN0YW5jZW9mIG1pbmltYWxfMS5SZWFkZXIgPyBpbnB1dCA6IG5ldyBtaW5pbWFsXzEuUmVhZGVyKGlucHV0KTtcbiAgICAgICAgbGV0IGVuZCA9IGxlbmd0aCA9PT0gdW5kZWZpbmVkID8gcmVhZGVyLmxlbiA6IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ01zZ0dDQ1N0cmlrZTE1VjJNYXRjaG1ha2luZ0dDMkNsaWVudFVwZGF0ZV9Ob3RlKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50eXBlID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5yZWdpb25JZCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucmVnaW9uUiA9IHJlYWRlci5mbG9hdCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDQ6XG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ICByZXR1cm4ge1xuICAgICAgICBldmVudElkOiAwLFxuICAgICAgICBldmVudFN0YWdlSWQ6IDAsXG4gICAgICAgIHRlYW1JZDA6IDAsXG4gICAgICAgIHRlYW1JZDE6IDAsXG4gICAgICAgIG1hcHNDb3VudDogMCxcbiAgICAgICAgbWFwc0N1cnJlbnQ6IDAsXG4gICAgICAgIHRlYW1JZFN0YXJ0OiAwLFxuICAgICAgICB0ZWFtSWRWZXRvMTogMCxcbiAgICAgICAgdGVhbUlkUGlja246IDAsXG4gICAgICAgIGRyYWZ0czogW11cbiAgICB9O1xufVxuZXhwb3J0cy5DRGF0YUdDQ1N0cmlrZTE1VjJUb3VybmFtZW50TWF0Y2hEcmFmdCA9IHtcbiAgICBlbmNvZGUobWVzc2FnZSwgd3JpdGVyID0gbWluaW1hbF8xLldyaXRlci5jcmVhdGUoKSkge1xuICAgICAgICBpZiAobWVzc2FnZS5ldmVudElkICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDgpLmludDMyKG1lc3NhZ2UuZXZlbnRJZCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuZXZlbnRTdGFnZUlkICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDE2KS5pbnQzMihtZXNzYWdlLmV2ZW50U3RhZ2VJZCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UudGVhbUlkMCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigyNCkuaW50MzIobWVzc2FnZS50ZWFtSWQwKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS50ZWFtSWQxICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDMyKS5pbnQzMihtZXNzYWdlLnRlYW1JZDEpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLm1hcHNDb3VudCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVy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3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDRGF0YUdDQ1N0cmlrZTE1VjJUb3VybmFtZW50TWF0Y2hEcmFmdCgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZXZlbnRJZCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZXZlbnRTdGFnZUlkID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50ZWFtSWQwID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50ZWFtSWQxID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5tYXBzQ291bnQgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA2OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm1hcHNDdXJyZW50ID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50ZWFtSWRTdGFydCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDg6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudGVhbUlkVmV0bzEgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA5OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnRlYW1JZFBpY2tuID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTA6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZHJhZnRzLnB1c2goZXhwb3J0cy5DRGF0YUdDQ1N0cmlrZTE1VjJUb3VybmFtZW50TWF0Y2hEcmFmdF9FbnRyeS5kZWNvZGUocmVhZGVyLCByZWFkZXIudWludDMyKCkpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iLCBfYywgX2QsIF9lLCBfZiwgX2csIF9oLCBfaiwgX2s7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ0RhdGFHQ0NTdHJpa2UxNVYyVG91cm5hbWVudE1hdGNoRHJhZnQoKTtcbiAg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mRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDRGF0YUdDQ1N0cmlrZTE1VjJUb3VybmFtZW50TWF0Y2hEcmFmdF9FbnRyeSgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubWFwaWQgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnRlYW1JZEN0ID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCBfYjtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDRGF0YUdDQ1N0cmlrZTE1VjJUb3VybmFtZW50TWF0Y2hEcmFmdF9FbnRyeSgpO1xuICAgICAgICBtZXNzYWdlLm1hcGlkID0gKF9hID0gb2JqZWN0Lm1hcGlkKSAhPT0gbnVsbCAmJiBfYSAhPT0gdm9pZCAwID8gX2EgOiAwO1xuICAgICAgICBtZXNzYWdlLnRlYW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uICAgICAgICAgICAgd3JpdGVyLmludDMyKHYpO1xuICAgICAgICB9XG4gICAgICAgIHdyaXRlci5sZGVsaW0oKTtcbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDUHJlTWF0Y2hJbmZvRGF0YSgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucHJlZGljdGlvbnNQY3QgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmRyYWZ0ID0gZXhwb3J0cy5DRGF0YUdDQ1N0cmlrZTE1VjJUb3VybmFtZW50TWF0Y2hEcmFmdC5kZWNvZGUocmVhZGVyLCByZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc3RhdHMucHVzaChleHBvcnRzLkNQcmVNYXRjaEluZm9EYXRhX1RlYW1TdGF0cy5kZWNvZGUocmVhZGVyLCByZWFkZXIudWludDMyKCkpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA2OlxuICAgICAgICAgICAgICAgICAgICBpZiAoKHRhZyAmIDcpID09PSAyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBlbmQyID0gcmVhZGVyLnVpbnQzMigpICsgcmVhZGVyLnBvcztcbiAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uud2lucy5wdXNoKHJlYWRlci5pbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uud2lucy5wdXNoKHJlYWRlci5pbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2IsIF9jO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNQcmVNYXRjaEluZm9EYXRhKCk7XG4gICAgICAgIG1lc3NhZ2UucHJlZGljdGlvbnNQY3QgPSAoX2EgPSBvYmplY3QucHJlZGljdGlvbnNQY3QpICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6IDA7XG4gICAgICAgIG1lc3Nh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zIodik7XG4gICAgICAgIH1cbiAgICAgICAgd3JpdGVyLmxkZWxpbSgpO1xuICAgICAgICBpZiAobWVzc2FnZS5nYW1lVHlwZSAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigxNikudWludDMyKG1lc3NhZ2UuZ2FtZVR5cGUpO1xuICAgICAgICB9XG4gICAgICAgIGlmICghbWVzc2FnZS5tYXRjaElkLmlzWmVybygpKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDI0KS51aW50NjQobWVzc2FnZS5tYXRjaElkKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5zZXJ2ZXJWZXJzaW9uICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDMyKS51aW50MzIobWVzc2FnZS5zZXJ2ZXJWZXJzaW9uKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5mbGFncyAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigxNDQpLnVpbnQzMihtZXNzYWdlLmZsYWdzKTtcbiAgICAgICAgfVxuICAgICAgICBmb3IgKGNvbnN0IHYgb2YgbWVzc2FnZS5yYW5raW5ncykge1xuICAgICAgICAgICAgZXhwb3J0cy5QbGF5ZXJSYW5raW5nSW5mby5lbmNvZGUodiwgd3JpdGVyLnVpbnQzMig0MikuZm9yaygpKS5sZGVsaW0oKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAoIW1lc3NhZ2UuZW5jcnlwdGlvbktleS5pc1plcm8oKSkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig0OCkudWludDY0KG1lc3NhZ2UuZW5jcnlwdGlvbktleSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKCFtZXNzYWdlLmVuY3J5cHRpb25LZXlQdWIuaXNaZXJvKCkpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNTYpLnVpbnQ2NChtZXNzYWdlLmVuY3J5cHRpb25LZXlQdWIpO1xuICAgICAgICB9XG4gICAgICAgIHdyaXRlci51aW50MzIoNjYpLmZvcmsoKTtcbiAgICAgICAgZm9yIChjb25zdCB2IG9mIG1lc3NhZ2UucGFydHlJZHMpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIodik7XG4gICAgICAgIH1cbiAgICAgICAgd3JpdGVyLmxkZWxpbSgpO1xuICAgICAgICBmb3IgKGNvbnN0IHYgb2YgbWVzc2FnZS53aGl0ZWxpc3QpIHtcbiAgICAgICAgICAgIGV4cG9ydHMuSXBBZGRyZXNzTWFzay5lbmNvZGUodiwgd3JpdGVyLnVpbnQzMig3NCkuZm9yaygpKS5sZGVsaW0oKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAoIW1lc3NhZ2UudHZNYXN0ZXJTdGVhbWlkLmlzWmVybygpKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDgwKS51aW50NjQobWVzc2FnZS50dk1hc3RlclN0ZWFtaWQpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnRvdXJuYW1lbnRFdmVudCAhPT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgICBleHBvcnRzLlRvdXJuYW1lbnRFdmVudC5lbmNvZGUobWVzc2FnZS50b3VybmFtZW50RXZlbnQsIHdyaXRlci51aW50MzIoOTApLmZvcmsoKSkubGRlbGltKCk7XG4gICAgICAgIH1cbiAgICAgICAgZm9yIChjb25zdCB2IG9mIG1lc3NhZ2UudG91cm5hbWVudFRlYW1zKSB7XG4gICAgICAgICAgICBleHBvcnRzLlRvdXJuYW1lbnRUZWFtLmVuY29kZSh2LCB3cml0ZXIudWludDMyKDk4KS5mb3JrKCkpLmxkZWxpbSgpO1xuICAgICAgICB9XG4gICAgICAgIHdyaXRlci51aW50MzIoMTA2KS5mb3JrKCk7XG4gICAgICAgIGZvciAoY29uc3QgdiBvZiBtZXNzYWdlLnRvdXJuYW1lbnRDYXN0ZXJzQWNjb3VudElkcykge1xuICAgICAgICA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SA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMk1hdGNobWFraW5nR0MyU2VydmVyUmVzZXJ2ZSgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIGlmICgodGFnICYgNykgPT09IDIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGVuZDIgPSByZWFkZXIudWludDMyKCkgKyByZWFkZXIucG9zO1xuICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5hY2NvdW50SWRzLnB1c2gocmVhZGVyLnVpbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuYWNjb3VudElkcy5wdXNoKHJlYWRlci51aW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmdhbWVUeXBlID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubWF0Y2hJZCA9IHJlYWRlci51aW50NjQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnNlcnZlclZlcnNpb24gPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTg6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZmxhZ3MgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5yYW5raW5ncy5wdXNoKGV4cG9ydHMuUGxheWVyUmFua2luZ0luZm8uZGVjb2RlKHJlYWRlciwgcmVhZGVyLnVpbnQzMigpKSk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5lbmNyeXB0aW9uS2V5ID0gcmVhZGVyLnVpbnQ2NCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDc6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZW5jcnlwdGlvbktleVB1YiA9IHJlYWRlci51aW50NjQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA4OlxuICAgICAgICAgICAgICAgICAgICBpZiAoKHRhZyAmIDcpID09PSAyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBlbmQyID0gcmVhZGVyLnVpbnQzMigpICsgcmVhZGVyLnBvcztcbiAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucGFydHlJZHMucHVzaChyZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5wYXJ0eUlkcy5wdXNoKHJlYWRlci51aW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA5OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLndoaXRlbGlzdC5wdXNoKGV4cG9ydHMuSXBBZGRyZXNzTWFzay5kZWNvZGUocmVhZGVyLCByZWFkZXIudWludDMyKCkpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxMDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50dk1hc3RlclN0ZWFtaWQgPSByZWFkZXIudWludDY0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudG91cm5hbWVudEV2ZW50ID0gZXhwb3J0cy5Ub3VybmFtZW50RXZlbnQuZGVjb2RlKHJlYWRlciwgcmVhZGVyLnVpbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50b3VybmFtZW50VGVhbXMucHVzaChleHBvcnRzLlRvdXJuYW1lbnRUZWFtLmRlY29kZShyZWFkZXIsIHJlYWRlci51aW50MzIoKSkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDEzOlxuICAgICAgICAgICAgICAgICAgICBpZiAoKHRhZyAmIDcpID09PSAyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBlbmQyID0gcmVhZGVyLnVpbnQzMigpICsgcmVhZGVyLnBvcztcbiAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudG91cm5hbWVudENhc3RlcnNBY2NvdW50SWRzLnB1c2gocmVhZGVyLnVpbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudG91cm5hbWVudENhc3RlcnNBY2NvdW50SWRzLnB1c2gocmVhZGVyLnVpbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDE0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnR2UmVsYXlTdGVhbWlkID0gcmVhZGVyLnVpbnQ2NCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDE1OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnByZU1hdGNoRGF0YSA9IGV4cG9ydHMuQ1ByZU1hdGNoSW5mb0RhdGEuZGVjb2RlKHJlYWRlciwgcmVhZGVyLnVpbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxNjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5ydGltZTMyRXZlbnRTdGFydCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxNzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50dkNvbnRyb2wgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwV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uICAgICAgICBtZXNzYWdlLnJhbmtpbmdzID1cbiAgICAgICAgICAgICgoX2UgPSBvYmplY3QucmFua2luZ3MpID09PSBudWxsIHx8IF9lID09PSB2b2lkIDAgPyB2b2lkIDAgOiBfZS5tYXAoZSA9PiBleHBvcnRzLlBsYXllclJhbmtpbmdJbmZvLmZyb21QYXJ0aWFsKGUpKSkgfHwgW107XG4gICAgICAgIG1lc3NhZ2UuZW5jcnlwdGlvbktleSA9XG4gICAgICAgICAgICBvYmplY3QuZW5jcnlwdGlvbktleSAhPT0gdW5kZWZpbmVkICYmIG9iamVjdC5lbmNyeXB0aW9uS2V5ICE9PSBudWxsXG4gICAgICAgICAgICAgICAgPyBMb25nLmZyb21WYWx1ZShvYmplY3QuZW5jcnlwdGlvbktleSlcbiAgICAgICAgICAgICAgICA6IExvbmcuVVpFUk87XG4gICAgICAgIG1lc3NhZ2UuZW5jcnlwdGlvbktleVB1YiA9XG4gICAgICAgICAgICBvYmplY3QuZW5jcnlwdGlvbktleVB1YiAhPT0gdW5kZWZpbmVkICYmIG9iamVjdC5lbmNyeXB0aW9uS2V5UHViICE9PSBudWxsXG4gICAgICAgICAgICAgICAgPyBMb25nLmZyb21WYWx1ZShvYmplY3QuZW5jcnlwdGlvbktleVB1YilcbiAgICAgICAgICAgICAgICA6IExvbmcuVVpFUk87XG4gICAgICAgIG1lc3NhZ2UucGFydHlJZHMgPSAoKF9mID0gb2JqZWN0LnBhcnR5SWRzKSA9PT0gbnVsbCB8fCBfZiA9PT0gdm9pZCAwID8gdm9pZCAwIDogX2YubWFwKGUgPT4gZSkpIHx8IFtdO1xuICAgICAgICBtZXNzYWdlLndoaXRlbGlzdCA9XG4gICAgICAgICAgICAoKF9nID0gb2JqZWN0LndoaXRlbGlzdCkgPT09IG51bGwgfHwgX2cgPT09IHZvaWQgMCA/IHZvaWQgMCA6IF9nLm1hcChlID0+IGV4cG9ydHMuSXBBZGRyZXNzTWFzay5mcm9tUGFydGlhbChlKSkpIHx8IFtdO1xuICAgICAgICBtZXNzYWdlLnR2TWFzdGVyU3RlYW1pZCA9XG4gICAgICAgICAgICBvYmplY3QudHZNYXN0ZXJTdGVhbWlkICE9PSB1bmRlZmluZWQgJiYgb2JqZWN0LnR2TWFzdGVyU3RlYW1pZCAhPT0gbnVsbFxuICAgICAgICAgICAgICAgID8gTG9uZy5mcm9tVmFsdWUob2JqZWN0LnR2TWFzdGVyU3RlYW1pZClcbiAgICAgICAgICAgICAgICA6IExvbmcuVVpFUk87XG4gICAgICAgIG1lc3NhZ2UudG91cm5hbWVudEV2ZW50ID1cbiAgICAgICAgICAgIG9iamVjdC50b3VybmFtZW50RXZlbnQgIT09IHVuZGVmaW5lZCAmJiBvYmplY3QudG91cm5hbWVudEV2ZW50ICE9PSBudWxsXG4gICAgICAgICAgICAgICAgPyBleHBvcnRzLlRvdXJuYW1lbnRFdmVudC5mcm9tUGFydGlhbChvYmplY3QudG91cm5hbWVudEV2ZW50KVxuICAgICAgICAgICAgICAgIDogdW5kZWZpbmVkO1xuICAgICAgICBtZXNzYWdlLnRvdXJuYW1lbnRUZWFtcyA9XG4gICAgICAgICAgICAoKF9oID0gb2JqZWN0LnRvdXJuYW1lbnRUZWFtcykgPT09IG51bGwgfHwgX2ggPT09IHZvaWQgMCA/IHZvaWQgMCA6IF9oLm1hcChlID0+IGV4cG9ydHMuVG91cm5hbWVudFRlYW0uZnJvbVBhcnRpYWwoZSkpKSB8fCBbXTtcbiAgICAgICAgbWVzc2FnZS50b3VybmFtZW50Q2FzdGVyc0FjY291bnRJZHMgPVxuICAgICAgICAgICAgKChfaiA9IG9iamVjdC50b3VybmFtZW50Q2FzdGVyc0FjY291bnRJZHMpID09PSBudWxsIHx8IF9qID09PSB2b2lkIDAgPyB2b2lkIDAgOiBfai5tYXAoZSA9PiBlKSkgfHwgW107XG4gICAgICAgIG1lc3NhZ2UudHZSZWxheVN0ZWFtaWQgPVxuICAgICAgICAgICAgb2JqZWN0LnR2UmVsYXlTdGVhbWlkICE9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ICAgICAgICBpZiAobWVzc2FnZS5tYXAgIT09IFwiXCIpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMjYpLnN0cmluZyhtZXNzYWdlLm1hcCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKCFtZXNzYWdlLmdjUmVzZXJ2YXRpb25TZW50LmlzWmVybygpKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDMyKS51aW50NjQobWVzc2FnZS5nY1Jlc2VydmF0aW9uU2VudCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2Uuc2VydmVyVmVyc2lvbiAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig0MCkudWludDMyKG1lc3NhZ2Uuc2VydmVyVmVyc2lvbik7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UudHZJbmZvICE9PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgIGV4cG9ydHMuU2VydmVySGx0dkluZm8uZW5jb2RlKG1lc3NhZ2UudHZJbmZvLCB3cml0ZXIudWludDMyKDUwKS5mb3JrKCkpLmxkZWxpbSgpO1xuICAgICAgICB9XG4gICAgICAgIHdyaXRlci51aW50MzIoNTgpLmZvcmsoKTtcbiAgICAgICAgZm9yIChjb25zdCB2IG9mIG1lc3NhZ2UucmV3YXJkUGxheWVyQWNjb3VudHMpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIodik7XG4gICAgICAgIH1cbiAgICAgICAgd3JpdGVyLmxkZWxpbSgpO1xuICAgICAgICB3cml0ZXIudWludDMyKDY2KS5mb3JrKCk7XG4gICAgICAgIGZvciAoY29uc3QgdiBvZiBtZXNzYWdlLmlkbGVQbGF5ZXJBY2NvdW50cykge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMih2KTtcbiAgICAgICAgfVxuICAgICAgICB3cml0ZXIubGRlbGltKCk7XG4gICAgICAgIGlmIChtZXNzYWdlLnJld2FyZEl0ZW1BdHRyRG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ZGF0YWdyYW1Sb3V0aW5nKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS50ZXN0VG9rZW4gIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTI1KS5maXhlZDMyKG1lc3NhZ2UudGVzdFRva2VuKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5mbGFncyAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigxMjgpLnVpbnQzMihtZXNzYWdlLmZsYWdzKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNNc2dHQ0NTdHJpa2UxNVYyTWF0Y2htYWtpbmdTZXJ2ZXJSZXNlcnZhdGlvblJlc3BvbnNlKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5yZXNlcnZhdGlvbmlkID0gcmVhZGVyLnVpbnQ2NCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucmVzZXJ2YXRpb24gPVxuICAgICAgICAgICAgICAgICAgICAgICAgZXhwb3J0cy5DTXNnR0NDU3RyaWtlMTVWMk1hdGNobWFraW5nR0MyU2VydmVyUmVzZXJ2ZS5kZWNvZGUocmVhZGVyLCByZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubWFwID0gcmVhZGVyLnN0cmluZygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZ2NSZXNlcnZhdGlvblNlbnQgPSByZWFkZXIudWludDY0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zZXJ2ZXJWZXJzaW9uID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDY6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudHZJbmZvID0gZXhwb3J0cy5TZXJ2ZXJIbHR2SW5mby5kZWNvZGUocmVhZGVyLCByZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDc6XG4gICAgICAgICAgICAgICAgICAgIGlmICgodGFnICYgNykgPT09IDIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGVuZDIgPSByZWFkZXIudWludDMyKCkgKyByZWFkZXIucG9zO1xuICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5yZXdhcmRQbGF5ZXJBY2NvdW50cy5wdXNoKHJlYWRlci51aW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnJld2FyZFBsYXllckFjY291bnRzLnB1c2gocmVhZGVyLnVpbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDg6XG4gICAgICAgICAgICAgICAgICAgIGlmICgodGFnICYgNykgPT09IDIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGVuZDIgPSByZWFkZXIudWludDMyKCkgKyByZWFkZXIucG9zO1xuICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5pZGxlUGxheWVyQWNjb3VudHMucHVzaChyZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5pZGxlUGxheWVyQWNjb3VudHMucHVzaChyZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgOTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5yZXdhcmRJdGVtQXR0ckRlZklkeCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxMDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5yZXdhcmRJdGVtQXR0clZhbHVlID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDExOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnJld2FyZEl0ZW1BdHRyUmV3YXJkSWR4ID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDEyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnJld2FyZERyb3BMaXN0ID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDEzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnRvdXJuYW1lbnRUYWcgPSByZWFkZXIuc3RyaW5nKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTQ6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubGVnYWN5U3RlYW1kYXRhZ3JhbVBvcnQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTc6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc3RlYW1kYXRhZ3JhbVJvdXRpbmcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTU6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudGVzdFRva2VuID0gcmVhZGVyLmZpeGVkMzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxNjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5mbGFncyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZ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YXRlQmFzZUNNc2dHQ0NTdHJpa2UxNVYyTWF0Y2htYWtpbmdHQzJDbGllbnRSZXNlcnZlKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zZXJ2ZXJpZCA9IHJlYWRlci51aW50NjQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmRpcmVjdFVkcElwID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZGlyZWN0VWRwUG9ydCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnJlc2VydmF0aW9uaWQgPSByZWFkZXIudWludDY0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5yZXNlcnZhdGlvbiA9XG4gICAgICAgICAgICAgICAgICAgICAgICBleHBvcnRzLkNNc2dHQ0NTdHJpa2UxNVYyTWF0Y2htYWtpbmdHQzJTZXJ2ZXJSZXNlcnZlLmRlY29kZShyZWFkZXIsIHJlYWRlci51aW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5tYXAgPSByZWFkZXIuc3RyaW5nKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zZXJ2ZXJBZGRyZXNzID0gcmVhZGVyLnN0cmluZygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2IsIF9jLCBfZDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMk1hdGNobWFraW5nR0MyQ2xpZW50UmVzZXJ2ZSgpO1xuICAgICAgICBtZXNzYWdlLnNlcnZlcmlkID1cbiAgICAgICAgICAgIG9iamVjdC5zZXJ2ZXJpZCAhPT0gdW5kZWZpbmVkICYmIG9iamVjdC5zZXJ2ZXJpZCAhPT0gbnVsbFxuICAgICAgICAgICAgICAgID8gTG9uZy5mcm9tVmFsdWUob2JqZWN0LnNlcnZlcmlkKVxuICAgICAgICAgICAgICAgIDogTG9uZy5VWkVSTztcbiAgICAgICAgbWVzc2FnZS5kaXJlY3RVZHBJcCA9IChfYSA9IG9iamVjdC5kaXJlY3RVZHBJcCkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogMDtcbiAgICAgICAgbWVzc2FnZS5kaXJlY3RVZHBQb3J0ID0gKF9iID0gb2JqZWN0LmRpcmVjdFVkcFBvcnQpICE9PSBudWxsICYmIF9iICE9PSB2b2lkIDAgPyBfYiA6IDA7XG4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ICAgIHJvdW5kOiAwLFxuICAgICAgICBraWxsczogW10sXG4gICAgICAgIGFzc2lzdHM6IFtdLFxuICAgICAgICBkZWF0aHM6IFtdLFxuICAgICAgICBzY29yZXM6IFtdLFxuICAgICAgICBwaW5nczogW10sXG4gICAgICAgIHJvdW5kUmVzdWx0OiAwLFxuICAgICAgICBtYXRjaFJlc3VsdDogMCxcbiAgICAgICAgdGVhbVNjb3JlczogW10sXG4gICAgICAgIGNvbmZpcm06IHVuZGVmaW5lZCxcbiAgICAgICAgcmVzZXJ2YXRpb25TdGFnZTogMCxcbiAgICAgICAgbWF0Y2hEdXJhdGlvbjogMCxcbiAgICAgICAgZW5lbXlLaWxsczogW10sXG4gICAgICAgIGVuZW15SGVhZHNob3RzOiBbXSxcbiAgICAgICAgZW5lbXkza3M6IFtdLFxuICAgICAgICBlbmVteTRrczogW10sXG4gICAgICAgIGVuZW15NWtzOiBbXSxcbiAgICAgICAgbXZwczogW10sXG4gICAgICAgIHNwZWN0YXRvcnNDb3VudDogMCxcbiAgICAgICAgc3BlY3RhdG9yc0NvdW50VHY6IDAsXG4gICAgICAgIHNwZWN0YXRvcnNDb3VudExuazogMCxcbiAgICAgICAgZW5lbXlLaWxsc0FnZzogW10sXG4gICAgICAgIGRyb3BJbmZvOiB1bmRlZmluZWQsXG4gICAgICAgIGJTd2l0Y2hlZFRlYW1zOiBmYWxzZSxcbiAgICAgICAgZW5lbXkya3M6IFtdLFxuICAgICAgICBwbGF5ZXJTcGF3bmVkOiBbXSxcbiAgICAgICAgdGVhbVNwYXduQ291bnQ6IFtdLFxuICAgICAgICBtYXhSb3VuZHM6IDBcbiAgICB9O1xufVxuZXhwb3J0cy5DTXNnR0NDU3RyaWtlMTVWMk1hdGNobWFraW5nU2VydmVyUm91bmRTdGF0cyA9IHtcbiAgICBlbmNvZGUobWVzc2FnZSwgd3JpdGVyID0gbWluaW1hbF8xLldyaXRlci5jcmVhdGUoKSkge1xuICAgICAgICBpZiAoIW1lc3NhZ2UucmVzZXJ2YXRpb25pZC5pc1plcm8oKSkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig4KS51aW50NjQobWVzc2FnZS5yZXNlcnZhdGlvbmlkKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5yZXNlcnZhdGlvbiAhPT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgICBleHBvcnRzLkNNc2dHQ0NTdHJpa2UxNVYyTWF0Y2htYWtpbmdHQzJTZXJ2ZXJSZXNlcnZlLmVuY29kZShtZXNzYWdlLnJlc2VydmF0aW9uLCB3cml0ZXIudWludDMyKDE4KS5mb3JrKCkpLmxkZWxpbSgpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLm1hcCAhPT0gXCJcIikge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigyNikuc3RyaW5nKG1lc3NhZ2UubWFwKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5yb3VuZCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigzMikuaW50MzIobWVzc2FnZS5yb3VuZCk7XG4gICAgICAgIH1cbiAgICAgICAgd3JpdGVyLnVpbnQzMig0MikuZm9yaygpO1xuICAgICAgICBmb3IgKGNvbnN0IHYgb2YgbWVzc2FnZS5raWxscykge1xuICAgICAgICAgICAgd3JpdGVyLmludDMyKHYpO1xuICAgICAgICB9XG4gICAgICAgIHdyaXRlci5sZGVsaW0oKTtcbiAgICAgICAgd3JpdGVyLnVpbnQzMig1MCkuZm9yaygpO1xuICAgICAgICBmb3IgKGNvbnN0IHYgb2YgbWVzc2FnZS5hc3Npc3RzKSB7XG4gICAgICAgICAgICB3cml0ZXIuaW50MzIodik7XG4gICAgICAgIH1cbiAgICAgICAgd3JpdGVyLmxkZWxpbSgpO1xuICAgICAgICB3cml0ZXIudWludDMyKDU4KS5mb3JrKCk7XG4gICAgICAgIGZvciAoY29uc3QgdiBvZiBtZXNzYWdlLmRlYXRocykge1xuICAgICAgICAgICAgd3JpdGVyLmludDMyKHYpO1xuICAgICAgICB9XG4gICAgICAgIHdyaXRlci5sZGVsaW0oKTtcbiAgICAgICAgd3JpdGVyLnVpbnQzMig2NikuZm9yaygpO1xuICAgICAgICBmb3IgKGNvbnN0IHYgb2YgbWVzc2FnZS5zY29yZXMpIHtcbiAgICAgICAgICAgIHdyaXRlci5pbnQzMih2KTtcbiAgICAgICAgfVxuICAgICAgICB3cml0ZXIubGRlbGltKCk7XG4gICAgICAgIHdyaXRlci51aW50MzIoNzQpLmZvcmsoKTtcbiAgICAgICAgZm9yIChjb25zdCB2IG9mIG1lc3NhZ2UucGluZ3MpIHtcbiAgICAgICAgICAgIHdyaXRlci5pbnQzMih2KTtcbiAgICAgICAgfVxuICAgICAgICB3cml0ZXIubGRlbGltKCk7XG4gICAgICAgIGlmIChtZXNzYWdlLnJvdW5kUmVzdWx0ICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDgwKS5pbnQzMihtZXNzYWdlLnJvdW5kUmVzdWx0KTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5tYXRjaFJlc3VsdCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig4OCkuaW50MzIobWVzc2FnZS5tYXRjaFJlc3VsdCk7XG4gICAgICAgIH1cbiAgICAgICAgd3JpdGVyLnVpbnQzMig5OCkuZm9yaygpO1xuICAgICAgICBmb3IgKGNvbnN0IHYgb2YgbWVzc2FnZS50ZWFtU2NvcmVzKSB7XG4gICAgICAgICAgICB3cml0ZXIuaW50MzIodik7XG4gICAgICAgIH1cbiAgICAgICAgd3JpdGVyLmxkZWxpbSgpO1xuICAgICAgICBpZiAobWVzc2FnZS5jb25maXJtICE9PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgIGV4cG9ydHMuQ01zZ0dDQ1N0cmlrZTE1VjJNYXRjaG1ha2luZ0dDMlNlcnZlckNvbmZpcm0uZW5jb2RlKG1lc3NhZ2UuY29uZmlybSwgd3JpdGVyLnVpbnQzMigxMDYpLmZvcmsoKSkubGRlbGltKCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UucmVzZXJ2YXRpb25TdGFnZSAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigxMTIpLmludDMyKG1lc3NhZ2UucmVzZXJ2YXRpb25TdGFnZSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UubWF0Y2hEdXJhdGlvbiAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigxMjApLmludDMyKG1lc3NhZ2UubWF0Y2hEdXJhdGlvbik7XG4gICAgICAgIH1cbiAgICAgICAgd3JpdGVyLnVpbnQzMigxMzApLmZvcmsoKTtcbiAgICAgICAgZm9yIChjb25zdCB2IG9mIG1lc3NhZ2UuZW5lbXlLaWxscykge1xuICAgICAgICAgICAgd3JpdGVyLmludDMyKHYpO1xuICAgICAgICB9XG4gICAgICAgIHdyaXRlci5sZGVsaW0oKTtcbiAgICAgICAgd3JpdGVyLnVpbnQzMigxMzgpLmZvcmsoKTtcbiAgICAgICAgZm9yIChjb25zdCB2IG9mIG1lc3NhZ2UuZW5lbXlIZWFkc2hvdHMpIHtcbiAgICAgICAgICAgIHdyaXRlci5pbnQzMih2KTtcbiAgICAgICAgfVxuICAgICAgICB3cml0ZXIubGRlbGltKCk7XG4gICAgICAgIHdyaXRlci51aW50MzIoMTQ2KS5mb3JrKCk7XG4gICAgICAgIGZvciAoY29uc3QgdiBvZiBtZXNzYWdlLmVuZW15M2tzKSB7XG4gICAgICAgICAgICB3cml0ZXIuaW50MzIodik7XG4gICAgICAgIH1cbiAgICAgICAgd3JpdGVyLmxkZWxpbSgpO1xuICAgICAgICB3cml0ZXIudWludDMyKDE1NCkuZm9yaygpO1xuICAgICAgICBmb3IgKGNvbnN0IHYgb2YgbWVzc2FnZS5lbmVteTRrcykge1xuICAgICAgICAgICAgd3JpdGVyLmludDMyKHYpO1xuICAgICAgICB9XG4gICAgICAgIHdyaXRlci5sZGVsaW0oKTtcbiAgICAgICAgd3JpdGVyLnVpbnQzMigxNjIpLmZvcmsoKTtcbiAgICAgICAgZm9yIChjb25zdCB2IG9mIG1lc3NhZ2UuZW5lbXk1a3MpIHtcbiAgICAgICAgICAgIHdyaXRlci5pbnQzMih2KTtcbiAgICAgICAgfVxuICAgICAgICB3cml0ZXIubGRlbGltKCk7XG4gICAgICAgIHdyaXRlci51aW50MzIoMTcwKS5mb3JrKCk7XG4gICAgICAgIGZvciAoY29uc3QgdiBvZiBtZXNzYWdlLm12cHMpIHtcbiAgICAgICAgICAgIHdyaXRlci5pbnQzMih2KTtcbiAgICAgICAgfVxuICAgICAgICB3cml0ZXIubGRlbGltKCk7XG4gICAgICAgIGlmIChtZXNzYWdlLnNwZWN0YXRvcnNDb3VudCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigxNzYpLnVpbnQzMihtZXNzYWdlLnNwZWN0YXRvcnNDb3VudCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2Uuc3BlY3RhdG9yc0NvdW50VHYgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTg0KS51aW50MzIobWVzc2FnZS5zcGVjdGF0b3JzQ291bnRUdik7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2Uuc3BlY3RhdG9yc0NvdW50TG5rICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDE5MikudWludDMyKG1lc3NhZ2Uuc3BlY3RhdG9yc0NvdW50TG5rKTtcbiAgICAgICAgfVxuICAgICAgICB3cml0ZXIudWludDMyKDIwMikuZm9yaygpO1xuICAgICAgICBmb3IgKGNvbnN0IHYgb2YgbWVzc2FnZS5lbmVteUtpbGxzQWdnKSB7XG4gICAgICAgICAgICB3cml0ZXIuaW50MzIodik7XG4gICAgICAg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gMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5tYXAgPSByZWFkZXIuc3RyaW5nKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5yb3VuZCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICAgICAgICAgIGlmICgodGFnICYgNykgPT09IDIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGVuZDIgPSByZWFkZXIudWludDMyKCkgKyByZWFkZXIucG9zO1xuICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5raWxscy5wdXNoKHJlYWRlci5pbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uua2lsbHMucHVzaChyZWFkZXIuaW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA2OlxuICAgICAgICAgICAgICAgICAgICBpZiAoKHRhZyAmIDcpID09PSAyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBlbmQyID0gcmVhZGVyLnVpbnQzMigpICsgcmVhZGVyLnBvcztcbiAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuYXNzaXN0cy5wdXNoKHJlYWRlci5pbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuYXNzaXN0cy5wdXNoKHJlYWRlci5pbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDc6XG4gICAgICAgICAgICAgICAgICAgIGlmICgodGFnICYgNykgPT09IDIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGVuZDIgPSByZWFkZXIudWludDMyKCkgKyByZWFkZXIucG9zO1xuICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5kZWF0aHMucHVzaChyZWFkZXIuaW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmRlYXRocy5wdXNoKHJlYWRlci5pbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDg6XG4gICAgICAgICAgICAgICAgICAgIGlmICgodGFnICYgNykgPT09IDIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGVuZDIgPSByZWFkZXIudWludDMyKCkgKyByZWFkZXIucG9zO1xuICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zY29yZXMucHVzaChyZWFkZXIuaW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnNjb3Jlcy5wdXNoKHJlYWRlci5pbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDk6XG4gICAgICAgICAgICAgICAgICAgIGlmICgodGFnICYgNykgPT09IDIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGVuZDIgPSByZWFkZXIudWludDMyKCkgKyByZWFkZXIucG9zO1xuICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5waW5ncy5wdXNoKHJlYWRlci5pbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucGluZ3MucHVzaChyZWFkZXIuaW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxMDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5yb3VuZFJlc3VsdCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDExOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm1hdGNoUmVzdWx0ID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTI6XG4gICAgICAgICAgICAgICAgICAgIGlmICgodGFnICYgNykgPT09IDIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGVuZDIgPSByZWFkZXIudWludDMyKCkgKyByZWFkZXIucG9zO1xuICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50ZWFtU2NvcmVzLnB1c2gocmVhZGVyLmludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50ZWFtU2NvcmVzLnB1c2gocmVhZGVyLmludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuY29uZmlybSA9IGV4cG9ydHMuQ01zZ0dDQ1N0cmlrZTE1VjJNYXRjaG1ha2luZ0dDMlNlcnZlckNvbmZpcm0uZGVjb2RlKHJlYWRlciwgcmVhZGVyLnVpbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5yZXNlcnZhdGlvblN0YWdlID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTU6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubWF0Y2hEdXJhdGlvbiA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDE2OlxuICAgICAgICAgICAgICAgICAgICBpZiAoKHRhZyAmIDcpID09PSAyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBlbmQyID0gcmVhZGVyLnVpbnQzMigpICsgcmVhZGVyLnBvcztcbiAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZW5lbXlLaWxscy5wdXNoKHJlYWRlci5pbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZW5lbXlLaWxscy5wdXNoKHJlYWRlci5pbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDE3OlxuICAgICAgICAgICAgICAgICAgICBpZiAoKHRhZyAmIDcpID09PSAyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBlbmQyID0gcmVhZGVyLnVpbnQzMigpICsgcmVhZGVyLnBvcztcbiAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZW5lbXlIZWFkc2hvdHMucHVzaChyZWFkZXIuaW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmVuZW15SGVhZHNob3RzLnB1c2gocmVhZGVyLmludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTg6XG4gICAgICAgICAgICAgICAgICAgIGlmICgodGFnICYgNykgPT09IDIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGVuZDIgPSByZWFkZXIudWludDMyKCkgKyByZWFkZXIucG9zO1xuICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5lbmVteTNrcy5wdXNoKHJlYWRlci5pbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZW5lbXkza3MucHVzaChyZWFkZXIuaW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxOTpcbiAgICAgICAgICAgICAgICAgICAgaWYgKCh0YWcgJiA3KSA9PT0gMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZW5kMiA9IHJlYWRlci51aW50MzIoKSArIHJlYWRlci5wb3M7XG4gICAgICAgICAgICAgICAgICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZDIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmVuZW15NGtzLnB1c2gocmVhZGVyLmludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5lbmVteTRrcy5wdXNoKHJlYWRlci5pbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDIwOlxuICAgICAgICAgICAgICAgICAgICBpZiAoKHRhZyAmIDcpID09PSAyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBlbmQyID0gcmVhZGVyLnVpbnQzMigpICsgcmVhZGVyLnBvcztcbiAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZW5lbXk1a3MucHVzaChyZWFkZXIuaW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmVuZW15NWtzLnB1c2gocmVhZGVyLmludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjE6XG4gICAgICAgICAgICAgICAgICAgIGlmICgodGFnICYgNykgPT09IDIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGVuZDIgPSByZWFkZXIudWludDMyKCkgKyByZWFkZXIucG9zO1xuICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5tdnBzLnB1c2gocmVhZGVyLmludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5tdnBzLnB1c2gocmVhZGVyLmludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc3BlY3RhdG9yc0NvdW50ID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDIzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnNwZWN0YXRvcnNDb3VudFR2ID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnNwZWN0YXRvcnNDb3VudExuayA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyNTpcbiAgICAgICAgICAgICAgICAgICAgaWYgKCh0YWcgJiA3KSA9PT0gMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZW5kMiA9IHJlYWRlci51aW50MzIoKSArIHJlYWRlci5wb3M7XG4gICAgICAgICAgICAgICAgICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZDIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmVuZW15S2lsbHNBZ2cucHVzaChyZWFkZXIuaW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmVuZW15S2lsbHNBZ2cucHVzaChyZWFkZXIuaW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyNjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5kcm9wSW5mbyA9XG4gICAgICAgICAgICAgICAgICAgICAgICBleHBvcnRzLkNNc2dHQ0NTdHJpa2UxNVYyTWF0Y2htYWtpbmdTZXJ2ZXJSb3VuZFN0YXRzX0Ryb3BJbmZvLmRlY29kZShyZWFkZXIsIHJlYWRlci51aW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjc6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuYlN3aXRjaGVkVGVhbXMgPSByZWFkZXIuYm9vbCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI4OlxuICAgICAgICAgICAgICAgICAgICBpZiAoKHRhZyAmIDcpID09PSAyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBlbmQyID0gcmVhZGVyLnVpbnQzMigpICsgcmVhZGVyLnBvcztcbiAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZW5lbXkya3MucHVzaChyZWFkZXIuaW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmVuZW15MmtzLnB1c2gocmVhZGVyLmludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjk6XG4gICAgICAgICAgICAgICAgICAgIGlmICgodGFnICYgNykgPT09IDIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGVuZDIgPSByZWFkZXIudWludDMyKCkgKyByZWFkZXIucG9zO1xuICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5wbGF5ZXJTcGF3bmVkLnB1c2gocmVhZGVyLmludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5wbGF5ZXJTcGF3bmVkLnB1c2gocmVhZGVyLmludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzA6XG4gICAgICAgICAgICAgICAgICAgIGlmICgodGFnICYgNykgPT09IDIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGVuZDIgPSByZWFkZXIudWludDMyKCkgKyByZWFkZXIucG9zO1xuICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50ZWFtU3Bhd25Db3VudC5wdXNoKHJlYWRlci5pbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudGVhbVNwYXduQ291bnQucHVzaChyZWFkZXIuaW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5tYXhSb3VuZHMgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7X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YWxTdGF0cywgd3JpdGVyLnVpbnQzMigyNikuZm9yaygpKS5sZGVsaW0oKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5wZW5hbHR5U2Vjb25kcyAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigzMikudWludDMyKG1lc3NhZ2UucGVuYWx0eVNlY29uZHMpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnBlbmFsdHlSZWFzb24gIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNDApLnVpbnQzMihtZXNzYWdlLnBlbmFsdHlSZWFzb24pO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnZhY0Jhbm5lZCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig0OCkuaW50MzIobWVzc2FnZS52YWNCYW5uZWQpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnJhbmtpbmcgIT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgZXhwb3J0cy5QbGF5ZXJSYW5raW5nSW5mby5lbmNvZGUobWVzc2FnZS5yYW5raW5nLCB3cml0ZXIudWludDMyKDU4KS5mb3JrKCkpLmxkZWxpbSgpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmNvbW1lbmRhdGlvbiAhPT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgICBleHBvcnRzLlBsYXllckNvbW1lbmRhdGlvbkluZm8uZW5jb2RlKG1lc3NhZ2UuY29tbWVuZGF0aW9uLCB3cml0ZXIudWludDMyKDY2KS5mb3JrKCkpLmxkZWxpbSgpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLm1lZGFscyAhPT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgICBleHBvcnRzLlBsYXllck1lZGFsc0luZm8uZW5jb2RlKG1lc3NhZ2UubWVkYWxzLCB3cml0ZXIudWludDMyKD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NhZ2UgPSBjcmVhdGVCYXNlQ01zZ0dDQ1N0cmlrZTE1VjJNYXRjaG1ha2luZ0dDMkNsaWVudEhlbGxvKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5hY2NvdW50SWQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5vbmdvaW5nbWF0Y2ggPVxuICAgICAgICAgICAgICAgICAgICAgICAgZXhwb3J0cy5DTXNnR0NDU3RyaWtlMTVWMk1hdGNobWFraW5nR0MyQ2xpZW50UmVzZXJ2ZS5kZWNvZGUocmVhZGVyLCByZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZ2xvYmFsU3RhdHMgPSBleHBvcnRzLkdsb2JhbFN0YXRpc3RpY3MuZGVjb2RlKHJlYWRlciwgcmVhZGVyLnVpbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnBlbmFsdHlTZWNvbmRzID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucGVuYWx0eVJlYXNvbiA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA2OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnZhY0Jhbm5lZCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDc6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucmFua2luZyA9IGV4cG9ydHMuUGxheWVyUmFua2luZ0luZm8uZGVjb2RlKHJlYWRlciwgcmVhZGVyLnVpbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA4OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmNvbW1lbmRhdGlvbiA9IGV4cG9ydHMuUGxheWVyQ29tbWVuZGF0aW9uSW5mby5kZWNvZGUocmVhZGVyLCByZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDk6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubWVkYWxzID0gZXhwb3J0cy5QbGF5ZXJNZWRhbHNJbmZvLmRlY29kZShyZWFkZXIsIHJlYWRlci51aW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTA6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubXlDdXJyZW50RXZlbnQgPSBleHBvcnRzLlRvdXJuYW1lbnRFdmVudC5kZWNvZGUocmVhZGVyLCByZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDExOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm15Q3VycmVudEV2ZW50VGVhbXMucHVzaChleHBvcnRzLlRvdXJuYW1lbnRUZWFtLmRlY29kZShyZWFkZXIsIHJlYWRlci51aW50MzIoKSkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDEyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm15Q3VycmVudFRlYW0gPSBleHBvcnRzLlRvdXJuYW1lbnRUZWFtLmRlY29kZShyZWFkZXIsIHJlYWRlci51aW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubXlDdXJyZW50RXZlbnRTdGFnZXMucHVzaChleHBvcnRzLlRvdXJuYW1lbnRFdmVudC5kZWNvZGUocmVhZGVyLCByZWFkZXIudWludDMyKCkpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zdXJ2ZXlWb3RlID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDE1OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmFjdGl2aXR5ID0gZXhwb3J0cy5BY2NvdW50QWN0aXZpdHkuZGVjb2RlKHJlYWRlciwgcmVhZGVyLnVpbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxNzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5wbGF5ZXJMZXZlbCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDE4OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnBsYXllckN1clhwID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTk6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucGxheWVyWHBCb251c0ZsYWdzID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjA6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucmFua2luZ3MucHVzaChleHBvcnRzLlBsYXllclJhbmtpbmdJbmZvLmRlY29kZShyZWFkZXIsIHJlYWRlci51aW50MzIoKSkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2IsIF9jLCBfZCwgX2UsIF9mLCBfZywgX2gsIF9qLCBfaywgX2w7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ01zZ0dDQ1N0cmlrZTE1VjJNYXRjaG1ha2luZ0dDMkNsaWVudEhlbGxvKCk7XG4gICAgICAgIG1lc3NhZ2UuYWNjb3VudElkID0gKF9hID0gb2JqZWN0LmFjY291bnRJZCkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogMDtcbiAgICAgICAgbWVzc2FnZS5vbmdvaW5nbWF0Y2ggPVxuICAgICAgICAgICAgb2JqZWN0Lm9uZ29pbmdtYXRjaCAhPT0gdW5kZWZpbmVkICYmIG9iamVjdC5vbmdvaW5nbWF0Y2ggIT09IG51bGxcbiAgICAgICAgICAgICAgICA/IGV4cG9ydHMuQ01zZ0dDQ1N0cmlrZTE1VjJNYXRjaG1ha2luZ0dDMkNsaWVudFJlc2VydmUuZnJvbVBhcnRpYWwob2JqZWN0Lm9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biAhPT0gbnVsbFxuICAgICAgICAgICAgICAgID8gZXhwb3J0cy5QbGF5ZXJDb21tZW5kYXRpb25JbmZvLmZyb21QYXJ0aWFsKG9iamVjdC5jb21tZW5kYXRpb24pXG4gICAgICAgICAgICAgICAgOiB1bmRlZmluZWQ7XG4gICAgICAgIG1lc3NhZ2UubWVkYWxzID1cbiAgICAgICAgICAgIG9iamVjdC5tZWRhbHMgIT09IHVuZGVmaW5lZCAmJiBvYmplY3QubWVkYWxzICE9PSBudWxsXG4gICAgICAgICAgICAgICAgPyBleHBvcnRzLlBsYXllck1lZGFsc0luZm8uZnJvbVBhcnRpYWwob2JqZWN0Lm1lZGFscylcbiAgICAgICAgICAgICAgICA6IHVuZGVmaW5lZDtcbiAgICAgICAgbWVzc2FnZS5teUN1cnJlbnRFdmVudCA9XG4gICAgICAgICAgICBvYmplY3QubXlDdXJyZW50RXZlbnQgIT09IHVuZGVmaW5lZCAmJiBvYmplY3QubXlDdXJyZW50RXZlbnQgIT09IG51bGxcbiAgICAgICAgICAgICAgICA/IGV4cG9ydHMuVG91cm5hbWVudEV2ZW50LmZyb21QYXJ0aWFsKG9iamVjdC5teUN1cnJlbnRFdmVudClcbiAgICAgICAgICAgICAgICA6IHVuZGVmaW5lZDtcbiAgICAgICAgbWVzc2FnZS5teUN1cnJlbnRFdmVudFRlYW1zID1cbiAgICAgICAgICAgICgoX2UgPSBvYmplY3QubXlDdXJyZW50RXZlbnRUZWFtcykgPT09IG51bGwgfHwgX2UgPT09IHZvaWQgMCA/IHZvaWQgMCA6IF9lLm1hcChlID0+IGV4cG9ydHMuVG91cm5hbWVudFRlYW0uZnJvbVBhcnRpYWwoZSkpKSB8fCBbXTtcbiAgICAgICAgbWVzc2FnZS5teUN1cnJlbnRUZWFtID1cbiAgICAgICAgICAgIG9iamVjdC5teUN1cnJlbnRUZWFtICE9PSB1bmRlZmluZWQgJiYgb2JqZWN0Lm15Q3VycmVudFRlYW0gIT09IG51bGxcbiAgICAgICAgICAgIC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CYXNlQ01zZ0dDQ1N0cmlrZTE1VjJBY2NvdW50UHJpdmFjeVNldHRpbmdzX1NldHRpbmcoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnNldHRpbmdUeXBlID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc2V0dGluZ1ZhbHVlID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2I7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ01zZ0dDQ1N0cmlrZTE1VjJBY2NvdW50UHJpdmFjeVNldHRpbmdzX1NldHRpbmcoKTtcbiAgICAgICAgbWVzc2FnZS5zZXR0aW5nVHlwZSA9IChfYSA9IG9iamVjdC5zZXR0aW5nVHlwZSkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogMDtcbiAgICAgICAgbWVzc2FnZS5zZXR0aW5nVmFsdWUgPSAoX2IgPSBvYmplY3Quc2V0dGluZ1ZhbHVlKSAhPT0gbnVsbCA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Wx0eVJlYXNvbiAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigzMikudWludDMyKG1lc3NhZ2UucGVuYWx0eVJlYXNvbik7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMk1hdGNobWFraW5nR0MyQ2xpZW50QWJhbmRvbigpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuYWNjb3VudElkID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuYWJhbmRvbmVkTWF0Y2ggPVxuICAgICAgICAgICAgICAgICAgICAgICAgZXhwb3J0cy5DTXNnR0NDU3RyaWtlMTVWMk1hdGNobWFraW5nR0MyQ2xpZW50UmVzZXJ2ZS5kZWNvZGUocmVhZGVyLCByZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucGVuYWx0eVNlY29uZHMgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5wZW5hbHR5UmVhc29uID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2IsIF9jO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNNc2dHQ0NTdHJpa2UxNVYyTWF0Y2htYWtpbmdHQzJDbGllbnRBYmFuZG9uKCk7XG4gICAgICAgIG1lc3NhZ2UuYWNjb3VudElkID0gKF9hID0gb2JqZWN0LmFjY291bnRJZCkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogMDtcbiAgICAgICAgbWVzc2FnZS5hYmFuZG9uZWRNYXRjaCA9XG4gICAgICAgICAgICBvYmplY3QuYWJhbmRvbmVkTWF0Y2ggIT09IHVuZGVmaW5lZCAmJiBvYmplY3QuYWJhbmRvbmVkTWF0Y2ggIT09IG51bGxcbiAgICAgICAgICAgICAgICA/IGV4cG9ydHMuQ01zZ0dDQ1N0cmlrZTE1VjJNYXRjaG1ha2luZ0dDMkNsaWVudFJlc2VydmUuZnJvbVBhcnRpYWwob2JqZWN0LmFiYW5kb25lZE1hdGNoKVxuICAgICAgICAgICAgICAgIDogdW5kZWZpbmVkO1xu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WVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMkNsaWVudEdDUmFua1VwZGF0ZSgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucmFua2luZ3MucHVzaChleHBvcnRzLlBsYXllclJhbmtpbmdJbmZvLmRlY29kZShyZWFkZXIsIHJlYWRlci51aW50MzIoKSkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYTtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMkNsaWVudEdDUmFua1VwZGF0ZSgpO1xuICAgICAgICBtZXNzYWdlLnJhbmtpbmdzID1cbiAgICAgICAgICAgICgoX2EgPSBvYmplY3QucmFua2luZ3MpID09PSBudWxsIHx8IF9hID09PSB2b2lkIDAgPyB2b2lkIDAgOiBfYS5tYXAoZSA9PiBleHBvcnRzLlBsYXllclJhbmtpbmdJbmZvLmZyb21QYXJ0aWFsKGUpKSkgfHwgW107XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH1cbn07XG5mdW5jdGlvbiBjcmVhdGVCYXNlQ01zZ0dDQ1N0cmlrZTE1VjJNYXRjaG1ha2luZ09w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W50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnJlYXNvbiA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnNlY29uZHMgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5jb21tdW5pY2F0aW9uQ29vbGRvd24gPSByZWFkZXIuYm9vbCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2IsIF9jLCBfZDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMlNlcnZlck5vdGlmaWNhdGlvbkZvclVzZXJQZW5hbHR5KCk7XG4gICAgICAgIG1lc3NhZ2UuYWNjb3VudElkID0gKF9hID0gb2JqZWN0LmFjY291bnRJZCkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogMDtcbiAgICAgICAgbWVzc2FnZS5yZWFzb24gPSAoX2IgPSBvYmplY3QucmVhc29uKSAhPT0gbnVsbCAmJiBfYiAhPT0gdm9pZCAwID8gX2IgOiAwO1xuICAgICAgICBtZXNzYWdlLnNlY29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S51aW50MzIobWVzc2FnZS5ycHRBaW1ib3QpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnJwdFdhbGxoYWNrICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDI0KS51aW50MzIobWVzc2FnZS5ycHRXYWxsaGFjayk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UucnB0U3BlZWRoYWNrICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDMyKS51aW50MzIobWVzc2FnZS5ycHRTcGVlZGhhY2spO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnJwdFRlYW1oYXJtICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDQwKS51aW50MzIobWVzc2FnZS5ycHRUZWFtaGFybSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UucnB0VGV4dGFidXNlICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDQ4KS51aW50MzIobWVzc2FnZS5ycHRUZXh0YWJ1c2UpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnJwdFZvaWNlYWJ1c2UgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNTYpLnVpbnQzMihtZXNzYWdlLnJwdFZvaWNlYWJ1c2UpO1xuICAgICAgICB9XG4gICAgICAgIGlmICghbWVzc2FnZS5tYXRjaElkLmlzWmVybygpKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDY0KS51aW50NjQobWVzc2FnZS5tYXRjaElkKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5yZXBvcnRGcm9tRGVtbyA9PT0gdHJ1ZSkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig3MikuYm9vbChtZXNzYWdlLnJlcG9ydEZyb21EZW1vKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNNc2dHQ0NTdHJpa2UxNVYyQ2xpZW50UmVwb3J0UGxheWVyKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5hY2NvdW50SWQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5ycHRBaW1ib3QgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5ycHRXYWxsaGFjayA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnJwdFNwZWVkaGFjayA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA1OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnJwdFRlYW1oYXJtID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDY6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucnB0VGV4dGFidXNlID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDc6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucnB0Vm9pY2VhYnVzZSA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA4OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm1hdGNoSWQgPSByZWFkZXIudWludDY0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgOTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5yZXBvcnRGcm9tRGVtbyA9IHJlYWRlci5ib29sKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCBfYiwgX2MsIF9kLCBfZSwgX2YsIF9nLCBfaDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMkNsaWVudFJlcG9ydFBsYXllcigpO1xuICAgICAgICBtZXNzYWdlLmF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lbnMgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoODApLnVpbnQzMihtZXNzYWdlLnRva2Vucyk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMkNsaWVudENvbW1lbmRQbGF5ZXIoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmFjY291bnRJZCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA4OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm1hdGNoSWQgPSByZWFkZXIudWludDY0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgOTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5jb21tZW5kYXRpb24gPSBleHBvcnRzLlBsYXllckNvbW1lbmRhdGlvbkluZm8uZGVjb2RlKHJlYWRlciwgcmVhZGVyLnVpbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxMDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50b2tlbnMgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCBfYjtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMkNsaWVudENvbW1lbmRQbGF5ZXIoKTtcbiAgICAgICAgbWVzc2FnZS5hY2NvdW50SWQgPSAoX2EgPSBvYmplY3QuYWNjb3VudElkKSAhPT0gbnVsbCAmJiBfYSAhPT0gdm9pZCAwID8gX2EgOiAwO1xuICAgICAgICBtZXNzYWdlLm1hdGNoSWQgPVxuICAgICAgICAgICAgb2JqZWN0Lm1hdGNoSWQgIT09IHVuZGVmaW5lZCAmJiBvYmplY3QubWF0Y2hJZCAhPT0gbnVsbFxuICAgICAgICAgICAgICAgID8gTG9uZy5mcm9tVmFsdWUob2JqZWN0Lm1hdGNoSWQpXG4gICAgICAgICAgICAgICAgOiBMb25nLlVaRVJPO1xuICAgICAgICBtZXNzYWdlLmNvbW1lbmRhdGlvbiA9XG4gICAgICAgICAgICBvYmplY3QuY29tbWVuZGF0aW9uICE9PSB1bmRlZmluZWQgJiYgb2JqZWN0LmNvbW1lbmRhdGlvbiAhPT0gbnVsbFxuICAgICAgICAgICAgICAgID8gZXhwb3J0cy5QbGF5ZXJDb21tZW5kYXRpb25JbmZvLmZyb21QYXJ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0KS51aW50MzIobWVzc2FnZS5ycHRCYWRtb3RkKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5ycHRMaXN0aW5nYWJ1c2UgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMzIpLnVpbnQzMihtZXNzYWdlLnJwdExpc3RpbmdhYnVzZSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UucnB0SW52ZW50b3J5YWJ1c2UgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNDApLnVpbnQzMihtZXNzYWdlLnJwdEludmVudG9yeWFidXNlKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAoIW1lc3NhZ2UubWF0Y2hJZC5pc1plcm8oKSkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig2NCkudWludDY0KG1lc3NhZ2UubWF0Y2hJZCk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMkNsaWVudFJlcG9ydFNlcnZlcigpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucnB0UG9vcnBlcmYgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5ycHRBYnVzaXZlbW9kZWxzID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucnB0QmFkbW90ZCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnJwdExpc3RpbmdhYnVzZSA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA1OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnJwdEludmVudG9yeWFidXNlID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDg6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubWF0Y2hJZCA9IHJlYWRlci51aW50NjQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iLCBfYywgX2QsIF9lO1xuICAgICAgICBjb25zd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nJlc3BvbnNlUmVzdWx0KTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS50b2tlbnMgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNDgpLnVpbnQzMihtZXNzYWdlLnRva2Vucyk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMkNsaWVudFJlcG9ydFJlc3BvbnNlKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5jb25maXJtYXRpb25JZCA9IHJlYWRlci51aW50NjQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmFjY291bnRJZCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnNlcnZlcklwID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucmVzcG9uc2VUeXBlID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucmVzcG9uc2VSZXN1bHQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50b2tlbnMgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCBfYiwgX2MsIF9kLCBfZTtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMkNsaWVudFJlcG9ydFJlc3BvbnNlKCk7XG4gICAgICAgIG1lc3NhZ2UuY29uZmlybWF0aW9uSWQgPVxuICAgICAgICAgICAgb2JqZWN0LmNvbmZpcm1hdGlvbklkICE9PSB1bmRlZmluZWQgJiYgb2JqZWN0LmNvbmZpcm1hdGlvbklkICE9PSBudWxsXG4gICAgICAgICAgICAgICAgPyBMb25nLmZyb21WYWx1ZShvYmplY3QuY29uZmlybWF0aW9uSWQpXG4gICAgICAgICAgICAgICAgOiBMb25nLlVaRVJPO1xuICAg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WVzc2FnZSwgd3JpdGVyID0gbWluaW1hbF8xLldyaXRlci5jcmVhdGUoKSkge1xuICAgICAgICBpZiAobWVzc2FnZS5yZXF1ZXN0SWQgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoOCkudWludDMyKG1lc3NhZ2UucmVxdWVzdElkKTtcbiAgICAgICAgfVxuICAgICAgICB3cml0ZXIudWludDMyKDE4KS5mb3JrKCk7XG4gICAgICAgIGZvciAoY29uc3QgdiBvZiBtZXNzYWdlLmFjY291bnRJZHMpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIodik7XG4gICAgICAgIH1cbiAgICAgICAgd3JpdGVyLmxkZWxpbSgpO1xuICAgICAgICBpZiAoIW1lc3NhZ2Uuc2VydmVyaWQuaXNaZXJvKCkpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMjQpLnVpbnQ2NChtZXNzYWdlLnNlcnZlcmlkKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAoIW1lc3NhZ2UubWF0Y2hpZC5pc1plcm8oKSkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigzMikudWludDY0KG1lc3NhZ2UubWF0Y2hpZCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuY2xpZW50TGF1bmNoZXIgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNDApLnVpbnQzMihtZXNzYWdlLmNsaWVudExhdW5jaGVyKTtcbiAgICAgICAgfVxuICAgICAgICBmb3IgKGNvbnN0IHYgb2YgbWVzc2FnZS5kYXRhQ2VudGVyUGluZ3MpIHtcbiAgICAgICAgICAgIGV4cG9ydHMuRGF0YUNlbnRlclBpbmcuZW5jb2RlKHYsIHdyaXRlci51aW50MzIoNTApLmZvcmsoKSkubGRlbGltKCk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMkNsaWVudFJlcXVlc3RXYXRjaEluZm9GcmllbmRzKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5yZXF1ZXN0SWQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgaWYgKCh0YWcgJiA3KSA9PT0gMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZW5kMiA9IHJlYWRlci51aW50MzIoKSArIHJlYWRlci5wb3M7XG4gICAgICAgICAgICAgICAgICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZDIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmFjY291bnRJZHMucHVzaChyZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5hY2NvdW50SWRzLnB1c2gocmVhZGVyLnVpbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc2VydmVyaWQgPSByZWFkZXIudWludDY0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5tYXRjaGlkID0gcmVhZGVyLnVpbnQ2NCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuY2xpZW50TGF1bmNoZXIgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5kYXRhQ2VudGVyUGluZ3MucHVzaChleHBvcnRzLkRhdGFDZW50ZXJQaW5nLmRlY29kZShyZWFkZXIsIHJlYWRlci51aW50MzIoKSkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2IsIF9jLCBfZDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMkNsaWVudFJlcXVlc3RXYXRjaEluZm9GcmllbmRzKCk7XG4gICAgICAgIG1lc3NhZ2UucmVxdW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0KS51aW50MzIobWVzc2FnZS50dlNwZWN0YXRvcnMpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnR2VGltZSAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigzMikudWludDMyKG1lc3NhZ2UudHZUaW1lKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS50dldhdGNoUGFzc3dvcmQubGVuZ3RoICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDQyKS5ieXRlcyhtZXNzYWdlLnR2V2F0Y2hQYXNzd29yZCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKCFtZXNzYWdlLmNsRGVjcnlwdGRhdGFLZXkuaXNaZXJvKCkpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNDgpLnVpbnQ2NChtZXNzYWdlLmNsRGVjcnlwdGRhdGFLZXkpO1xuICAgICAgICB9XG4gICAgICAgIGlmICghbWVzc2FnZS5jbERlY3J5cHRkYXRhS2V5UHViLmlzWmVybygpKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDU2KS51aW50NjQobWVzc2FnZS5jbERlY3J5cHRkYXRhS2V5UHViKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5nYW1lVHlwZSAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig2NCkudWludDMyKG1lc3NhZ2UuZ2FtZVR5cGUpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmdhbWVNYXBncm91cCAhPT0gXCJcIikge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig3NCkuc3RyaW5nKG1lc3NhZ2UuZ2FtZU1hcGdyb3VwKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5nYW1lTWFwICE9PSBcIlwiKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDgyKS5zdHJpbmcobWVzc2FnZS5nYW1lTWFwKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAoIW1lc3NhZ2Uuc2VydmVySWQuaXNaZXJvKCkpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoODgpLnVpbnQ2NChtZXNzYWdlLnNlcnZlcklkKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAoIW1lc3NhZ2UubWF0Y2hJZC5pc1plcm8oKSkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig5NikudWludDY0KG1lc3NhZ2UubWF0Y2hJZCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKCFtZXNzYWdlLnJlc2VydmF0aW9uSWQuaXNaZXJvKCkpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTA0KS51aW50NjQobWVzc2FnZS5yZXNlcnZhdGlvbklkKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZVdhdGNoYWJsZU1hdGNoSW5mbygpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc2VydmVySXAgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50dlBvcnQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50dlNwZWN0YXRvcnMgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50dlRpbWUgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50dldhdGNoUGFzc3dvcmQgPSByZWFkZXIuYnl0ZXMoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA2OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmNsRGVjcnlwdGRhdGFLZXkgPSByZWFkZXIudWludDY0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5jbERlY3J5cHRkYXRhS2V5UHViID0gcmVhZGVyLnVpbnQ2NCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDg6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZ2FtZVR5cGUgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgOTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5nYW1lTWFwZ3JvdXAgPSByZWFkZXIuc3RyaW5nKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTA6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZ2FtZU1hcCA9IHJlYWRlci5zdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zZXJ2ZXJJZCA9IHJlYWRlci51aW50NjQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5tYXRjaElkID0gcmVhZGVyLnVpbnQ2NCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDEzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnJlc2VydmF0aW9uSWQgPSByZWFkZXIudWludDY0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCBfYiwgX2MsIF9kLCBfZSwgX2YsIF9nLCBfaDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VXYXRjaGFibGVNYXRjaEluZm8oKTtcbiAgICAgICAgbWVzc2FnZS5zZXJ2ZXJJcCA9IChfYSA9IG9iamVjdC5zZXJ2ZXJJcCkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hID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XR1cm4gbWVzc2FnZTtcbiAgICB9XG59O1xuZnVuY3Rpb24gY3JlYXRlQmFzZUNNc2dHQ0NTdHJpa2UxNVYyQ2xpZW50UmVxdWVzdEpvaW5GcmllbmREYXRhKCkge1xuICAgIHJldHVybiB7XG4gICAgICAgIHZlcnNpb246IDAsXG4gICAgICAgIGFjY291bnRJZDogMCxcbiAgICAgICAgam9pblRva2VuOiAwLFxuICAgICAgICBqb2luSXBwOiAwLFxuICAgICAgICByZXM6IHVuZGVmaW5lZCxcbiAgICAgICAgZXJyb3Jtc2c6IFwiXCJcbiAgICB9O1xufVxuZXhwb3J0cy5DTXNnR0NDU3RyaWtlMTVWMkNsaWVudFJlcXVlc3RKb2luRnJpZW5kRGF0YSA9IHtcbiAgICBlbmNvZGUobWVzc2FnZSwgd3JpdGVyID0gbWluaW1hbF8xLldyaXRlci5jcmVhdGUoKSkge1xuICAgICAgICBpZiAobWVzc2FnZS52ZXJzaW9uICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDgpLnVpbnQzMihtZXNzYWdlLnZlcnNpb24pO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmFjY291bnRJZCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigxNikudWludDMyKG1lc3NhZ2UuYWNjb3VudElkKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5qb2luVG9rZW4gIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMjQpLnVpbnQzMihtZXNzYWdlLmpvaW5Ub2tlbik7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2Uuam9pbklwcCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigzMikudWludDMyKG1lc3NhZ2Uuam9pbklwcCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UucmVzICE9PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgIGV4cG9ydHMuQ01zZ0dDQ1N0cmlrZTE1VjJNYXRjaG1ha2luZ0dDMkNsaWVudFJlc2VydmUuZW5jb2RlKG1lc3NhZ2UucmVzLCB3cml0ZXIudWludDMyKDQyKS5mb3JrKCkpLmxkZWxpbSgpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmVycm9ybXNnICE9PSBcIlwiKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDUwKS5zdHJpbmcobWVzc2FnZS5lcnJvcm1zZyk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMkNsaWVudFJlcXVlc3RKb2luRnJpZW5kRGF0YSgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudmVyc2lvbiA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmFjY291bnRJZCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmpvaW5Ub2tlbiA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmpvaW5JcHAgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5yZXMgPSBleHBvcnRzLkNNc2dHQ0NTdHJpa2UxNVYyTWF0Y2htYWtpbmdHQzJDbGllbnRSZXNlcnZlLmRlY29kZShyZWFkZXIsIHJlYWRlci51aW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5lcnJvcm1zZyA9IHJlYWRlci5zdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iLCBfYywgX2QsIF9lO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNNc2dHQ0NTdHJpa2UxNVYyQ2xpZW50UmVxdWVzdEpvaW5GcmllbmREYXRhKCk7XG4gICAgICAgIG1lc3NhZ2UudmVyc2lvbiA9I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2luZ0dDMkNsaWVudFJlc2VydmUuZW5jb2RlKG1lc3NhZ2UucmVzLCB3cml0ZXIudWludDMyKDUwKS5mb3JrKCkpLmxkZWxpbSgpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmVycm9ybXNnICE9PSBcIlwiKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDU4KS5zdHJpbmcobWVzc2FnZS5lcnJvcm1zZyk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMkNsaWVudFJlcXVlc3RKb2luU2VydmVyRGF0YSgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudmVyc2lvbiA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmFjY291bnRJZCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnNlcnZlcmlkID0gcmVhZGVyLnVpbnQ2NCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc2VydmVySXAgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zZXJ2ZXJQb3J0ID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDY6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucmVzID0gZXhwb3J0cy5DTXNnR0NDU3RyaWtlMTVWMk1hdGNobWFraW5nR0MyQ2xpZW50UmVzZXJ2ZS5kZWNvZGUocmVhZGVyLCByZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDc6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZXJyb3Jtc2cgPSByZWFkZXIuc3RyaW5nKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCBfYiwgX2MsIF9kLCBfZTtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0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aWVudFJlcXVlc3ROZXdNaXNzaW9uKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5taXNzaW9uSWQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5jYW1wYWlnbklkID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2I7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ01zZ0dDQ3N0cmlrZTE1VjJDbGllbnRSZXF1ZXN0TmV3TWlzc2lvbigpO1xuICAgICAgICBtZXNzYWdlLm1pc3Npb25JZCA9IChfYSA9IG9iamVjdC5taXNzaW9uSWQpICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6IDA7XG4gICAgICAgIG1lc3NhZ2UuY2FtcGFpZ25JZCA9IChfYiA9IG9iamVjdC5jYW1wYWlnbklkKSAhPT0gbnVsbCAmJiBfYiAhPT0gdm9pZCAwID8gX2IgOiAwO1xuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9XG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mltYWxfMS5SZWFkZXIgPyBpbnB1dCA6IG5ldyBtaW5pbWFsXzEuUmVhZGVyKGlucHV0KTtcbiAgICAgICAgbGV0IGVuZCA9IGxlbmd0aCA9PT0gdW5kZWZpbmVkID8gcmVhZGVyLmxlbiA6IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ01zZ0dDQ3N0cmlrZTE1VjJDbGllbnRSZWRlZW1NaXNzaW9uUmV3YXJkKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5jYW1wYWlnbklkID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucmVkZWVtSWQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5yZWRlZW1hYmxlQmFsYW5jZSA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmV4cGVjdGVkQ29zdCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAg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0ZXIudWludDMyKDQ4KS51aW50MzIobWVzc2FnZS5vcGVyYXRpb25Qb2ludHNBd2FyZGVkKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNNc2dHQ0NzdHJpa2UxNVYyR0MyU2VydmVyTm90aWZ5WFBSZXdhcmRlZCgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UueHBQcm9ncmVzc0RhdGEucHVzaChleHBvcnRzLlhwUHJvZ3Jlc3NEYXRhLmRlY29kZShyZWFkZXIsIHJlYWRlci51aW50MzIoKSkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuYWNjb3VudElkID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuY3VycmVudFhwID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuY3VycmVudExldmVsID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudXBncmFkZWREZWZpZHggPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5vcGVyYXRpb25Qb2ludHNBd2FyZGVkID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2IsIF9jLCBfZCwgX2UsIF9mO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNNc2dHQ0NzdHJpa2UxNVYyR0MyU2VydmVyTm90aWZ5WFBSZXdhcmRlZCgpO1xuICAgICAgICBtZXNzYWdlLnhwUHJvZ3Jlc3NEYXRhID1cbiAgICAgICAgICAgICgoX2EgPSBvYmplY3QueHBQcm9ncmVzc0RhdGEpID09PSBudWxsIHx8IF9hID09PSB2b2lkIDAgPyB2b2lkIDAgOiBfYS5tYXAoZSA9PiBleHBvcnRzLlhwUHJvZ3Jlc3NEYXRhLmZyb21QYXJ0aWFsKGUpKSkgfHwgW107XG4gICAgICAgIG1lc3NhZ2UuYWN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LnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucmFuZ2UgPSBleHBvcnRzLkNNc2dHQ0NTdHJpa2UxNUNsaWVudERlZXBTdGF0c19EZWVwU3RhdHNSYW5nZS5kZWNvZGUocmVhZGVyLCByZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubWF0Y2hlcy5wdXNoKGV4cG9ydHMuQ01zZ0dDQ1N0cmlrZTE1Q2xpZW50RGVlcFN0YXRzX0RlZXBTdGF0c01hdGNoLmRlY29kZShyZWFkZXIsIHJlYWRlci51aW50MzIoKSkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2I7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ01zZ0dDQ1N0cmlrZTE1Q2xpZW50RGVlcFN0YXRzKCk7XG4gICAgICAgIG1lc3NhZ2UuYWNjb3VudElkID0gKF9hID0gb2JqZWN0LmFjY291bnRJZCkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogMDtcbiAgICAgICAgbWVzc2FnZS5yYW5nZSA9XG4gICAgICAgICAgICBvYmplY3QucmFuZ2UgIT09IHVuZGVmaW5lZCAmJiBvYmplY3QucmFuZ2UgIT09IG51bGxcbiA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ID09PSB0cnVlKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDI0KS5ib29sKG1lc3NhZ2UuZnJvemVuKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNNc2dHQ0NTdHJpa2UxNUNsaWVudERlZXBTdGF0c19EZWVwU3RhdHNSYW5nZSgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuYmVnaW4gPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5lbmQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5mcm96ZW4gPSByZWFkZXIuYm9vbCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgIC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gICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5ldmVudHMucHVzaChleHBvcnRzLkRlZXBQbGF5ZXJNYXRjaEV2ZW50LmRlY29kZShyZWFkZXIsIHJlYWRlci51aW50MzIoKSkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYTtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVDbGllbnREZWVwU3RhdHNfRGVlcFN0YXRzTWF0Y2goKTtcbiAgICAgICAgbWVzc2FnZS5wbGF5ZXIgPVxuICAgICAgICAgICAgb2JqZWN0LnBsYXllciAhPT0gdW5kZWZpbmVkICYmIG9iamVjdC5wbGF5ZXIgIT09IG51bGxcbiAgICAgICAgICAgICAgICA/IGV4cG9ydHMuRGVlcFBsYXllclN0YXRzRW50cnkuZnJvbVBhcnRpYWwob2JqZWN0LnBsYXllcilcbiAgICAgICAgICAgICAgICA6IHVuZGVmaW5lZDtcbiAgICAgICAgbWVzc2FnZS5ldmVudHMgPVxuICAgICAgICAgICAgKChfYSA9IG9iamVjdC5ldmVudHMpID09PSBudWxsIHx8IF9hID09PSB2b2lkIDAgPyB2b2lkIDAgOiBfYS5tYXAoZSA9PiBleHBvcnRzLkRlZXBQbGF5ZXJNYXRjaEV2ZW50LmZyb21QYXJ0aWFsKGUpKSkgfHwgW107XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH1cbn07XG5mdW5jdGlvbiBjcmVhdGVCYXNlQ01zZ0dDQ1N0cmlrZTE1VjJXYXRjaEluZm9Vc2VycygpIHtcbiAgICByZXR1cm4ge1xuICAgICAgICByZXF1ZXN0SWQ6IDAsXG4gICAgICAgIGFjY291bnRJZHM6IFtdLFxuICAgICAgICB3YXRjaGFibGVNYXRjaEluZm9zOiBbXSxcbiAgICAgICAgZXh0ZW5kZWRUaW1lb3V0OiAwXG4gICAgfTtcbn1cbmV4cG9ydHMuQ01zZ0dDQ1N0cmlrZTE1VjJXYXRjaEluZm9Vc2VycyA9IHtcbiAgICBlbmNvZGUobWVzc2FnZSwgd3JpdGVyID0gbWluaW1hbF8xLldyaXRlci5jcmVhdGUoKSkge1xuICAgICAgICBpZiAobWVzc2FnZS5yZXF1ZXN0SWQgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoOCkudWludDMyKG1lc3NhZ2UucmVxdWVzdElkKTtcbiAgICAgICAgfVxuICAgICAgICB3cml0ZXIudWludDMyKDE4KS5mb3JrKCk7XG4gICAgICAgIGZvciAoY29uc3QgdiBvZiBtZXNzYWdlLmFjY291bnRJZHMpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIodik7XG4gICAgICAgIH1cbiAgICAgICAgd3JpdGVyLmxkZWxpbSgpO1xuICAgICAgICBmb3IgKGNvbnN0IHYgb2YgbWVzc2FnZS53YXRjaGFibGVNYXRjaEluZm9zKSB7XG4gICAgICAgICAgICBleHBvcnRzLldhdGNoYWJsZU1hdGNoSW5mby5lbmNvZGUodiwgd3JpdGVyLnVpbnQzMigyNikuZm9yaygpKS5sZGVsaW0oKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5leHRlbmRlZFRpbWVvdXQgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNDApLnVpbnQzMihtZXNzYWdlLmV4dGVuZGVkVGltZW91dCk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMldhdGNoSW5mb1VzZXJzKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5yZXF1ZXN0SWQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgaWYgKCh0YWcgJiA3KSA9PT0gMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZW5kMiA9IHJlYWRlci51aW50MzIoKSArIHJlYWRlci5wb3M7XG4gICAgICAgICAgICAgICAgICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZDIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmFjY291bnRJZHMucHVzaChyZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5hY2NvdW50SWRzLnB1c2gocmVhZGVyLnVpbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uud2F0Y2hhYmxlTWF0Y2hJbmZvcy5wdXNoKGV4cG9ydHMuV2F0Y2hhYmxlTWF0Y2hJbmZvLmRlY29kZShyZWFkZXIsIHJlYWRlci51aW50MzIoKSkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZXh0ZW5kZWRUaW1lb3V0ID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2IsIF9jLCBfZDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMldhdGNoSW5mb1VzZXJzKCk7XG4gICAgICAgIG1lc3NhZ2UucmVxdWVzdElkID0gKF9hID0gb2JqZWN0LnJlcXVlc3RJZCkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogMDtcbiAgICAgICAgbWVzc2FnZS5hY2NvdW50SWRzID0gKChfYiA9IG9iamVjdC5hY2NvdW50SWRzKSA9PT0gbnVsbCB8fCBfYiA9PT0gdm9pZCAwID8gdm9pZCAwIDogX2IubWFwKGUgPT4gZSkpIHx8IFtdO1xuICAgICAgICBtZXNzYWdl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WRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBpZiAoKHRhZyAmIDcpID09PSAyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBlbmQyID0gcmVhZGVyLnVpbnQzMigpICsgcmVhZGVyLnBvcztcbiAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuYWNjb3VudElkc0RlcHJlY2F0ZWQucHVzaChyZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5hY2NvdW50SWRzRGVwcmVjYXRlZC5wdXNoKHJlYWRlci51aW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmFjY291bnRJZCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnJlcXVlc3RMZXZlbCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LF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UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5jYXNlaWQgPSByZWFkZXIudWludDY0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zdXNwZWN0aWQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5mcmFjdGlvbmlkID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucnB0QWltYm90ID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDY6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucnB0V2FsbGhhY2sgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5ycHRTcGVlZGhhY2sgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgODpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5ycHRUZWFtaGFybSA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA5OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnJlYXNvbiA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbi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gICAgd3JpdGVyLnVpbnQzMig4KS51aW50NjQobWVzc2FnZS5jYXNlaWQpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmNhc2V1cmwgIT09IFwiXCIpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTgpLnN0cmluZyhtZXNzYWdlLmNhc2V1cmwpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnZlcmRpY3QgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMjQpLnVpbnQzMihtZXNzYWdlLnZlcmRpY3QpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnRpbWVzdGFtcCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigzMikudWludDMyKG1lc3NhZ2UudGltZXN0YW1wKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS50aHJvdHRsZXNlY29uZHMgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNDApLnVpbnQzMihtZXNzYWdlLnRocm90dGxlc2Vjb25kcyk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2Uuc3VzcGVjdGlkICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDQ4KS51aW50MzIobWVzc2FnZS5zdXNwZWN0aWQpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmZyYWN0aW9uaWQgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNTYpLnVpbnQzMihtZXNzYWdlLmZyYWN0aW9uaWQpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLm51bXJvdW5kcyAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig2NCkudWludDMyKG1lc3NhZ2UubnVtcm91bmRzKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5mcmFjdGlvbnJvdW5kcyAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig3MikudWludDMyKG1lc3NhZ2UuZnJhY3Rpb25yb3VuZHMpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnN0cmVha2NvbnZpY3Rpb25zICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDgwKS5pbnQzMihtZXNzYWdlLnN0cmVha2NvbnZpY3Rpb25zKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5yZWFzb24gIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoODgpLnVpbnQzMihtZXNzYWdlLnJlYXNvbik7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMlBsYXllck92ZXJ3YXRjaENhc2VBc3NpZ25tZW50KCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5jYXNlaWQgPSByZWFkZXIudWludDY0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5jYXNldXJsID0gcmVhZGVyLnN0cmluZygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudmVyZGljdCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnRpbWVzdGFtcCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA1OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnRocm90dGxlc2Vjb25kcyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA2OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnN1c3BlY3RpZCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA3OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmZyYWN0aW9uaWQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgODpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5udW1yb3VuZHMgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgOTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5mcmFjdGlvbnJvdW5kcyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxMDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zdHJlYWtjb252aWN0aW9ucyA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDExOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnJlYXNvbiA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iLCBfYywgX2QsIF9lLCBfZiwgX2csIF9oLCBfaiwgX2s7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ01zZ0dDQ1N0cmlrZTE1VjJQbGF5ZXJPdmVyd2F0Y2hDYXNlQXNzaWdubWVudCgpO1xuICAgICAgICBtZXNzYWdlLmNhc2VpZCA9XG4gICAgICAgICAgICBvYmplY3QuY2FzZWlkICE9PSB1bmRlZmluZWQgJiYgb2JqZWN0LmNhc2VpZCAhPT0gbnVsbFxuICAgICAgICAgICAgICAgID8gTG9uZy5mcm9tVmFsdWUob2JqZWN0LmNhc2VpZClcbiAgICAgICAgICAgICAgICA6IExvbmcuVVpFUk87XG4gICAgICAgIG1lc3NhZ2UuY2FzZXVybCA9IChfYSA9IG9iamVjdC5jYXNldXJsKSAhPT0gbnVsbCAmJiBfYSAhPT0gdm9pZCAwID8gX2EgOiBcIlwiO1xuICAgICAgICBtZXNzYWdlLnZlcmRpY3QgPSAoX2IgPSBvYmplY3QudmVyZGljdC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MigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuY2FzZWlkID0gcmVhZGVyLnVpbnQ2NCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc3RhdHVzaWQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNNc2dHQ0NTdHJpa2UxNVYyUGxheWVyT3ZlcndhdGNoQ2FzZVN0YXR1cygpO1xuICAgICAgICBtZXNzYWdlLmNhc2VpZCA9XG4gICAgICAgICAgICBvYmplY3QuY2FzZWlkICE9PSB1bmRlZmluZWQgJiYgb2JqZWN0LmNhc2VpZCAhPT0gbnVsbFxuICAgICAgICAgICAgICAgID8gTG9uZy5mcm9tVmFsdWUob2JqZWN0LmNhc2VpZClcbiAgICAgICAgICAgICAgICA6IExvbmcuVVpFUk87XG4gICAgICAgIG1lc3NhZ2Uuc3RhdHVzaWQgPSAoX2EgPSBvYmplY3Quc3RhdHVzaWQpICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6IDA7XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH1cbn07XG5mdW5jdGlvbiBjcmVhdGVCY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gIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5hY2NvdW50aWQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5jYXNlaWQgPSByZWFkZXIudWludDY0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNDbGllbnRIZWFkZXJPdmVyd2F0Y2hFdmlkZW5jZSgpO1xuICAgICAgICBtZXNzYWdlLmFjY291bnRpZCA9IChfYSA9IG9iamVjdC5hY2NvdW50aWQpICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6IDA7XG4gICAgICAgIG1lc3NhZ2UuY2FzZWlkID1cbiAgICAgICAgICAgIG9iamVjdC5jYXNlaWQgIT09IHVuZGVmaW5lZCAmJiBvYmplY3QuY2FzZWlkICE9PSBudWxsXG4gICAgICAgICAgICAgICAgPyBMb25nLmZyb21WYWx1ZShvYmplY3QuY2FzZWlkKVxuICAgICAgICAgICAgICAgIDogTG9uZy5VWkVSTztcbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfVxufTtcbmZ1bmN0aW9uIGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMkdDMkNsaWVudFRleHRNc2coKSB7XG4gICAgcmV0dXJuIHsgaWQ6IDAsIHR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ICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuaWQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50eXBlID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucGF5bG9hZCA9IHJlYWRlci5ieXRlcygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2IsIF9jO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNNc2dHQ0NTdHJpa2UxNVYyR0MyQ2xpZW50VGV4dE1zZygpO1xuICAgICAgICBtZXNzYWdlLmlkID0gKF9hID0gb2JqZWN0LmlkKSAhPT0gbnVsbCAmJiBfYSAhPT0gdm9pZCAwID8gX2EgOiAwO1xuICAgICAgICBtZXNzYWdlLnR5cGUgPSAoX2IgPSBvYmplY3QudHlwZSkgIT09IG51bGwgJiYgX2IgIT09IHZvaWQgMCA/IF9iIDogMDtcbiAgICAgICAgbWVzc2FnZS5wYXlsb2FkID0gKF9jID0gb2JqZWN0LnBheWxvYWQpICE9PSBudWxsICYmIF9jICE9PSB2b2lkIDAgPyBfYyA6I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cmlrZTE1VjJNYXRjaEVuZFJ1blJld2FyZERyb3BzKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zZXJ2ZXJpbmZvID1cbiAgICAgICAgICAgICAgICAgICAgICAgIGV4cG9ydHMuQ01zZ0dDQ1N0cmlrZTE1VjJNYXRjaG1ha2luZ1NlcnZlclJlc2VydmF0aW9uUmVzcG9uc2UuZGVjb2RlKHJlYWRlciwgcmVhZGVyLnVpbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm1hdGNoRW5kUXVlc3REYXRhID0gZXhwb3J0cy5DTXNnR0NTZXJ2ZXJRdWVzdFVwZGF0ZURhdGEuZGVjb2RlKHJlYWRlciwgcmVhZGVyLnVpbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNNc2dHQ0NTdHJpa2UxNVYyTWF0Y2hFbmRSdW5SZXdhcmREcm9wcygpO1xuICAgICAgICBtZXNzYWdlLnNlcnZlcmluZm8gPVxuICAgICAgICAgICAgb2JqZWN0LnNlcnZ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Glja2VyczogW10sXG4gICAgICAgIGludmVudG9yeTogMCxcbiAgICAgICAgb3JpZ2luOiAwLFxuICAgICAgICBxdWVzdGlkOiAwLFxuICAgICAgICBkcm9wcmVhc29uOiAwLFxuICAgICAgICBtdXNpY2luZGV4OiAwLFxuICAgICAgICBlbnRpbmRleDogMFxuICAgIH07XG59XG5leHBvcnRzLkNFY29uSXRlbVByZXZpZXdEYXRhQmxvY2sgPSB7XG4gICAgZW5jb2RlKG1lc3NhZ2UsIHdyaXRlciA9IG1pbmltYWxfMS5Xcml0ZXIuY3JlYXRlKCkpIHtcbiAgICAgICAgaWYgKG1lc3NhZ2UuYWNjb3VudGlkICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDgpLnVpbnQzMihtZXNzYWdlLmFjY291bnRpZCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKCFtZXNzYWdlLml0ZW1pZC5pc1plcm8oKSkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigxNikudWludDY0KG1lc3NhZ2UuaXRlbWlkKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5kZWZpbmRleCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigyNCkudWludDMyKG1lc3NhZ2UuZGVmaW5kZXgpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnBhaW50aW5kZXggIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMzIpLnVpbnQzMihtZXNzYWdlLnBhaW50aW5kZXgpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnJhcml0eSAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig0MCkudWludDMyKG1lc3NhZ2UucmFyaXR5KTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5xdWFsaXR5ICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDQ4KS51aW50MzIobWVzc2FnZS5xdWFsaXR5KTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5wYWludHdlYXIgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNTYpLnVpbnQzMihtZXNzYWdlLnBhaW50d2Vhcik7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UucGFpbnRzZWVkICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDY0KS51aW50MzIobWVzc2FnZS5wYWludHNlZWQpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmtpbGxlYXRlcnNjb3JldHlwZSAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig3MikudWludDMyKG1lc3NhZ2Uua2lsbGVhdGVyc2NvcmV0eXBlKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5raWxsZWF0ZXJ2YWx1ZSAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig4MCkudWludDMyKG1lc3NhZ2Uua2lsbGVhdGVydmFsdWUpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmN1c3RvbW5hbWUgIT09IFwiXCIpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoOTApLnN0cmluZyhtZXNzYWdlLmN1c3RvbW5hbWUpO1xuICAgICAgICB9XG4gICAgICAgIGZvciAoY29uc3QgdiBvZiBtZXNzYWdlLnN0aWNrZXJzKSB7XG4gICAgICAgICAgICBleHBvcnRzLkNFY29uSXRlbVByZXZpZXdEYXRhQmxvY2tfU3RpY2tlci5lbmNvZGUodiwgd3JpdGVyLnVpbnQzMig5OCkuZm9yaygpKS5sZGVsaW0oKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5pbnZlbnRvcnkgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTA0KS51aW50MzIobWVzc2FnZS5pbnZlbnRvcnkpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLm9yaWdpbiAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigxMTIpLnVpbnQzMihtZXNzYWdlLm9yaWdpbik7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UucXVlc3RpZCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigxMjApLnVpbnQzMihtZXNzYWdlLnF1ZXN0aWQpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmRyb3ByZWFzb24gIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTI4KS51aW50MzIobWVzc2FnZS5kcm9wcmVhc29uKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5tdXNpY2luZGV4ICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDEzNikudWludDMyKG1lc3NhZ2UubXVzaWNpbmRleCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuZW50aW5kZXggIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTQ0KS5pbnQzMihtZXNzYWdlLmVudGluZGV4KTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNFY29uSXRlbVByZXZpZXdEYXRhQmxvY2soKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmFjY291bnRpZCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLml0ZW1pZCA9IHJlYWRlci51aW50NjQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmRlZmluZGV4ID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucGFpbnRpbmRleCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA1OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnJhcml0eSA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA2OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnF1YWxpdHkgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5wYWludHdlYXIgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgODpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5wYWludHNlZWQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgOTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5raWxsZWF0ZXJzY29yZXR5cGUgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTA6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uua2lsbGVhdGVydmFsdWUgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuY3VzdG9tbmFtZSA9IHJlYWRlci5zdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zdGlja2Vycy5wdXNoKGV4cG9ydHMuQ0Vjb25JdGVtUHJldmlld0RhdGFCbG9ja19TdGlja2VyLmRlY29kZShyZWFkZXIsIHJlYWRlci51aW50MzIoKSkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDEzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmludmVudG9yeSA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5vcmlnaW4gPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTU6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucXVlc3RpZCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxNjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5kcm9wcmVhc29uID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDE3OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm11c2ljaW5kZXggPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTg6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZW50aW5kZXggPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iLCBfYywgX2QsIF9lLCBfZiwgX2csIF9oLCBfaiwgX2ssIF9sLCBfbSwgX28sIF9wLCBfcSwgX3IsIF9zO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNFY29uSXRlbVByZXZpZXdEYXRhQmxvY2soKTtcbiAgICAgICAgbWVzc2FnZS5hY2NvdW50aWQgPSAoX2EgPSBvYmplY3QuYWNjb3VudGlkKSAhPT0gbnVsbCAmJiBfYSAhPT0gdm9pZCAwID8gX2EgOiAwO1xuICAgICAgICBtZXNzYWdlLml0ZW1pZCA9XG4gICAgICAgICAgICBvYmplY3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T09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNDgpLnVpbnQzMihtZXNzYWdlLnRpbnRJZCk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDRWNvbkl0ZW1QcmV2aWV3RGF0YUJsb2NrX1N0aWNrZXIoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnNsb3QgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zdGlja2VySWQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS53ZWFyID0gcmVhZGVyLmZsb2F0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zY2FsZSA9IHJlYWRlci5mbG9hdCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uucm90YXRpb24gPSByZWFkZXIuZmxvYXQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA2OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnRpbnRJZCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iLCBfYywgX2QsIF9lLCBfZjtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDRWNvbkl0ZW1QcmV2aWV3RGF0YUJsb2NrX1N0aWNrZXIoKTtcbiAgICAgICAgbWVzc2FnZS5zbG90ID0gKF9hID0gb2JqZWN0LnNsb3QpICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6IDA7XG4gICAgICAgIG1lc3NhZ2Uuc3RpY2tlcklkID0gKF9iID0gb2JqZWN0LnN0aWNrZXJJZCkgIT09IG51bGwgJiYgX2IgIT09IHZvaWQgMCA/IF9iIDogMDtcbiAgICAgICAgbWVzc2FnZS53ZWFyID0gKF9jID0gb2JqZWN0LndlYXIpICE9PSBudWxsICYmIF9jICE9PSB2b2lkIDAgPyBfYyA6IDA7XG4gICAgICAgIG1lc3NhZ2Uuc2NhbGUgPSAoX2QgPSBvYmpl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ZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMkNsaWVudDJHQ0Vjb25QcmV2aWV3RGF0YUJsb2NrUmVxdWVzdCgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucGFyYW1TID0gcmVhZGVyLnVpbnQ2NCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucGFyYW1BID0gcmVhZGVyLnVpbnQ2NCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucGFyYW1EID0gcmVhZGVyLnVpbnQ2NCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucGFyYW1NID0gcmVhZGVyLnVpbnQ2NCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ01zZ0dDQ1N0cmlrZTE1VjJDbGllbnQyR0NFY29uUHJldmlld0RhdGFCbG9ja1JlcXVlc3QoKTtcbiAgICAgICAgbWVzc2FnZS5wYXJhbVMgPVxuICAgICAgICAgICAgb2JqZWN0LnBhcmFtUyAhPT0gdW5kZWZpbmVkICYmIG9iamVjdC5wYXJhbVMgIT09IG51bGxcbiAgICAgICAgICAgICAgICA/IExvbmcuZnJvbVZhbHVlKG9iamVjdC5wYXJhbVMpXG4gICAgICAgICAgICAgICAgOiBMb25nLlVaRVJPO1xuICAgICAgICBtZXNzYWdlLnBhcmFtQSA9XG4gICAgICAgICAgICBvYmplY3QucGFyYW1BICE9PSB1bmRlZmluZWQgJiYgb2JqZWN0LnBhcmFtQSAhPT0gbnVsbFxuICAgICAgICAgICAgICAgID8gTG9uZy5mcm9tVmFsdWUob2JqZWN0LnBhcmFtQSlcbiAgICAgICAgICAgICAgICA6IExvbmcuVVpFUk87XG4gICAgICAgIG1lc3NhZ2UucGFyYW1EID1cbiAgICAgICAgICAgIG9iamVjdC5wYXJhbUQgIT09IHVuZGVmaW5lZCAmJiBvYmplY3QucGFyYW1EICE9PSBudWxsXG4gICAgICAgICAgICAgICAgPyBMb25nLmZyb21WYWx1ZShvYmplY3QucGFyYW1EKVxuICAgICAgICAgICAgICAgIDogTG9uZy5VWkVSTztcbiAgICAgICAgbWVzc2FnZS5wYXJhbU0gPVxuICAgICAgICAgICAgb2JqZWN0LnBhcmFtTSAhPT0gdW5kZWZpbmVkICYmIG9iamVjdC5wYXJhbU0gIT09IG51bGxcbiAgICAgICAgICAgICAgICA/IExvbmcuZnJvbVZhbHVlKG9iamVjdC5wYXJhbU0pXG4gICAgICAgICAgICAgICAgOiBMb25nLlVaRVJPO1xuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9XG59O1xuZnVuY3Rpb24gY3JlYXRlQmFzZUNNc2dHQ0NTdHJpa2UxNVYyQ2xpZW50MkdDRWNvblByZXZpZXd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bmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMk1hdGNoTGlzdFJlcXVlc3RSZWNlbnRVc2VyR2FtZXMoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmFjY291bnRpZCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2E7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ01zZ0dDQ1N0cmlrZTE1VjJNYXRjaExpc3RSZXF1ZXN0UmVjZW50VXNlckdhbWVzKCk7XG4gICAgICAgIG1lc3NhZ2UuYWNjb3VudGlkID0gKF9hID0gb2JqZWN0LmFjY291bnRpZCkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogMDtcbiAgICAgICAgcmV0dXJuIG1l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ZWlkID0gcmVhZGVyLnVpbnQ2NCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudG9rZW4gPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNNc2dHQ0NTdHJpa2UxNVYyTWF0Y2hMaXN0UmVxdWVzdEZ1bGxHYW1lSW5mbygpO1xuICAgICAgICBtZXNzYWdlLm1hdGNoaWQgPVxuICAgICAgICAgICAgb2JqZWN0Lm1hdGNoaWQgIT09IHVuZGVmaW5lZCAmJiBvYmplY3QubWF0Y2hpZCAhPT0gbnVsbFxuICAgICAgICAgICAgICAgID8gTG9uZy5mcm9tVmFsdWUob2JqZWN0Lm1hdGNoaWQpXG4gICAgICAgICAgICAgICAgOiBMb25nLlVaRVJPO1xuICAgICAgICBtZXNzYWdlLm91dGNvbWVpZCA9XG4gICAgICAgICAgICBvYmplY3Qub3V0Y29tZWlkICE9PSB1bmRlZmluZWQgJiYgb2JqZWN0Lm91dGNvbWVpZCAhPT0gbnVsbFxuICAgICAgICAgICAgICAgID8gTG9uZy5mcm9tVmFsdWUob2JqZWN0Lm91dGNvbWVpZClcbiAgICAgICAgICAgICAgICA6IExvbmcuVVpFUk87XG4gICAgICAgIG1lc3NhZ2UudG9rZW4gPSAoX2EgPSBvYmplY3QudG9rZW4pICE9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W50NjQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm1hdGNodGltZSA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLndhdGNoYWJsZW1hdGNoaW5mbyA9IGV4cG9ydHMuV2F0Y2hhYmxlTWF0Y2hJbmZvLmRlY29kZShyZWFkZXIsIHJlYWRlci51aW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5yb3VuZHN0YXRzTGVnYWN5ID1cbiAgICAgICAgICAgICAgICAgICAgICAgIGV4cG9ydHMuQ01zZ0dDQ1N0cmlrZTE1VjJNYXRjaG1ha2luZ1NlcnZlclJvdW5kU3RhdHMuZGVjb2RlKHJlYWRlciwgcmVhZGVyLnVpbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA1OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnJvdW5kc3RhdHNhbGwucHVzaChleHBvcnRzLkNNc2dHQ0NTdHJpa2UxNVYyTWF0Y2htYWtpbmdTZXJ2ZXJSb3VuZFN0YXRzLmRlY29kZShyZWFkZXIsIHJlYWRlci51aW50MzIoKSkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sX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XNzYWdlLmNvcnJlY3RwaWNrKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNEYXRhR0NDU3RyaWtlMTVWMlRvdXJuYW1lbnRHcm91cFRlYW0oKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnRlYW1JZCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc2NvcmUgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmNvcnJlY3RwaWNrID0gcmVhZGVyLmJvb2woKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICA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2FnZS5waWNrbG9ja3VudGlsdGltZSAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig1NikudWludDMyKG1lc3NhZ2UucGlja2xvY2t1bnRpbHRpbWUpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnBpY2thYmxldGVhbXMgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNjQpLnVpbnQzMihtZXNzYWdlLnBpY2thYmxldGVhbXMpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnBvaW50c1BlclBpY2sgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNzIpLnVpbnQzMihtZXNzYWdlLnBvaW50c1BlclBpY2spO1xuICAgICAgICB9XG4gICAgICAgIGZvciAoY29uc3QgdiBvZiBtZXNzYWdlLnBpY2tzKSB7XG4gICAgICAgICAgICBleHBvcnRzLkNEYXRhR0NDU3RyaWtlMTVWMlRvdXJuYW1lbnRHcm91cF9QaWNrcy5lbmNvZGUodiwgd3JpdGVyLnVpbnQzMig4MikuZm9yaygpKS5sZGVsaW0oKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNEYXRhR0NDU3RyaWtlMTVWMlRvdXJuYW1lbnRHcm91cCgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZ3JvdXBpZCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm5hbWUgPSByZWFkZXIuc3RyaW5nKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5kZXNjID0gcmVhZGVyLnN0cmluZygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucGlja3NEZXByZWNhdGVkID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudGVhbXMucHVzaChleHBvcnRzLkNEYXRhR0NDU3RyaWtlMTVWMlRvdXJuYW1lbnRHcm91cFRlYW0uZGVjb2RlKHJlYWRlciwgcmVhZGVyLnVpbnQzMigpKSk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNjpcbiAgICAgICAgICAgICAgICAgICAgaWYgKCh0YWcgJiA3KSA9PT0gMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZW5kMiA9IHJlYWRlci51aW50MzIoKSArIHJlYWRlci5wb3M7XG4gICAgICAgICAgICAgICAgICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZDIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnN0YWdlSWRzLnB1c2gocmVhZGVyLmludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zdGFnZUlkcy5wdXNoKHJlYWRlci5pbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDc6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucGlja2xvY2t1bnRpbHRpbWUgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgODpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5waWNrYWJsZXRlYW1zID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDk6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucG9pbnRzUGVyUGljayA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxMDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5waWNrcy5wdXNoKGV4cG9ydHMuQ0RhdGFHQ0NTdHJpa2UxNVYyVG91cm5hbWVudEdyb3VwX1BpY2tzLmRlY29kZShyZWFkZXIsIHJlYWRlci51aW50MzIoKSkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9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pdGVyLmludDMyKHYpO1xuICAgICAgICB9XG4gICAgICAgIHdyaXRlci5sZGVsaW0oKTtcbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDRGF0YUdDQ1N0cmlrZTE1VjJUb3VybmFtZW50R3JvdXBfUGlja3MoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBpZiAoKHRhZyAmIDcpID09PSAyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBlbmQyID0gcmVhZGVyLnVpbnQzMigpICsgcmVhZGVyLnBvcztcbiAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucGlja2lkcy5wdXNoKHJlYWRlci5pbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucGlja2lkcy5wdXNoKHJlYWRlci5pbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYTtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDRGF0YUdDQ1N0cmlrZTE1VjJUb3VybmFtZW50R3JvdXBfUGlja3MoKTtcbiAgICAgICAgbWVzc2FnZS5waWNraWRzID0gKChfYSA9IG9iamVjdC5waWNraWRzKSA9PT0gbnVsbCB8fCBfYSA9PT0gdm9pZCAwID8gdm9pZCAwIDogX2EubWFwKGUgPT4gZSkpIHx8IFtdO1xuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9XG59O1xuZnVuY3Rpb24gY3JlYXRlQmFzZUNEYXRhR0NDU3RyaWtlMTVWMlRvdXJuYW1lbnRTZWN0aW9uKCkge1xuICAgIHJldHVybiB7IHNlY3Rpb25pZDogMCwgbmFtZTogXCJcIiwgZGVzYzogXCJcIiwgZ3JvdXBzOiBbXSB9O1xufVxuZXhwb3J0cy5DRGF0YUdDQ1N0cmlrZTE1VjJUb3VybmFtZW50U2VjdGlvbiA9IHtcbiAgICBlbmNvZGUobWVzc2FnZSwgd3JpdGVyID0gbWluaW1hbF8xLldyaXRlci5jcmVhdGUoKSkge1xuICAgICAgICBpZiAobWVzc2FnZS5zZWN0aW9uaWQgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoOCkudWludDMyKG1lc3NhZ2Uuc2VjdGlvbmlkKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2F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ci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm5hbWUgPSByZWFkZXIuc3RyaW5nKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5kZXNjID0gcmVhZGVyLnN0cmluZygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZ3JvdXBzLnB1c2goZXhwb3J0cy5DRGF0YUdDQ1N0cmlrZTE1VjJUb3VybmFtZW50R3JvdXAuZGVjb2RlKHJlYWRlciwgcmVhZGVyLnVpbnQzMigpKSk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCBfYiwgX2MsIF9kO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNEYXRhR0NDU3RyaWtlMTVWMlRvdXJuYW1lbnRTZWN0aW9uKCk7XG4gICAgICAgIG1lc3NhZ2Uuc2VjdGlvbmlkID0gKF9hID0gb2JqZWN0LnNlY3Rpb25pZCkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogMDtcbiAgICAgICAgbWVzc2FnZS5uYW1lID0gKF9iID0gb2JqZWN0Lm5hbWUpICE9PSBudWxsICYmIF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ICAgICAgICAgICAgICAgICAgbWVzc2FnZS50b3VybmFtZW50RXZlbnQgPSBleHBvcnRzLlRvdXJuYW1lbnRFdmVudC5kZWNvZGUocmVhZGVyLCByZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudG91cm5hbWVudFRlYW1zLnB1c2goZXhwb3J0cy5Ub3VybmFtZW50VGVhbS5kZWNvZGUocmVhZGVyLCByZWFkZXIudWludDMyKCkpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNEYXRhR0NDU3RyaWtlMTVWMlRvdXJuYW1lbnRJbmZvKCk7XG4gICAgICAgIG1lc3NhZ2Uuc2VjdGlvbnMgPVxuICAgICAgICAgICAgKChfYSA9IG9iamVjdC5zZWN0aW9ucykgPT09IG51bGwgfHwgX2EgPT09IHZvaWQgMCA/IHZvaWQgMCA6IF9hLm1hcChlID0+IGV4cG9ydHMuQ0RhdGFHQ0NTdHJpa2UxNVYyVG91cm5hbWVudFNlY3Rpb24uZnJvbVBhcnRpYWwoZSkpKSB8fCBbXTtcbiAgICAgICAgbWVzc2FnZS50b3VybmFtZW50RXZlbnQgPVxuICAgICAgICAgICAgb2JqZWN0LnRvdXJuYW1lbnRFdmVudCAhPT0gdW5kZWZpbmVkICYmIG9iamVjdC50b3VybmFtZW50RXZl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IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ01zZ0dDQ1N0cmlrZTE1VjJNYXRjaExpc3QoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm1zZ3JlcXVlc3RpZCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmFjY291bnRpZCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnNlcnZlcnRpbWUgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5tYXRjaGVzLnB1c2goZXhwb3J0cy5DRGF0YUdDQ1N0cmlrZTE1VjJNYXRjaEluZm8uZGVjb2RlKHJlYWRlciwgcmVhZGVyLnVpbnQzMigpKSk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zdHJlYW1zLnB1c2goZXhwb3J0cy5Ub3VybmFtZW50VGVhbS5kZWNvZGUocmVhZGVyLCByZWFkZXIudWludDMyKCkpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICA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HJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMlByZWRpY3Rpb25zX0dyb3VwTWF0Y2hUZWFtUGljaygpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc2VjdGlvbmlkID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5ncm91cGlkID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5pbmRleCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudGVhbWlkID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5pdGVtaWQgPSByZWFkZXIudWludDY0KCk7XG4g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B7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5ldmVudElkID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudGVhbXMucHVzaChleHBvcnRzLkNNc2dHQ0NTdHJpa2UxNVYyRmFudGFzeV9GYW50YXN5VGVhbS5kZWNvZGUocmVhZGVyLCByZWFkZXIudWludDMyKCkpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNNc2dHQ0NTdHJpa2UxNVYyRmFudGFzeSgpO1xuICAgICAgICBtZXNzYWdlLmV2ZW50SWQgPSAoX2EgPSBvYmplY3QuZXZlbnRJZCkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogMDtcbiAgICAgICAgbWVzc2FnZS50ZWFtcyA9XG4gICAgICAgICAgICAoKF9iID0gb2JqZWN0LnRlYW1zKSA9PT0gbnVsbCB8fCBfYiA9PT0gdm9pZCAwID8gdm9pZCAwIDogX2IubWFwKGUgPT4gZXhwb3J0cy5DTXNnR0NDU3RyaWtlMTVWMkZhbnRhc3lfRmFudG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AgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ01zZ0dDQ1N0cmlrZTE1VjJGYW50YXN5X0ZhbnRhc3lTbG90KCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50eXBlID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5waWNrID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5pdGVtaWQgPSByZWFkZXIudWludDY0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCBfYjtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMkZhbnRhc3lfRmFudGFzeVNsb3QoKTtcbiAgICAgICAgbWVzc2FnZS50eXBlID0gKF9hID0gb2JqZWN0LnR5cGUpICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6I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ICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNNc2dHQ0NTdHJpa2UxNVYyRmFudGFzeV9GYW50YXN5VGVhbSgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc2VjdGlvbmlkID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zbG90cy5wdXNoKGV4cG9ydHMuQ01zZ0dDQ1N0cmlrZTE1VjJGYW50YXN5X0ZhbnRhc3lTbG90LmRlY29kZShyZWFkZXIsIHJlYWRlci51aW50MzIoKSkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2I7XG4gICAgICAgIGNvbnN0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5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNBdHRyaWJ1dGVTdHJpbmcoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnZhbHVlID0gcmVhZGVyLnN0cmluZygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYTtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDQXR0cmlidXRlU3RyaW5nKCk7XG4gICAgICAgIG1lc3NhZ2UudmFsdWUgPSAoX2EgPSBvYmplY3QudmFsdWUpICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6IFwiXCI7XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH1cbn07XG5mdW5jdGlvbiBjcmVhdGVCYXNlQ01zZ0NTdHJpa2UxNVdlbGNvbWUoKSB7XG4gICAgcmV0dXJuIHtcbiAgICAgICAgc3RvcmVJdGVtSGFzaDogMCxcbiAgICAgICAgdGltZXBsYXllZGNvbnNlY3V0aXZlbHk6IDAsXG4gICAgICAgIHRpbWVGaXJzdFBsY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7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKCFtZXNzYWdlLmdzY29va2llaWQuaXNaZXJvKCkpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTQ0KS51aW50NjQobWVzc2FnZS5nc2Nvb2tpZWlkKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAoIW1lc3NhZ2UudW5pcXVlaWQuaXNaZXJvKCkpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTUyKS51aW50NjQobWVzc2FnZS51bmlxdWVpZCk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnQ1N0cmlrZTE1V2VsY29tZSgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc3RvcmVJdGVtSGFzaCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA2OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnRpbWVwbGF5ZWRjb25zZWN1dGl2ZWx5ID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDEwOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnRpbWVGaXJzdFBsYXllZCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5sYXN0VGltZVBsYXllZCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5sYXN0SXBBZGRyZXNzID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDE4OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmdzY29va2llaWQgPSByZWFkZXIudWludDY0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTk6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudW5pcXVlaWQgPSByZWFkZXIudWludDY0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCBfYiwgX2MsIF9kLCBfZTtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnQ1N0cmlrZTE1V2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2Uuc2VydmVyUG9ydCk7XG4gICAgICAgIH1cbiAgICAgICAgZm9yIChjb25zdCB2IG9mIG1lc3NhZ2UuY2hva2VkQmxvY2tzKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDQyKS5zdHJpbmcodik7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMkNsaWVudFZhclZhbHVlTm90aWZpY2F0aW9uSW5mbygpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudmFsdWVOYW1lID0gcmVhZGVyLnN0cmluZygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudmFsdWVJbnQgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnNlcnZlckFkZHIgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zZXJ2ZXJQb3J0ID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuY2hva2VkQmxvY2tzLnB1c2gocmVhZGVyLnN0cmluZygpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iLCBfYywgX2QsIF9lO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNNc2dHQ0NTdHJpa2UxNVYyQ2xpZW50VmFyVmFsdWVOb3RpZmljYXRpb25JbmZvKCk7XG4gICAgICAgIG1lc3NhZ2UudmFsdWVOYW1lID0gKF9hID0gb2JqZWN0LnZhbHVlTmFtZSkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogXCJcIjtcbiAgICAgICAgbWVzc2FnZS52YWx1ZUludCA9IChfYiA9IG9iamVjdC52YWx1ZUludCkgIT09IG51bGwgJiYgX2IgIT09IHZvaWQgMCA/IF9iIDogMDtcbiAgICAgICAgbWVzc2FnZS5zZXJ2ZXJBZGRyID0gKF9jID0gb2JqZWN0LnNlcnZlckFkZHIpICE9PSBudWxsICYmIF9jICE9PSB2b2lkIDAgPyBfYyA6IDA7XG4gICAgICAgIG1lc3NhZ2Uuc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AgICAgICAgfVxuICAgICAgICB3cml0ZXIudWludDMyKDM0KS5mb3JrKCk7XG4gICAgICAgIGZvciAoY29uc3QgdiBvZiBtZXNzYWdlLnVzZXJkYXRhKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKHYpO1xuICAgICAgICB9XG4gICAgICAgIHdyaXRlci5sZGVsaW0oKTtcbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMlNlcnZlclZhclZhbHVlTm90aWZpY2F0aW9uSW5mbygpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuYWNjb3VudGlkID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIGlmICgodGFnICYgNykgPT09IDIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGVuZDIgPSByZWFkZXIudWludDMyKCkgKyByZWFkZXIucG9zO1xuICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS52aWV3YW5nbGVzLnB1c2gocmVhZGVyLnVpbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uudmlld2FuZ2xlcy5wdXNoKHJlYWRlci51aW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnR5cGUgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgaWYgKCh0YWcgJiA3KSA9PT0gMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZW5kMiA9IHJlYWRlci51aW50MzIoKSArIHJlYWRlci5wb3M7XG4gICAgICAgICAgICAgICAgICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZDIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnVzZXJkYXRhLnB1c2gocmVhZGVyLnVpbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudXNlcmRhdGEucHVzaChyZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRl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biAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnRvdGFsR2l2ZXJzID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZW50cmllcy5wdXNoKGV4cG9ydHMuQ01zZ0dDQ1N0cmlrZTE1VjJHaWZ0c0xlYWRlcmJvYXJkUmVzcG9uc2VfR2lmdExlYWRlcmJvYXJkRW50cnkuZGVjb2RlKHJlYWRlciwgcmVhZGVyLnVpbnQzMigpKSk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCBfYiwgX2MsIF9kLCBfZTtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMkdpZnRzTGVhZGVyYm9hcmRSZXNwb25zZSgpO1xuICAgICAgICBtZXNzYWdlLnNlcnZlcnRpbWUgPSAoX2EgPSBvYmplY3Quc2VydmVydGltZSkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogMDtcbiAgICAgICAgbWVzc2FnZS50aW1lUGVyaW9kU2Vjb25kcyA9IChfYiA9IG9iamVjdC50aW1lUGVyaW9kU2Vjb25kcykgIT09IG51bGwgJiYgX2IgIT09IHZvaWQgMCA/IF9iIDogMDtcbiAgICAgICAgbW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AgaWYgKG1lc3NhZ2UuZ2lmdHMgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTYpLnVpbnQzMihtZXNzYWdlLmdpZnRzKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNNc2dHQ0NTdHJpa2UxNVYyR2lmdHNMZWFkZXJib2FyZFJlc3BvbnNlX0dpZnRMZWFkZXJib2FyZEVudHJ5KCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5hY2NvdW50aWQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5naWZ0cyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicm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KTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNNc2dHQ0NTdHJpa2UxNVYyQ2xpZW50U3VibWl0U3VydmV5Vm90ZSgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc3VydmV5SWQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS52b3RlID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2I7XG4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AgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ01zZ0dDQ1N0cmlrZTE1VjJHQzJDbGllbnRUb3VybmFtZW50SW5mbygpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZXZlbnRpZCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnN0YWdlaWQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5nYW1lVHlwZSA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBpZiAoKHRhZyAmIDcpID09PSAyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBlbmQyID0gcmVhZGVyLnVpbnQzMigpICsgcmVhZGVyLnBvcztcbiAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudGVhbWlkcy5wdXNoKHJlYWRlci51aW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnRl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RhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5lbnRyeWlkID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZGVmaWR4ID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZXhwaXJhdGlvbkRhdGUgPSByZWFkZXIuZml4ZWQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2IsIF9jO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNTT0Vjb25Db3Vwb24oKTtcbiAgICAgICAgbWVzc2FnZS5lbnRyeWlkID0gKF9hID0gb2JqZWN0LmVudHJ5aWQpICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6IDA7XG4gICAgICAgIG1lc3NhZ2UuZGVmaWR4ID0gKF9iID0gb2JqZWN0LmRlZmlkeCkgIT09IG51bGwgJiYgX2IgIT09IHZvaWQgMCA/IF9iIDogMDtcbiAgICAgICAgbWVzc2FnZS5leHBpcmF0aW9uRGF0ZSA9IChfYyA9IG9iamVjdC5leHBpcmF0aW9uRGF0ZSkgIT09IG51bGwgJiYgX2MgIT09IHZvaW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c3NhZ2UgPSBjcmVhdGVCYXNlQ1NPUXVlc3RQcm9ncmVzcygpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucXVlc3RpZCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnBvaW50c1JlbWFpbmluZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmJvbnVzUG9pbnRzID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2IsIF9jO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNTT1F1ZXN0UHJvZ3Jlc3MoKTtcbiAgICAgICAgbWVzc2FnZS5xdWVzdGlkID0gKF9hID0gb2JqZWN0LnF1ZXN0aWQpICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6IDA7XG4gICAgICAgIG1lc3NhZ2UucG9pbnRzUmV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BlcmF0aW9uKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zZWFzb25WYWx1ZSA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnRpZXJVbmxvY2tlZCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnByZW1pdW1UaWVycyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm1pc3Npb25JZCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA1OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm1pc3Npb25zQ29tcGxldGVkID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDY6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucmVkZWVtYWJsZUJhbGFuY2UgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zZWFzb25QYXNzVGltZSA9IHJlYWRl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ICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNTT0FjY291bnRSZWN1cnJpbmdTdWJzY3JpcHRpb24oKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnRpbWVOZXh0Q3ljbGUgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50aW1lSW5pdGlhdGVkID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2I7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ1NPQWNjb3VudFJlY3VycmluZ1N1YnNjcmlwdGlvbigpO1xuICAgICAgICBtZXNzYWdlLnRpbWVOZXh0Q3ljbGUgPSAoX2EgPSBvYmplY3QudGltZU5leHRDeWNsZSkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogMDtcbiAg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lciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDU09QZXJzb25hRGF0YVB1YmxpYygpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucGxheWVyTGV2ZWwgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmNvbW1lbmRhdGlvbiA9IGV4cG9ydHMuUGxheWVyQ29tbWVuZGF0aW9uSW5mby5kZWNvZGUocmVhZGVyLCByZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZWxldmF0ZWRTdGF0ZSA9IHJlYWRlci5ib29sKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4g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udWludDY0KG1lc3NhZ2UudGlja2V0KTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNNc2dHQ0dsb2JhbEdhbWVTdWJzY3JpYmUoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnRpY2tldCA9IHJlYWRlci51aW50NjQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNNc2dHQ0dsb2JhbEdhbWVTdWJzY3JpYmUoKTtcbiAgICAgICAgbWVzc2FnZS50aWNrZXQgPVxuICAgICAgICAgICAgb2JqZWN0LnRp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ICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnRpbWVsZWZ0ID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNNc2dHQ0dsb2JhbEdhbWVVbnN1YnNjcmliZSgpO1xuICAgICAgICBtZXNzYWdlLnRpbWVsZWZ0ID0gKF9hID0gb2JqZWN0LnRpbWVsZWZ0KSAhPT0gbnVsbCAmJiBfYSAhPT0gdm9pZCAwID8gX2EgOiAwO1xuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9XG59O1xuZnVuY3Rpb24gY3JlYXRlQmFzZUNNc2dHQ0dsb2JhbEdhbWVQbGF5KCkge1xuICAgIHJldHVybiB7IHRpY2tldDogTG9uZy5VWkVSTywgZ2FtZXRpbWVtczogMCwgbXNwZXJwb2ludDogMCB9O1xufVxuZXhwb3J0cy5DTXNnR0NHbG9iYWxHYW1lUGxheSA9IHtcbiAgICBlbmNvZGUobWVzc2FnZSwgd3JpdGVyID0gbWluaW1hbF8xLldyaXRlci5jcmVhdGUoKSkge1xuICAgICAgICBpZiAoIW1lc3NhZ2UudGlja2V0LmlzWmVybygpKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDgpLnVpbnQ2NChtZXNzYWdlLnRpY2tldCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuZ2FtZXRpbWVtcyAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigxNikudWludDMyKG1lc3NhZ2UuZ2FtZXRpbWVtcyk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UubXNwZXJwb2ludCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigyNCkudWludDMyKG1lc3NhZ2UubXNwZXJwb2ludCk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NHbG9iYWxHYW1lUGxheSgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudGlja2V0ID0gcmVhZGVyLnVpbnQ2NCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZ2FtZXRpbWVtcyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm1zcGVycG9pbnQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCBfYjtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NHbG9iYWxHYW1lUGxheSgpO1xuICAgICAgICBtZXNzYWdlLnRpY2tldCA9XG4gICAgICAgICAgICBvYmplY3QudGlja2V0ICE9PSB1bmRlZmluZWQgJiYgb2JqZWN0LnRpY2tldCAhPT0gbnVsbFxuICAgICAgICAgICAgICAgID8gTG9uZy5mcm9tVmFsdWUob2JqZWN0LnRpY2tldClcbiAgICAgICAgICAgICAgICA6IExvbmcuVVpFUk87XG4gICAgICAgIG1lc3NhZ2UuZ2FtZXRpbWVtcyA9IChfYSA9IG9iamVjdC5nYW1ldGltZW1zKSAhPT0gbnVsbCAmJiBfYSAhPT0gdm9pZCAwID8gX2EgOiAwO1xuICAgICAgICBtZXNzYWdlLm1zcGVycG9pbnQgPSAoX2IgPSBvYmplY3QubXNwZXJwb2ludCkgIT09IG51bGwgJiYgX2IgIT09IHZvaWQgMCA/IF9iIDogMDtcbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfVxufTtcbmZ1bmN0aW9uIGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMkFja25vd2xlZGdlUGVuYWx0eSgpIHtcbiAgICByZXR1cm4geyBhY2tub3dsZ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uICAgICAgICBpZiAobWVzc2FnZS5ob3VycyAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigyNCkudWludDMyKG1lc3NhZ2UuaG91cnMpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnByZXN0aWdldGltZSAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigzMikudWludDMyKG1lc3NhZ2UucHJlc3RpZ2V0aW1lKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNNc2dHQ0NTdHJpa2UxNVYyQ2xpZW50MkdDUmVxdWVzdFByZXN0aWdlQ29pbigpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZGVmaW5kZXggPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS51cGdyYWRlaWQgPSByZWFkZXIudWludDY0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5ob3VycyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnByZXN0aWdldGltZSA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iLCBfYztcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMkNsaWVudDJHQ1JlcXVlc3RQcmVzdGlnZUNvaW4oKTtcbiAgICAgICAgbWVzc2FnZS5kZWZpbmRleCA9IChfYSA9IG9iamVjdC5kZWZpbmRleCkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogMDtcbiAgICAgICAgbWVzc2FnZS51cGdyYWRlaWQgPVxuICAgICAgICAgICAgb2JqZWN0LnVwZ3JhZGVpZCAhPT0gdW5kZWZpbmVkICYmIG9iamVjdC51cGdyYWRlaWQgIT09IG51bGxcbiAgICAgICAgICAgICAgICA/IExvbmcuZnJvbVZhbHVlKG9iamVjdC51cGdyYWRlaWQpXG4gICAgICAgICAgICAgICAgOiBMb25nLlVaRVJPO1xuICAgICAgICBtZXNzYWdlLmhvdXJzID0gKF9iID0gb2JqZWN0LmhvdXJzKSAhPT0gbnVsbCAmJiBfYiAhPT0gdm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dGVCYXNlQ01zZ0dDQ1N0cmlrZTE1VjJDbGllbnQyR0NTdHJlYW1VbmxvY2soKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnRpY2tldCA9IHJlYWRlci51aW50NjQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm9zID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNNc2dHQ0NTdHJpa2UxNVYyQ2xpZW50MkdDU3RyZWFtVW5sb2NrKCk7XG4gICAgICAgIG1lc3NhZ2UudGlja2V0ID1cbiAgICAgICAgICAgIG9iamVjdC50aWNrZXQgIT09IHVuZGVmaW5lZCAmJiBvYmplY3QudGlja2V0ICE9PSBudWxsXG4gICAgICAgICAgICAgICAgPyBMb25nLmZyb21WYWx1ZShvYmplY3QudGlja2V0KVxuICAgICAgICAgICAgICAgIDogTG9uZy5VWkVSTztcbiAgICAgICAgbWVzc2FnZS5vcyA9IChfYSA9IG9iamVjdC5vcykg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Z2UudGV4dCAhPT0gXCJcIikge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigxOCkuc3RyaW5nKG1lc3NhZ2UudGV4dCk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMkNsaWVudFRvR0NDaGF0KCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5tYXRjaElkID0gcmVhZGVyLnVpbnQ2NCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudGV4dCA9IHJlYWRlci5zdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWV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ICAgICAgICB9XG4gICAgICAgIHJldHVybiB3cml0ZXI7XG4gICAgfSxcbiAgICBkZWNvZGUoaW5wdXQsIGxlbmd0aCkge1xuICAgICAgICBjb25zdCByZWFkZXIgPSBpbnB1dCBpbnN0YW5jZW9mIG1pbmltYWxfMS5SZWFkZXIgPyBpbnB1dCA6IG5ldyBtaW5pbWFsXzEuUmVhZGVyKGlucHV0KTtcbiAgICAgICAgbGV0IGVuZCA9IGxlbmd0aCA9PT0gdW5kZWZpbmVkID8gcmVhZGVyLmxlbiA6IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ01zZ0dDQ1N0cmlrZTE1VjJHQ1RvQ2xpZW50Q2hhdCgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuYWNjb3VudElkID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudGV4dCA9IHJlYWRlci5zdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iO1xuIC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gd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmRhdGEgPSBlbmdpbmVfZ2NtZXNzYWdlc18xLkNFbmdpbmVHb3R2U3luY1BhY2tldC5kZWNvZGUocmVhZGVyLCByZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ01zZ0dDQ1N0cmlrZTE1R290dlN5bmNQYWNrZXQoKTtcbiAgICAgICAgbWVzc2FnZS5kYXRhID1cbiAgICAgICAgICAgIG9iamVjdC5kYXRhICE9PSB1bmRlZmluZWQgJiYgb2JqZWN0LmRhdGEgIT09IG51bGxcbiAgICAgICAgICAgICAgICA/IGVuZ2luZV9nY21lc3NhZ2VzXzEuQ0VuZ2luZUdvdHZTeW5jUGFja2V0LmZyb21QYXJ0aWFsKG9iamVjdC5kYXRhKVxuICAgICAgICAgICAgICAgIDogdW5kZWZpbmVkO1xuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9XG59O1xuZnVuY3Rpb24gY3JlYXRlQmFzZVBsYXllckRlY2FsRGlnaXRhbFNpZ25hdHVyZSgpIHtcbiAgICByZXR1cm4ge1xuICAgICAgICBzaWduYXR1cmU6IG5ldyBVaW50OEFycmF5KCksXG4gICAgICAgIGFjY291bnRpZDogMCxcbiAgICAgICAgcnRpbWU6IDAsXG4gICAgICAgIGVuZHBvczogW10sXG4gICAgICAgIHN0YXJ0cG9zOiBbXSxcbiAgICAgICAgcmlnaHQ6IFtdLFxuICAgICAgICB0eERlZmlkeDogMCxcbiAgICAgICAgZW50aW5kZXg6IDAsXG4gICAgICAgIGhpdGJveDogMCxcbiAgICAgICAgY3JlYXRpb250aW1lOiAwLFxuICAgICAgICBlcXVpcHNsb3Q6IDAsXG4gICAgICAgIHRyYWNlSWQ6IDAsXG4gICAgICAgIG5vcm1hbDogW10sXG4gICAgICAgIHRpbnRJZDogMFxuICAgIH07XG59XG5leHBvcnRzLlBsYXllckRlY2FsRGlnaXRhbFNpZ25hdHVyZSA9IHtcbiAgICBlbmNvZGUobWVzc2FnZSwgd3JpdGVyID0gbWluaW1hbF8xLldyaXRlci5jcmVhdGUoKSkge1xuICAgICAgICBpZiAobWVzc2FnZS5zaWduYXR1cmUubGVuZ3RoICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDEwKS5ieXRlcyhtZXNzYWdlLnNpZ25hdHVyZSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuYWNjb3VudGlkICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDE2KS51aW50MzIobWVzc2FnZS5hY2NvdW50aWQpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnJ0aW1lICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDI0KS51aW50MzIobWVzc2FnZS5ydGltZSk7XG4gICAgICAgIH1cbiAgICAgICAgd3JpdGVyLnVpbnQzMigzNCkuZm9yaygpO1xuICAgICAgICBmb3IgKGNvbnN0IHYgb2YgbWVzc2FnZS5lbmRwb3MpIHtcbiAgICAgICAgICAgIHdyaXRlci5mbG9hdCh2KTtcbiAgICAgICAgfVxuICAgICAgICB3cml0ZXIubGRlbGltKCk7XG4gICAgICAgIHdyaXRlci51aW50MzIoNDIpLmZvcmsoKTtcbiAgICAgICAgZm9yIChjb25zdCB2IG9mIG1lc3NhZ2Uuc3RhcnRwb3MpIHtcbiAgICAgICAgICAgIHdyaXRlci5mbG9hdCh2KTtcbiAgICAgICAgfVxuICAgICAgICB3cml0ZXIubGRlbGltKCk7XG4gICAgICAgIHdyaXRlci51aW50MzIoNTApLmZvcmsoKTtcbiAgICAgICAgZm9yIChjb25zdCB2IG9mIG1lc3NhZ2UucmlnaHQpIHtcbiAgICAgICAgICAgIHdyaXRlci5mbG9hdCh2KTtcbiAgICAgICAgfVxuICAgICAgICB3cml0ZXIubGRlbGltKCk7XG4gICAgICAgIGlmIChtZXNzYWdlLnR4RGVmaWR4ICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDU2KS51aW50MzIobWVzc2FnZS50eERlZmlkeCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuZW50aW5kZXggIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNjQpLmludDMyKG1lc3NhZ2UuZW50aW5kZXgpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmhpdGJveCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig3MikudWludDMyKG1lc3NhZ2UuaGl0Ym94KTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5jcmVhdGlvbnRpbWUgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoODUpLmZsb2F0KG1lc3NhZ2UuY3JlYXRpb250aW1lKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5lcXVpcHNsb3QgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoODgpLnVpbnQzMihtZXNzYWdlLmVxdWlwc2xvdCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1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ICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmFjY291bnRpZCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnJ0aW1lID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgICAgICAgICAgIGlmICgodGFnICYgNykgPT09IDIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGVuZDIgPSByZWFkZXIudWludDMyKCkgKyByZWFkZXIucG9zO1xuICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5lbmRwb3MucHVzaChyZWFkZXIuZmxvYXQoKSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmVuZHBvcy5wdXNoKHJlYWRlci5mbG9hdCgpKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICAgICAgICAgIGlmICgodGFnICYgNykgPT09IDIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGVuZDIgPSByZWFkZXIudWludDMyKCkgKyByZWFkZXIucG9zO1xuICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zdGFydHBvcy5wdXNoKHJlYWRlci5mbG9hdCgpKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc3RhcnRwb3MucHVzaChyZWFkZXIuZmxvYXQoKSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA2OlxuICAgICAgICAgICAgICAgICAgICBpZiAoKHRhZyAmIDcpID09PSAyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBlbmQyID0gcmVhZGVyLnVpbnQzMigpICsgcmVhZGVyLnBvcztcbiAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucmlnaHQucHVzaChyZWFkZXIuZmxvYXQoKSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnJpZ2h0LnB1c2gocmVhZGVyLmZsb2F0KCkpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50eERlZmlkeCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA4OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmVudGluZGV4ID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgOTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5oaXRib3ggPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTA6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuY3JlYXRpb250aW1lID0gcmVhZGVyLmZsb2F0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZXF1aXBzbG90ID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDEyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnRyYWNlSWQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTM6XG4gICAgICAgICAgICAgICAgICAgIGlmICgodGFnICYgNykgPT09IDIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGVuZDIgPSByZWFkZXIudWludDMyKCkgKyByZWFkZXIucG9zO1xuICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5ub3JtYWwucHVzaChyZWFkZXIuZmxvYXQoKSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm5vcm1hbC5wdXNoKHJlYWRlci5mbG9hdCgpKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDE0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnRpbnRJZCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iLCBfYywgX2QsIF9lLCBfZiwgX2csIF9oLCBfaiwgX2ssIF9sLCBfbSwgX28sIF9wO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZVBsYXllckRlY2FsRGlnaXRhbFNpZ25hdHVyZSgpO1xuICAgICAgICBtZXNzYWdlLnNpZ25hdHVyZSA9IChfYSA9IG9iamVjdC5zaWduYXR1cmUpICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6IG5ldyBVaW50OEFycmF5KCk7XG4gICAgICAgIG1lc3NhZ2UuYWNjb3VudGlkID0gKF9iID0gb2JqZWN0LmFjY291bnRpZCkgIT09IG51bGwgJiYgX2IgIT09IHZvaWQgMCA/IF9iIDogMDtcbiAgICAgICAgbWVzc2FnZS5ydGltZSA9IChfYyA9IG9iamVjdC5ydGltZSkgIT09IG51bGwgJiYgX2MgIT09IHZvaWQgMCA/IF9jIDogMDtcbiAgICAgICAgbWVzc2FnZS5lbmRwb3MgPSAoKF9kID0gb2JqZWN0LmVuZHBvcykgPT09IG51bGwgfHwgX2QgPT09IHZvaWQgMCA/IHZvaWQgMCA6IF9kLm1hcChlID0+IGUpKSB8fCBbXTtcbiAgICAgICAgbWVzc2FnZS5zdGFydHBvcyA9ICgoX2UgPSBvYmplY3Quc3RhcnRwb3MpID09PSBudWxs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AgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ01zZ0dDQ1N0cmlrZTE1VjJDbGllbnRQbGF5ZXJEZWNhbFNpZ24oKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmRhdGEgPSBleHBvcnRzLlBsYXllckRlY2FsRGlnaXRhbFNpZ25hdHVyZS5kZWNvZGUocmVhZGVyLCByZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuaXRlbWlkID0gcmVhZGVyLnVpbnQ2NCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ01zZ0dDQ1N0cmlrZTE1VjJDbGllbnRQbGF5ZXJEZWNhbFNpZ24oKTtcbiAgICAgICAgbWVzc2FnZS5kYXRhID1cbiAgICAgICAgICAgIG9iamVjdC5kYXRhICE9PSB1bmRlZmluZWQgJiYgb2JqZWN0LmRhdGEgIT09IG51bGxcbiAgICAgICAgICAgICAgICA/IGV4cG9ydHMuUGxheWVyRGVjYWxEaWdpdGFsU2lnb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ICAgICAgIHJldHVybiB3cml0ZXI7XG4gICAgfSxcbiAgICBkZWNvZGUoaW5wdXQsIGxlbmd0aCkge1xuICAgICAgICBjb25zdCByZWFkZXIgPSBpbnB1dCBpbnN0YW5jZW9mIG1pbmltYWxfMS5SZWFkZXIgPyBpbnB1dCA6IG5ldyBtaW5pbWFsXzEuUmVhZGVyKGlucHV0KTtcbiAgICAgICAgbGV0IGVuZCA9IGxlbmd0aCA9PT0gdW5kZWZpbmVkID8gcmVhZGVyLmxlbiA6IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ01zZ0dDQ1N0cmlrZTE1VjJDbGllbnRMb2dvbkZhdGFsRXJyb3IoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmVycm9yY29kZSA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm1lc3NhZ2UgPSByZWFkZXIuc3RyaW5nKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5jb3VudHJ5ID0gcmVhZGVyLnN0cmluZygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgIC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ZiBtZXNzYWdlLm5hbWVzKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDE4KS5zdHJpbmcodik7XG4gICAgICAgIH1cbiAgICAgICAgd3JpdGVyLnVpbnQzMigyNikuZm9yaygpO1xuICAgICAgICBmb3IgKGNvbnN0IHYgb2YgbWVzc2FnZS52YWx1ZXMpIHtcbiAgICAgICAgICAgIHdyaXRlci5pbnQzMih2KTtcbiAgICAgICAgfVxuICAgICAgICB3cml0ZXIubGRlbGltKCk7XG4gICAgICAgIHJldHVybiB3cml0ZXI7XG4gICAgfSxcbiAgICBkZWNvZGUoaW5wdXQsIGxlbmd0aCkge1xuICAgICAgICBjb25zdCByZWFkZXIgPSBpbnB1dCBpbnN0YW5jZW9mIG1pbmltYWxfMS5SZWFkZXIgPyBpbnB1dCA6IG5ldyBtaW5pbWFsXzEuUmVhZGVyKGlucHV0KTtcbiAgICAgICAgbGV0IGVuZCA9IGxlbmd0aCA9PT0gdW5kZWZpbmVkID8gcmVhZGVyLmxlbiA6IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ01zZ0dDQ1N0cmlrZTE1VjJDbGllbnRQb2xsU3RhdGUoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnBvbGxpZCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm5hbWVzLnB1c2gocmVhZGVyLnN0cmluZygpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBpZiAoKHRhZyAmIDcpID09PSAyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBlbmQyID0gcmVhZGVyLnVpbnQzMigpICsgcmVhZGVyLnBvcztcbiAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudmFsdWVzLnB1c2gocmVhZGVyLmludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS52YWx1ZXMucHVzaChyZWFkZXIuaW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iLCBfYztcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMkNsaWVudFBvbGxTdGF0ZSgpO1xuICAgICAgICBtZXNzYWdlLnBvbGxpZCA9IChfYSA9IG9iamVjdC5wb2xsaWQpICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6IDA7XG4gICAgICAgIG1lc3NhZ2UubmFtZXMgPSAoKF9iID0gb2JqZWN0Lm5hbWVzKSA9PT0gbnVsbCB8fC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G1lc3NhZ2UuYXJrICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDMyKS51aW50MzIobWVzc2FnZS5hcmspO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLm5ieSAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig0MCkudWludDMyKG1lc3NhZ2UubmJ5KTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5ncnAgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNDgpLnVpbnQzMihtZXNzYWdlLmdycCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2Uuc2xvdHMgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNTYpLnVpbnQzMihtZXNzYWdlLnNsb3RzKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5sYXVuY2hlciAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig2NCkudWludDMyKG1lc3NhZ2UubGF1bmNoZXIpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmdhbWVUeXBlICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDcyKS51aW50MzIobWVzc2FnZS5nYW1lVHlwZSk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMlBhcnR5UmVnaXN0ZXIoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmlkID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudmVyID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuYXByID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuYXJrID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubmJ5ID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDY6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZ3JwID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDc6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc2xvdHMgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgODpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5sYXVuY2hlciA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA5OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmdhbWVUeXBlID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2IsIF9jLCBfZCwgX2UsIF9mLCBfZywgX2gsIF9qO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNNc2dHQ0NTdHJpa2UxNVYyUGFydHlSZWdpc3RlcigpO1xuICAgICAgICBtZXNzYWdlLmlkID0gKF9hID0gb2JqZWN0LmlkKSAhPT0gbnVsbCAmJiBfYSAhPT0gdm9pZCAwID8gX2EgOiAwO1xuICAgICAgICBtZXNzYWdlLnZlciA9IChfYiA9IG9iamVjdC52ZXIpICE9PSBudWxsICYmIF9iICE9PSB2b2lkIDAgPyBfYiA6IDA7XG4gICAgICAgIG1lc3NhZ2UuYXByID0gKF9jID0gb2JqZWN0LmFwcikgIT09IG51bGwgJiYgX2MgIT09IHZvaWQgMCA/IF9jIDogMDtcbiAgICAgICAgbWVzc2FnZS5hcmsgPSAoX2QgPSBvYmplY3QuYXJrKSAhPT0gbnVsbCAmJiBfZCAhPT0gdm9pZCAwID8gX2QgOiAwO1xuICAgICAgICBtZXNzYWdlLm5ieSA9IChfZ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ik7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuYXJrICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDI0KS51aW50MzIobWVzc2FnZS5hcmspO1xuICAgICAgICB9XG4gICAgICAgIHdyaXRlci51aW50MzIoMzQpLmZvcmsoKTtcbiAgICAgICAgZm9yIChjb25zdCB2IG9mIG1lc3NhZ2UuZ3Jwcykge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMih2KTtcbiAgICAgICAgfVxuICAgICAgICB3cml0ZXIubGRlbGltKCk7XG4gICAgICAgIGlmIChtZXNzYWdlLmxhdW5jaGVyICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDQwKS51aW50MzIobWVzc2FnZS5sYXVuY2hlcik7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuZ2FtZVR5cGUgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNDgpLnVpbnQzMihtZXNzYWdlLmdhbWVUeXBlKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNNc2dHQ0NTdHJpa2UxNVYyUGFydHlTZWFyY2goKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnZlciA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmFwciA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmFyayA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBpZiAoKHRhZyAmIDcpID09PSAyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBlbmQyID0gcmVhZGVyLnVpbnQzMigpICsgcmVhZGVyLnBvcztcbiAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZ3Jwcy5wdXNoKHJlYWRlci51aW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmdycHMucHVzaChyZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5sYXVuY2hlciA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA2OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmdhbWVUeXBlID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2IsIF9jLCBfZCwgX2UsIF9mO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNNc2dHQ0NTdHJpa2UxNVYyUGFydHlTZWFyY2goKTtcbiAgICAgICAgbWVzc2FnZS52ZXIgPSAoX2EgPSBvYmplY3QudmVyKSAhPT0gbnVsbCAmJiBfYSAhPT0gdm9pZCAwID8gX2EgOiAwO1xuICAgICAgICBtZXNzYWdlLmFwciA9IChfYiA9IG9iamVjdC5hcHIpICE9PSBudWxsICYmIF9iICE9PSB2b2lkIDAgPyBfYiA6IDA7XG4gICAgICAgIG1lc3NhZ2UuYXJrID0gKF9jID0gb2JqZWN0LmFyaykgIT09IG51bGwgJiYgX2MgIT09IHZvaWQgMCA/IF9jIDogMDtcbiAgICAgICAgbWVzc2FnZS5ncnBzID0gKChfZCA9IG9iamVjdC5ncnBzKSA9PT0gbnVsbCB8fCBfZCA9PT0gdm9pZCAwID8gdm9pZCAwIDogX2QubWFwKGUgPT4gZSkpIHx8IFtdO1xuICAgICAgICBtZXNzYWdlLmxhdW5jaGVyID0gKF9lID0gb2JqZWN0LmxhdW5jaGVyKSAhPT0gbnVsbCAmJiBfZSAhPT0gdm9pZCAwID8gX2UgOiAwO1xuICAgICAgICBtZXNzYWdlLmdhbWVUeXBlID0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gZ2FtZVR5cGU6IDAsIGFwcjogMCwgYXJrOiAwLCBsb2M6IDAsIGFjY291bnRpZDogMCB9O1xufVxuZXhwb3J0cy5DTXNnR0NDU3RyaWtlMTVWMlBhcnR5U2VhcmNoUmVzdWx0c19FbnRyeSA9IHtcbiAgICBlbmNvZGUobWVzc2FnZSwgd3JpdGVyID0gbWluaW1hbF8xLldyaXRlci5jcmVhdGUoKSkge1xuICAgICAgICBpZiAobWVzc2FnZS5pZCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig4KS51aW50MzIobWVzc2FnZS5pZCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuZ3JwICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDE2KS51aW50MzIobWVzc2FnZS5ncnApO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmdhbWVUeXBlICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDI0KS51aW50MzIobWVzc2FnZS5nYW1lVHlwZSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuYXByICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDMyKS51aW50MzIobWVzc2FnZS5hcHIpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmFyayAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig0MCkudWludDMyKG1lc3NhZ2UuYXJrKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5sb2MgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNDgpLnVpbnQzMihtZXNzYWdlLmxvYyk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuYWNjb3VudGlkICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDU2KS51aW50MzIobWVzc2FnZS5hY2NvdW50aWQpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiB3cml0ZXI7XG4gICAgfSxcbiAgICBkZWNvZGUoaW5wdXQsIGxlbmd0aCkge1xuICAgICAgICBjb25zdCByZWFkZXIgPSBpbnB1dCBpbnN0YW5jZW9mIG1pbmltYWxfMS5SZWFkZXIgPyBpbnB1dCA6IG5ldyBtaW5pbWFsXzEuUmVhZGVyKGlucHV0KTtcbiAgICAgICAgbGV0IGVuZCA9IGxlbmd0aCA9PT0gdW5kZWZpbmVkID8gcmVhZGVyLmxlbiA6IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ01zZ0dDQ1N0cmlrZTE1VjJQYXJ0eVNlYXJjaFJlc3VsdHNfRW50cnkoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmlkID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZ3JwID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZ2FtZVR5cGUgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5hcHIgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5hcmsgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5sb2MgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5hY2NvdW50aWQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCBfYiwgX2MsIF9kLCBfZSwgX2YsIF9nO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNNc2dHQ0NTdHJpa2UxNVYyUGFydHlTZWFyY2hSZXN1bHRzX0VudHJ5KCk7XG4gICAgICAgIG1lc3NhZ2UuaWQgPSAoX2EgPSBvYmplY3QuaWQpICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6IDA7XG4gICAgICAgIG1lc3NhZ2UuZ3JwID0gKF9iID0gb2JqZWN0LmdycCkgIT09IG51bGwgJiYgX2IgIT09IHZvaWQgMCA/IF9iIDogMDtcbiAgICAgICAgbWVzc2FnZS5nYW1lVHlwZSA9IChfYyA9IG9iamVjdC5nYW1lVHlwZSkgIT09IG51bGwgJiYgX2MgIT09IH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ShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMlBhcnR5SW52aXRlKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5hY2NvdW50aWQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5sb2JieWlkID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2I7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ01zZ0dDQ1N0cmlrZTE1VjJQYXJ0eUludml0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S5SZWFkZXIgPyBpbnB1dCA6IG5ldyBtaW5pbWFsXzEuUmVhZGVyKGlucHV0KTtcbiAgICAgICAgbGV0IGVuZCA9IGxlbmd0aCA9PT0gdW5kZWZpbmVkID8gcmVhZGVyLmxlbiA6IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ01zZ0dDQ1N0cmlrZTE1VjJBY2NvdW50UmVxdWVzdENvUGxheXMoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnBsYXllcnMucHVzaChleHBvcnRzLkNNc2dHQ0NTdHJpa2UxNVYyQWNjb3VudFJlcXVlc3RDb1BsYXlzX1BsYXllci5kZWNvZGUocmVhZGVyLCByZWFkZXIudWludDMyKCkpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnNlcnZlcnRpbWUgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCBfYjtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJ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1cbiAgICAgICAgaWYgKG1lc3NhZ2Uub25saW5lID09PSB0cnVlKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDI0KS5ib29sKG1lc3NhZ2Uub25saW5lKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNNc2dHQ0NTdHJpa2UxNVYyQWNjb3VudFJlcXVlc3RDb1BsYXlzX1BsYXllcigpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuYWNjb3VudGlkID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucnRjb3BsYXkgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5vbmxpbmUgPSByZWFkZXIuYm9vbCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztc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ZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMkNsaWVudFRvR0NSZXF1ZXN0VGlja2V0KCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5hdXRob3JpemVkU3RlYW1JZCA9IHJlYWRlci5maXhlZDY0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5hdXRob3JpemVkUHVibGljSXAgPSByZWFkZXIuZml4ZWQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZ2FtZXNlcnZlclN0ZWFtSWQgPSByZWFkZXIuZml4ZWQ2NCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZ2FtZXNlcnZlclNkclJvdXRpbmcgPSByZWFkZXIuc3RyaW5nKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAg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ZSgpKSB7XG4gICAgICAgIGlmICghbWVzc2FnZS5pdGVtaWQuaXNaZXJvKCkpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoOCkudWludDY0KG1lc3NhZ2UuaXRlbWlkKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAoIW1lc3NhZ2UubWF0Y2hpZC5pc1plcm8oKSkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigxNikudWludDY0KG1lc3NhZ2UubWF0Y2hpZCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuZXZlbnRpZCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigyNCkuaW50MzIobWVzc2FnZS5ldmVudGlkKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNNc2dHQ0NTdHJpa2UxNVYyQ2xpZW50UmVxdWVzdFNvdXZlbmlyKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5pdGVtaWQgPSByZWFkZXIudWludDY0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5tYXRjaGlkID0gcmVhZGVyLnVpbnQ2NCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZXZlbnRpZCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYTtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMkNsaWVudFJlcXVlc3RTb3V2ZW5pcigpO1xuICAgICAgICBtZXNzYWdlLml0ZW1pZCA9XG4gICAgICAgICAgICBvYmplY3QuaXRlbWlkICE9PSB1bmRlZmluZWQgJiYgb2JqZWN0Lml0ZW1pZCAhPT0gbnVsbFxuICAgICAgICAgICAgICAgID8gTG9uZy5mcm9tVmFsdWUob2JqZWN0Lml0ZW1pZClcbiAgICAgICAgICAgICAgICA6IExvbmcuVVpFUk87XG4gICAgICAgIG1lc3NhZ2UubWF0Y2hpZCA9XG4gICAgICAgICAgICBvYmplY3QubWF0Y2hpZCAhPT0gdW5kZWZpbmVkICYmIG9iamVjdC5tYXRjaGlkICE9PSBudWxsXG4gICAgICAgICAgICAgICAgPyBMb25nLmZyb21WYWx1ZShvYmplY3QubWF0Y2hpZClcbiAgICAgICAgICAgICAgICA6IExvbmcuVVpFUk87XG4gICAgICAgI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0cmlrZTE1VjJDbGllbnRBY2NvdW50QmFsYW5jZSgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuYW1vdW50ID0gcmVhZGVyLnVpbnQ2NCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudXJsID0gcmVhZGVyLnN0cmluZygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYTtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMkNsaWVudEFjY291bnRCYWxhbmNlKCk7XG4gICAgICAgIG1lc3NhZ2UuYW1vdW50ID1cbiAgICAgICAgICAgIG9iamVjdC5hbW91bnQgIT09IHVuZGVmaW5lZCAmJiBvYmplY3QuYW1vdW50ICE9PSBudWxsXG4gICAgICAgICAgICAgICAgPyBMb25nLmZyb21WYWx1ZShvYmplY3QuYW1vdW50KVxuICAgICAgICAgICAgICAgIDogTG9uZy5VWkVSTztcbiAgICAgICAgbWVzc2FnZS51cmwgPSAoX2EgPSBvYmplY3QudXJsKSAhPT0gbnVsbCAmJiBfYSAhPT0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gICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuYWNjb3VudGlkID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubG9iYnlpZCA9IHJlYWRlci51aW50NjQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2E7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ01zZ0dDQ1N0cmlrZTE1VjJDbGllbnRQYXJ0eUpvaW5SZWxheSgpO1xuICAgICAgICBtZXNzYWdlLmFjY291bnRpZCA9IChfYSA9IG9iamVjdC5hY2NvdW50aWQpICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6IDA7XG4gICAgICAgIG1lc3NhZ2UubG9iYnlpZCA9XG4gICAgICAgICAgICBvYmplY3QubG9iYnlpZCAhPT0gdW5kZWZpbmVkICYmIG9iamVjdC5sb2JieWlkICE9PSBudWxsXG4gICAgICAgICAgICAgICAgPyBMb25nLmZyb21WYWx1ZShvYmplY3QubG9iYnlpZClcbiAgICAgICAgICAgICAgICA6IExvbmcuVVp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aW5nX0VudHJ5ID0ge1xuICAgIGVuY29kZShtZXNzYWdlLCB3cml0ZXIgPSBtaW5pbWFsXzEuV3JpdGVyLmNyZWF0ZSgpKSB7XG4gICAgICAgIGlmIChtZXNzYWdlLmFjY291bnRpZCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig4KS51aW50MzIobWVzc2FnZS5hY2NvdW50aWQpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLndhcm50eXBlICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDE2KS51aW50MzIobWVzc2FnZS53YXJudHlwZSk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMkNsaWVudFBhcnR5V2FybmluZ19FbnRyeSgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuYWNjb3VudGlkID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICA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cm8oKSkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig4KS51aW50NjQobWVzc2FnZS5ldmVudGlkKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5pc0Zhdm9yaXRlID09PSB0cnVlKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDE2KS5ib29sKG1lc3NhZ2UuaXNGYXZvcml0ZSk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMlNldEV2ZW50RmF2b3JpdGUoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmV2ZW50aWQgPSByZWFkZXIudWludDY0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5pc0Zhdm9yaXRlID0gcmVhZGVyLmJvb2woKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgIC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Agd3JpdGVyLnVpbnQzMig4KS5ib29sKG1lc3NhZ2UuYWxsRXZlbnRzKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNNc2dHQ0NTdHJpa2UxNVYyR2V0RXZlbnRGYXZvcml0ZXNSZXF1ZXN0KCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5hbGxFdmVudHMgPSByZWFkZXIuYm9vbCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYTtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMkdldE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7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMkdldEV2ZW50RmF2b3JpdGVzUmVzcG9uc2UoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmFsbEV2ZW50cyA9IHJlYWRlci5ib29sKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5qc29uRmF2b3JpdGVzID0gcmVhZGVyLnN0cmluZygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuanNvbkZlYXR1cmVkID0gcmVhZGVyLnN0cmluZygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZ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ICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnBlcmZjb3VudGVyID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubGVuZ3RoID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucmVmZXJlbmNlID0gcmVhZGVyLmJ5dGVzKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5hY3R1YWwgPSByZWFkZXIuYnl0ZXMoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA1OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnNvdXJjZWlkID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDY6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc3RhdHVzID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2IsIF9jLCBfZCwgX2UsIF9mO1xuICAgICAgICBjb25zdCBtZXNzY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RhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5pZCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmV4dGVuZGVkID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudmFsdWUgPSByZWFkZXIudWludDY0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zdHJpbmdWYWx1ZSA9IHJlYWRlci5zdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iLCBfYztcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDVkRpYWdub3N0aWMoKTtcbiAgICAgICAgbWVzc2FnZS5pZCA9IChfYSA9IG9iamVjdC5pZCkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogMDtcbiAgICAgICAgbWVzc2FnZS5leHRlbmRlZCA9IChfYiA9IG9iamVjdC5leHRlbmRlZCkgIT09IG51bGwgJiYgX2IgIT09IHZvaWQgMCA/IF9iIDogMDtcbiA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LFxuICAgICAgICBkaWFnbm9zdGljNDogTG9uZy5VWkVSTyxcbiAgICAgICAgZGlhZ25vc3RpYzU6IExvbmcuVVpFUk8sXG4gICAgICAgIGRpYWdub3N0aWNzOiBbXVxuICAgIH07XG59XG5leHBvcnRzLkNNc2dHQ0NTdHJpa2UxNVYyQ2xpZW50UmVwb3J0VmFsaWRhdGlvbiA9IHtcbiAgICBlbmNvZGUobWVzc2FnZSwgd3JpdGVyID0gbWluaW1hbF8xLldyaXRlci5jcmVhdGUoKSkge1xuICAgICAgICBpZiAobWVzc2FnZS5maWxlUmVwb3J0ICE9PSBcIlwiKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDEwKS5zdHJpbmcobWVzc2FnZS5maWxlUmVwb3J0KTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5jb21tYW5kTGluZSAhPT0gXCJcIikge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigxOCkuc3RyaW5nKG1lc3NhZ2UuY29tbWFuZExpbmUpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnRvdGFsRmlsZXMgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMjQpLnVpbnQzMihtZXNzYWdlLnRvdGFsRmlsZXMpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmludGVybmFsRXJyb3IgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMzIpLnVpbnQzMihtZXNzYWdlLmludGVybmFsRXJyb3IpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnRydXN0VGltZSAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig0MCkudWludDMyKG1lc3NhZ2UudHJ1c3RUaW1lKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5jb3VudFBlbmRpbmcgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNDgpLnVpbnQzMihtZXNzYWdlLmNvdW50UGVuZGluZyk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuY291bnRDb21wbGV0ZWQgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNTYpLnVpbnQzMihtZXNzYWdlLmNvdW50Q29tcGxldGVkKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5wcm9jZXNzSWQgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNjQpLnVpbnQzMihtZXNzYWdlLnByb2Nlc3NJZCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2Uub3N2ZXJzaW9uICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDcyKS5pbnQzMihtZXNzYWdlLm9zdmVyc2lvbik7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuY2xpZW50cmVwb3J0dmVyc2lvbiAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig4MCkudWludDMyKG1lc3NhZ2UuY2xpZW50cmVwb3J0dmVyc2lvbik7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2Uuc3RhdHVzSWQgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoODgpLnVpbnQzMihtZXNzYWdlLnN0YXR1c0lkKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5kaWFnbm9zdGljMSAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig5NikudWludDMyKG1lc3NhZ2UuZGlhZ25vc3RpYzEpO1xuICAgICAgICB9XG4gICAgICAgIGlmICghbWVzc2FnZS5kaWFnbm9zdGljMi5pc1plcm8oKSkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigxMDQpLnVpbnQ2NChtZXNzYWdlLmRpYWdub3N0aWMyKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAoIW1lc3NhZ2UuZGlhZ25vc3RpYzMuaXNaZXJvKCkpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTEyKS51aW50NjQobWVzc2FnZS5kaWFnbm9zdGljMyk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UubGFzdExhdW5jaERhdGEgIT09IFwiXCIpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTIyKS5zdHJpbmcobWVzc2FnZS5sYXN0TGF1bmNoRGF0YSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UucmVwb3J0Q291bnQgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTI4KS51aW50MzIobWVzc2FnZS5yZXBvcnRDb3VudCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKCFtZXNzYWdlLmNsaWVudFRpbWUuaXNaZXJvKCkpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTM2KS51aW50NjQobWVzc2FnZS5jbGllbnRUaW1lKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAoIW1lc3NhZ2UuZGlhZ25vc3RpYzQuaXNaZXJvKCkpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTQ0KS51aW50NjQobWVzc2FnZS5kaWFnbm9zdGljNCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKCFtZXNzYWdlLmRpYWdub3N0aWM1LmlzWmVybygpKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDE1MikudWludDY0KG1lc3NhZ2UuZGlhZ25vc3RpYzUpO1xuICAgICAgICB9XG4gICAgICAgIGZvciAoY29uc3QgdiBvZiBtZXNzYWdlLmRpYWdub3N0aWNzKSB7XG4gICAgICAgICAgICBleHBvcnRzLkNWRGlhZ25vc3RpYy5lbmNvZGUodiwgd3JpdGVyLnVpbnQzMigxNjIpLmZvcmsoKSkubGRlbGltKCk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMkNsaWVudFJlcG9ydFZhbGlkYXRpb24oKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmZpbGVSZXBvcnQgPSByZWFkZXIuc3RyaW5nKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5jb21tYW5kTGluZSA9IHJlYWRlci5zdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnRvdGFsRmlsZXMgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5pbnRlcm5hbEVycm9yID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudHJ1c3RUaW1lID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDY6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuY291bnRQZW5kaW5nID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDc6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuY291bnRDb21wbGV0ZWQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgODpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5wcm9jZXNzSWQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgOTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5vc3ZlcnNpb24gPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxMDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5jbGllbnRyZXBvcnR2ZXJzaW9uID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDExOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnN0YXR1c0lkID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDEyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmRpYWdub3N0aWMxID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDEzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmRpYWdub3N0aWMyID0gcmVhZGVyLnVpbnQ2NCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDE0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmRpYWdub3N0aWMzID0gcmVhZGVyLnVpbnQ2NCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDE1OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmxhc3RMYXVuY2hEYXRhID0gcmVhZGVyLnN0cmluZygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDE2OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnJlcG9ydENvdW50ID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDE3OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmNsaWVudFRpbWUgPSByZWFkZXIudWludDY0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTg6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZGlhZ25vc3RpYzQgPSByZWFkZXIudWludDY0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTk6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZGlhZ25vc3RpYzUgPSByZWFkZXIudWludDY0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjA6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZGlhZ25vc3RpY3MucHVzaChleHB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gICA/IExvbmcuZnJvbVZhbHVlKG9iamVjdC5kaWFnbm9zdGljMilcbiAgICAgICAgICAgICAgICA6IExvbmcuVVpFUk87XG4gICAgICAgIG1lc3NhZ2UuZGlhZ25vc3RpYzMgPVxuICAgICAgICAgICAgb2JqZWN0LmRpYWdub3N0aWMzICE9PSB1bmRlZmluZWQgJiYgb2JqZWN0LmRpYWdub3N0aWMzICE9PSBudWxsXG4gICAgICAgICAgICAgICAgPyBMb25nLmZyb21WYWx1ZShvYmplY3QuZGlhZ25vc3RpYzMpXG4gICAgICAgICAgICAgICAgOiBMb25nLlVaRVJPO1xuICAgICAgICBtZXNzYWdlLmxhc3RMYXVuY2hEYXRhID0gKF9vID0gb2JqZWN0Lmxhc3RMYXVuY2hEYXRhKSAhPT0gbnVsbCAmJiBfbyAhPT0gdm9pZCAwID8gX28gOiBcIlwiO1xuICAgICAgICBtZXNzYWdlLnJlcG9ydENvdW50ID0gKF9wID0gb2JqZWN0LnJlcG9ydENvdW50KSAhPT0gbnVsbCAmJiBfcCAhPT0gdm9pZCAwID8gX3AgOiAwO1xuICAgICAgICBtZXNzYWdlLmNsaWVudFRpbWUgPVxuICAgICAgICAgICAgb2JqZWN0LmNsaWVudFRpbWUgIT09IHVuZGVmaW5lZCAmJiBvYmplY3QuY2xpZW50VGltZSAhPT0gbnVsbFxuICAgICAgICAgICAgICAgID8gTG9uZy5mcm9tVmFsdWUob2JqZWN0LmNsaWVudFRpbWUpXG4gICAgICAgICAgICAgICAgOiBMb25nLlVaRVJPO1xuICAgICAgICBtZXNzYWdlLmRpYWdub3N0aWM0ID1cbiAgICAgICAgICAgIG9iamVjdC5kaWFnbm9zdGljNCAhPT0gdW5kZWZpbmVkICYmIG9iamVjdC5kaWFnbm9zdGljNCAhPT0gbnVsbFxuICAgICAgICAgICAgICAgID8gTG9uZy5mcm9tVmFsdWUob2JqZWN0LmRpYWdub3N0aWM0KVxuICAgICAgICAgICAgICAgIDogTG9uZy5VWkVSTztcbiAgICAgICA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hZ2UuZmlsZVJlcG9ydCA9IHJlYWRlci5zdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm9mZmVySW5zZWN1cmVNb2RlID0gcmVhZGVyLmJvb2woKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm9mZmVyU2VjdXJlTW9kZSA9IHJlYWRlci5ib29sKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zaG93VW5zaWduZWRVaSA9IHJlYWRlci5ib29sKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5raWNrVXNlciA9IHJlYWRlci5ib29sKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zaG93VHJ1c3RlZFVpID0gcmVhZGVyLmJvb2woKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA3OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnNob3dXYXJuaW5nTm90VHJ1c3RlZCA9IHJlYWRlci5ib29sKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgODpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zaG93V2FybmluZ05vdFRydXN0ZWQyID0gcmVhZGVyLmJvb2woKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICA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AgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubmFtZSA9IHJlYWRlci5zdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm91dHB1dG5hbWUgPSByZWFkZXIuc3RyaW5nKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5rZXlEYXRhID0gcmVhZGVyLmJ5dGVzKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zaGFIYXNoID0gcmVhZGVyLmJ5dGVzKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5jb29raWUgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA3OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm1hbmlmZXN0ID0gcmVhZGVyLnN0cmluZygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDg6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc3lzdGVtUGFja2FnZSA9IHJlYWRlci5ieXRlcygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDk6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubG9hZFN5c3RlbSA9IHJlYWRlci5ib29sKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuIC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yZWF0ZSgpKSB7XG4gICAgICAgIGlmIChtZXNzYWdlLnN1Y2Nlc3MgPT09IHRydWUpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoOCkuYm9vbChtZXNzYWdlLnN1Y2Nlc3MpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmRpYWdub3N0aWMgIT09IFwiXCIpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTgpLnN0cmluZyhtZXNzYWdlLmRpYWdub3N0aWMpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnNoYUhhc2gubGVuZ3RoICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDI2KS5ieXRlcyhtZXNzYWdlLnNoYUhhc2gpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnJlc3BvbnNlICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDMyKS5pbnQzMihtZXNzYWdlLnJlc3BvbnNlKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5lcnJvckNvZGUxICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDQwKS5pbnQzMihtZXNzYWdlLmVycm9yQ29kZTEpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmVycm9yQ29kZTIgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNDgpLmludDMyKG1lc3NhZ2UuZXJyb3JDb2RlMik7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKCFtZXNzYWdlLmhhbmRsZS5pc1plcm8oKSkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig1NikuaW50NjQobWVzc2FnZS5oYW5kbGUpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmVpbml0UmVzdWx0ICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDY0KS5pbnQzMihtZXNzYWdlLmVpbml0UmVzdWx0KTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5hdXhTeXN0ZW0xICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDcyKS5pbnQzMihtZXNzYWdlLmF1eFN5c3RlbTEpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmF1eFN5c3RlbTIgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoODApLmludDMyKG1lc3NhZ2UuYXV4U3lzdGVtMik7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnR0NDU3RyaWtlMTVWMkdDMkNsaWVudEluaXRTeXN0ZW1SZXNwb25zZSgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc3VjY2VzcyA9IHJlYWRlci5ib29sKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5kaWFnbm9zdGljID0gcmVhZGVyLnN0cmluZygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc2hhSGFzaCA9IHJlYWRlci5ieXRlcygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucmVzcG9uc2UgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA1OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmVycm9yQ29kZTEgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA2OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmVycm9yQ29kZTIgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA3OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmhhbmRsZSA9IHJlYWRlci5pbnQ2NCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDg6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZWluaXRSZXN1bHQgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA5OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmF1eFN5c3RlbTEgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxMDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5hdXhTeXN0ZW0yID0gcmVhZGV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lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNDU1Vzck1zZ1ZHVUlNZW51KCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5uYW1lID0gcmVhZGVyLnN0cmluZygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc2hvdyA9IHJlYWRlci5ib29sKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zdWJrZXlzLnB1c2goZXhwb3J0cy5DQ1NVc3JNc2dWR1VJTWVudV9TdWJrZXkuZGVjb2RlKHJlYWRlciwgcmVhZGVyLnVpbnQzMigpKSk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCBfYiwgX2M7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ0NTVXNyTXNnVkdVSU1lbnUoKTtcbiAgICAgICAgb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25zdCByZWFkZXIgPSBpbnB1dCBpbnN0YW5jZW9mIG1pbmltYWxfMS5SZWFkZXIgPyBpbnB1dCA6IG5ldyBtaW5pbWFsXzEuUmVhZGVyKGlucHV0KTtcbiAgICAgICAgbGV0IGVuZCA9IGxlbmd0aCA9PT0gdW5kZWZpbmVkID8gcmVhZGVyLmxlbiA6IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ0NTVXNyTXNnVkdVSU1lbnVfU3Via2V5KCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5uYW1lID0gcmVhZGVyLnN0cmluZygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc3RyID0gcmVhZGVyLnN0cmluZygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2I7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ0NTVXNyTXNnVkdVSU1lbnVfU3Via2V5KCk7XG4gICAgICAgIG1lc3NhZ2UubmFtZSA9IChfYSA9IG9iam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WRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDQ1NVc3JNc2dUcmFpbigpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudHJhaW4gPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2E7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ0NTVXNyTXNnVHJhaW4oKTtcbiAgICAgICAgbWVzc2FnZS50cmFpbiA9IChfYSA9IG9iamVjdC50cmFpbikgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogMDtcbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfVxufTtcbmZ1bmN0aW9uIGNyZWF0ZUJhc2VDQ1NVc3JNc2dIdWRUZXh0KCkge1xuICAgIHJldHVybiB7IHRleHQ6IFwiXCIgfTtcbn1cbmV4cG9ydHMuQ0NTVXNyTXNnSHVkVGV4dCA9IHtcbiAgICBlbmNvZGUobWVzc2FnZSwgd3JpdGVyID0gbWluaW1hbF8xLldyaXRlci5jcmVhdGUoKSkge1xuICAgICAgICBpZiAobWVzc2FnZS50ZXh0ICE9PSBcIlwiKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDEwKS5zdHJpbmcobWVzc2FnZS50ZXh0KTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNDU1Vzck1zZ0h1ZFRleHQoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnRleHQgPSByZWFkZXIuc3RyaW5nKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSx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gfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNDU1Vzck1zZ1NheVRleHQoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmVudElkeCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudGV4dCA9IHJlYWRlci5zdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmNoYXQgPSByZWFkZXIuYm9vbCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudGV4dGFsbGNoYXQgPSByZWFkZXIuYm9vbCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICA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F0ZUJhc2VDQ1NVc3JNc2dTYXlUZXh0MigpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZW50SWR4ID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5jaGF0ID0gcmVhZGVyLmJvb2woKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm1zZ05hbWUgPSByZWFkZXIuc3RyaW5nKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5wYXJhbXMucHVzaChyZWFkZXIuc3RyaW5nKCkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudGV4dGFsbGNoYXQgPSByZWFkZXIuYm9vbCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciB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zMig4KS5pbnQzMihtZXNzYWdlLm1zZ0RzdCk7XG4gICAgICAgIH1cbiAgICAgICAgZm9yIChjb25zdCB2IG9mIG1lc3NhZ2UucGFyYW1zKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDI2KS5zdHJpbmcodik7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDQ1NVc3JNc2dUZXh0TXNnKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5tc2dEc3QgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnBhcmFtcy5wdXNoKHJlYWRlci5zdHJpbmcoKSk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7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gIHdyaXRlci51aW50MzIoOCkuaW50MzIobWVzc2FnZS5jaGFubmVsKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5wb3MgIT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgbmV0bWVzc2FnZXNfMS5DTXNnVmVjdG9yMkQuZW5jb2RlKG1lc3NhZ2UucG9zLCB3cml0ZXIudWludDMyKDE4KS5mb3JrKCkpLmxkZWxpbSgpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmNscjEgIT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgbmV0bWVzc2FnZXNfMS5DTXNnUkdCQS5lbmNvZGUobWVzc2FnZS5jbHIxLCB3cml0ZXIudWludDMyKDI2KS5mb3JrKCkpLmxkZWxpbSgpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmNscjIgIT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgbmV0bWVzc2FnZXNfMS5DTXNnUkdCQS5lbmNvZGUobWVzc2FnZS5jbHIyLCB3cml0ZXIudWludDMyKDM0KS5mb3JrKCkpLmxkZWxpbSgpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmVmZmVjdCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig0MCkuaW50MzIobWVzc2FnZS5lZmZlY3QpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmZhZGVJblRpbWUgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNTMpLmZsb2F0KG1lc3NhZ2UuZmFkZUluVGltZSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuZmFkZU91dFRpbWUgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNjEpLmZsb2F0KG1lc3NhZ2UuZmFkZU91dFRpbWUpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmhvbGRUaW1lICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDc3KS5mbG9hdChtZXNzYWdlLmhvbGRUaW1lKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5meFRpbWUgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoODUpLmZsb2F0KG1lc3NhZ2UuZnhUaW1lKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS50ZXh0ICE9PSBcIlwiKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDkwKS5zdHJpbmcobWVzc2FnZS50ZXh0KTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNDU1Vzck1zZ0h1ZE1zZygpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuY2hhbm5lbCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucG9zID0gbmV0bWVzc2FnZXNfMS5DTXNnVmVjdG9yMkQuZGVjb2RlKHJlYWRlciwgcmVhZGVyLnVpbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmNscjEgPSBuZXRtZXNzYWdlc18xLkNNc2dSR0JBLmRlY29kZShyZWFkZXIsIHJlYWRlci51aW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5jbHIyID0gbmV0bWVzc2FnZXNfMS5DTXNnUkdCQS5kZWNvZGUocmVhZGVyLCByZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZWZmZWN0ID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5mYWRlSW5UaW1lID0gcmVhZGVyLmZsb2F0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5mYWRlT3V0VGltZSA9IHJlYWRlci5mbG9hdCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDk6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuaG9sZFRpbWUgPSByZWFkZXIuZmxvYXQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxMDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5meFRpbWUgPSByZWFkZXIuZmxvYXQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50ZXh0ID0gcmVhZGVyLnN0cmluZygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2IsIF9jLCBfZCwgX2UsIF9mLCBfZztcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDQ1NVc3JNc2dIdWRNc2coKTtcbiAgICAgICAgbWVzc2FnZS5jaGFubmVsID0gKF9hID0gb2JqZWN0LmNoYW5uZWwpICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6IDA7XG4gICAgICAgIG1lc3NhZ2UucG9zID1cbiAgICAgICAgICAgIG9iamVjdC5wb3MgIT09IHVuZGVmaW5lZCAmJiBvYmplY3QucG9zICE9PSBudWxsXG4gICAgICAgICAgICAgICAgPyBuZXRtZXNzYWdlc18xLkNNc2dWZWN0b3IyRC5mcm9tUGFydGlhbChvYmplY3QucG9zKVxuICAgICAgICAgICAgICAgIDogdW5kZWZpbmVkO1xuICAgICAgICBtZXNzYWdlLmNscjEgPVxuICAgICAgICAgICAgb2JqZWN0LmNscjEgIT09IHVuZGVmaW5lZCAmJiBvYmplY3QuY2xyMSAhPT0gbnVsbFxuICAgICAgICAgICAgICAgID8gbmV0bWVzc2FnZXNfMS5DTXNnUkdCQS5mcm9tUGFydGlhbChvYmplY3QuY2xyMSlcbiAgICAg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9IGNyZWF0ZUJhc2VDQ1NVc3JNc2dTaGFrZSgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuY29tbWFuZCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubG9jYWxBbXBsaXR1ZGUgPSByZWFkZXIuZmxvYXQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmZyZXF1ZW5jeSA9IHJlYWRlci5mbG9hdCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZHVyYXRpb24gPSByZWFkZXIuZmxvYXQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iLCBfYywgX2Q7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ0NTVXNyTXNnU2hha2UoKTtcbiAgICAgICAgbWVzc2F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KSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDI0KS5pbnQzMihtZXNzYWdlLmZsYWdzKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5jbHIgIT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgbmV0bWVzc2FnZXNfMS5DTXNnUkdCQS5lbmNvZGUobWVzc2FnZS5jbHIsIHdyaXRlci51aW50MzIoMzQpLmZvcmsoKSkubGRlbGltKCk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDQ1NVc3JNc2dGYWRlKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5kdXJhdGlvbiA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuaG9sZFRpbWUgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmZsYWdzID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5jbHIgPSBuZXRtZXNzYWdlc18xLkNNc2dSR0JBLmRlY29kZShyZWFkZXIsIHJlYWRlci51aW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCBfYiwgX2M7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ0NTVXNyTXNnRmFkZSgpO1xuICAgICAgICBtZXNzYWdlLmR1cmF0aW9uID0gKF9hID0gb2JqZWN0LmR1cmF0aW9uKSAhPT0gbnVsbCAmJiBfYSAhPT0gdm9pZCAwID8gX2EgOiAwO1xuICAgICAgICBtZXNzYWdlLmhvbGRUaW1lID0gKF9iID0gb2JqZWN0LmhvbGRUaW1lKSAhPT0gbnVsbCAmJiBfYiAhPT0gdm9pZCAwID8gX2IgOiAwO1xuICAgICAgICBtZXNzYWdlLmZsYWdzID0gKF9jID0gb2JqZWN0LmZsYWdzKSAhPT0gbnVsbCAmJiBfYyAhPT0gdm9pZCAwID8gX2MgOiAwO1xuICAgICAgICBtZXNzYWdlLmNsciA9XG4gICAgICAgICAgICBvYmplY3QuY2xyICE9PSB1bmRlZmluZWQgJiYgb2JqZWN0LmNsciAhPT0gbnVsbFxuICAgICAgICAgICAgICAgID8gbmV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bnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ0NTVXNyTXNnUnVtYmxlKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5pbmRleCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZGF0YSA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZmxhZ3MgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iLCBfYztcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDQ1NVc3JNc2dSdW1ibGUoKTtcbiAgICAgICAgbWVzc2FnZS5pbmRleCA9IChfYSA9IG9iamVjdC5pbmRleCkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogMDtcbiAgICAgICAgbWVzc2FnZS5kYXRhID0gKF9iID0gb2JqZWN0LmRhdGEpICE9PS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ZWNvZGUoaW5wdXQsIGxlbmd0aCkge1xuICAgICAgICBjb25zdCByZWFkZXIgPSBpbnB1dCBpbnN0YW5jZW9mIG1pbmltYWxfMS5SZWFkZXIgPyBpbnB1dCA6IG5ldyBtaW5pbWFsXzEuUmVhZGVyKGlucHV0KTtcbiAgICAgICAgbGV0IGVuZCA9IGxlbmd0aCA9PT0gdW5kZWZpbmVkID8gcmVhZGVyLmxlbiA6IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ0NTVXNyTXNnQ2xvc2VDYXB0aW9uKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5oYXNoID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZHVyYXRpb24gPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmZyb21QbGF5ZXIgPSByZWFkZXIuYm9vbCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuY2N0b2tlbiA9IHJlYWRlci5zdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLn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ZSgpKSB7XG4gICAgICAgIGlmIChtZXNzYWdlLmhhc2ggIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoOCkudWludDMyKG1lc3NhZ2UuaGFzaCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuZHVyYXRpb24gIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTYpLmludDMyKG1lc3NhZ2UuZHVyYXRpb24pO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmZyb21QbGF5ZXIgPT09IHRydWUpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMjQpLmJvb2wobWVzc2FnZS5mcm9tUGxheWVyKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNDU1Vzck1zZ0Nsb3NlQ2FwdGlvbkRpcmVjdCgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuaGFzaCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICA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Y2VGaWxlbmFtZSAhPT0gXCJcIikge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigzNCkuc3RyaW5nKG1lc3NhZ2Uudm9pY2VGaWxlbmFtZSk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDQ1NVc3JNc2dSYXdBdWRpbygpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucGl0Y2ggPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmVudGlkeCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZHVyYXRpb24gPSByZWFkZXIuZmxvYXQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgIC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TWFza3MucHVzaChleHBvcnRzLkNDU1Vzck1zZ1ZvaWNlTWFza19QbGF5ZXJNYXNrLmRlY29kZShyZWFkZXIsIHJlYWRlci51aW50MzIoKSkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucGxheWVyTW9kRW5hYmxlID0gcmVhZGVyLmJvb2woKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNDU1Vzck1zZ1ZvaWNlTWFzaygpO1xuICAgICAgICBtZXNzYWdlLnBsYXllck1hc2tzID1cbiAgICAgICAgICAgICgoX2EgPSBvYmplY3QucGxheWVyTWFza3MpID09PSBudWxsIHx8IF9hID09PSB2b2lkIDAgPyB2b2lkIDAgOiBfYS5tYXAoZSA9PiBleHBvcnRzLkNDU1Vzck1zZ1ZvaWNlTWFza19QbGF5ZXJNYXNrLmZyb21QYXJ0aWFsKGUpKSkgfHwgW107XG4gICAgICAgIG1lc3NhZ2UucGxheWVyTW9kRW5hYmxlID0gKF9iID0gb2JqZWN0LnBsYXllck1vZEVuYWJsZSkgIT09IG51bGwgJiYgX2IgIT09IHZvaWQgMCA/IF9iIDogZmFsc2U7XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH1cbn07XG5mdW5jdGlvbiBjcmVhdGVCYXNlQ0NTVXNyTXNnVm9pY2VNYXNrX1B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ICAgICAgICAgICAgICAgICAgbWVzc2FnZS5nYW1lUnVsZXNNYXNrID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5iYW5NYXNrcyA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2I7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ0NTVXNyTXNnVm9pY2VNYXNrX1BsYXllck1hc2soKTtcbiAgICAgICAgbWVzc2FnZS5nYW1lUnVsZXNNYXNrID0gKF9hID0gb2JqZWN0LmdhbWVSdWxlc01hc2spICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6IDA7XG4gICAgICAgIG1lc3NhZ2UuYmFuTWFza3MgPSAoX2IgPSBvYmplY3QuYmFuTWFza3MpICE9PSBudWxsICYmIF9iICE9PSB2b2lkIDAgPyBfYiA6IDA7XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH1cbn07XG5mdW5jdGlvbiBjcmVhdGVCYXNlQ0NTVXNyTXNnRGFtYWdlKCkge1xuICAgIHJldHVybiB7IGFtb3VudDogMCwgaW5mbGljdG9yV29ybGRQb3M6IHVuZGVmaW5lZCwgdmljdGltRW50aW5kZXg6IDAgfTtcbn1cbmV4cG9ydHMuQ0NTVXNyTXNnRGFtYWdlID0ge1xuICAgIGVuY29kZShtZXN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cbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuYW1vdW50ID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5pbmZsaWN0b3JXb3JsZFBvcyA9IG5ldG1lc3NhZ2VzXzEuQ01zZ1ZlY3Rvci5kZWNvZGUocmVhZGVyLCByZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudmljdGltRW50aW5kZXggPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNDU1Vzck1zZ0RhbWFnZSgpO1xuICAgICAgICBtZXNzYWdlLmFtb3VudCA9IChfYSA9IG9iamVjdC5hbW91bnQpICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6IDA7XG4gICAgICAgIG1lc3NhZ2UuaW5mbGljdG9yV29ybGRQb3MgPVxuICAgICAgICAgICAgb2JqZWN0LmluZmxpY3RvcldvcmxkUG9zICE9PSB1bmRlZmluZWQgJiZcbiAgICAgICAgICAgICAgICBvYmplY3QuaW5mbGljdG9yV29ybGRQb3MgIT09IG51bGxcbiAgICAgICAgICAgICAgICA/IG5ldG1lc3NhZ2VzXzEuQ01zZ1ZlY3Rvci5mcm9tUGFydGlhbChvYmplY3QuaW5mbGljdG9yV29ybGRQb3MpXG4gICAgICAgICAgICAgICAgOiB1bmRlZmluZWQ7XG4gICAgICAgIG1lc3NhZ2UudmljdGltRW50aW5kZXggPSAoX2IgPSBvYmplY3QudmljdGltRW50aW5kZXgpICE9PSBudWxsICYmIF9iICE9PSB2b2lkIDAgPyBfYiA6IDA7XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH1cbn07XG5mdW5jdGlvbiBjcmVhdGVCYXNlQ0NTVXNyTXNnUmFkaW9UZXh0KCkge1xuICAgIHJldHVybiB7IG1zZ0RzdDogMCwgY2xpZW50OiAwLCBtc2dOYW1lOiBcIlwiLCBwYXJhbXM6IFtdIH07XG59XG5leHBvcnRzLkNDU1Vzck1zZ1JhZGlvVGV4dCA9IHtcbiAgICBlbmNvZGUobWVzc2FnZSwgd3JpdGVyID0gbWluaW1hbF8xLldyaXRlci5jcmVhdGUoKSkge1xuICAgICAgICBpZiAobWVzc2FnZS5tc2dEc3QgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoOCkuaW50MzIobWVzc2FnZS5tc2dEc3QpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmNsaWVudCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigxNikuaW50MzIobWVzc2FnZS5jbGllbnQpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLm1zZ05hbWUgIT09IFwiXCIpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMjYpLnN0cmluZyhtZXNzYWdlLm1zZ05hbWUpO1xuICAgICAgICB9XG4gICAgICAgIGZvciAoY29uc3QgdiBvZiBtZXNzYWdlLnBhcmFtcykge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigzNCkuc3RyaW5nKHYpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiB3cml0ZXI7XG4gICAgfSxcbiAgICBkZWNvZGUoaW5wdXQsIGxlbmd0aCkge1xuICAgICAgICBjb25zdCByZWFkZXIgPSBpbnB1dCBpbnN0YW5jZW9mIG1pbmltYWxfMS5SZWFkZXIgPyBpbnB1dCA6IG5ldyBtaW5pbWFsXzEuUmVhZGVyKGlucHV0KTtcbiAgICAgICAgbGV0IGVuZCA9IGxlbmd0aCA9PT0gdW5kZWZpbmVkID8gcmVhZGVyLmxlbiA6IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ0NTVXNyTXNnUmFkaW9UZXh0KCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5tc2dEc3QgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmNsaWVudCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubXNnTmFtZSA9IHJlYWRlci5zdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnBhcmFtcy5wdXNoKHJlYWRlci5zdHJpbmcoKSk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICA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obWVzc2FnZS50ZXh0ICE9PSBcIlwiKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDEwKS5zdHJpbmcobWVzc2FnZS50ZXh0KTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNDU1Vzck1zZ0hpbnRUZXh0KCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50ZXh0ID0gcmVhZGVyLnN0cmluZygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYTtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDQ1NVc3JNc2dIaW50VGV4dCg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xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZW50aXR5SWR4ID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5jbGFzc0lkID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5vcmlnaW5YID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5vcmlnaW5ZID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5vcmlnaW5aID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5hbmdsZVkgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA3OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmRlZnVzZXIgPSByZWFkZXIuYm9vbCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDg6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucGxheWVySGFzRGVmdXNlciA9IHJlYWRlci5ib29sKCk7XG4gICAgICAgICAgIC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dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDQ1NVc3JNc2dTZW5kUGxheWVySXRlbUZvdW5kKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5pdGVtaW5mbyA9IGNzdHJpa2UxNV9nY21lc3NhZ2VzXzEuQ0Vjb25JdGVtUHJldmlld0RhdGFCbG9jay5kZWNvZGUocmVhZGVyLCByZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZW50aW5kZXggPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2E7XG4gICAgICAgI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AgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2Uub3JpZ2luWCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigyOSkuZmxvYXQobWVzc2FnZS5vcmlnaW5YKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5vcmlnaW5ZICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDM3KS5mbG9hdChtZXNzYWdlLm9yaWdpblkpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLm9yaWdpblogIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNDUpLmZsb2F0KG1lc3NhZ2Uub3JpZ2luWik7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDQ1NVc3JNc2dSZWxvYWRFZmZlY3QoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmVudGlkeCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuYWN0YW5pbSA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uub3JpZ2luWCA9IHJlYWRlci5mbG9hdCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uub3JpZ2luWSA9IHJlYWRlci5mbG9hdCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uub3JpZ2luWiA9IHJlYWRlci5mbG9hdCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2IsIF9jLCBfZCwgX2U7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ0NTVXNyTXNnUmVsb2FkRWZmZWN0KCk7XG4gICAgICAgIG1lc3NhZ2UuZW50aWR4ID0gKF9hID0gb2JqZWN0LmVudGlkeCkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogMDtcbiAgICAgICAgbWVzc2FnZS5hY3RhbmltID0gKF9iID0gb2JqZWN0LmFjdGFuaW0pICE9PSBudWxsICYmIF9iICE9PSB2b2lkIDAgPyBfYiA6IDA7XG4gICAg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Rlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uub3JpZ2luWCA9IHJlYWRlci5mbG9hdCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uub3JpZ2luWSA9IHJlYWRlci5mbG9hdCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uub3JpZ2luWiA9IHJlYWRlci5mbG9hdCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc291bmQgPSByZWFkZXIuc3RyaW5nKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50aW1lc3RhbXAgPSByZWFkZXIuZmxvYXQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iLCBfYywgX2QsIF9lLCBfZjtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDQ1NVc3JNc2dXZWFwb25Tb3VuZCgpO1xuICAgICAgICBtZXNzYWd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AgICAgICAgbWVzc2FnZS5lbnRpZHggPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmhlYWx0aHJhdGlvT2xkID0gcmVhZGVyLmZsb2F0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5oZWFsdGhyYXRpb05ldyA9IHJlYWRlci5mbG9hdCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc3R5bGUgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iLCBfYywgX2Q7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ0NTVXNyTXNnVXBkYXRlU2NyZWVuSGVhbHRoQmFyKCk7XG4gICAgICAgIG1lc3NhZ2UuZW50aWR4ID0gKF9hID0gb2JqZWN0LmVudGlkeCkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogMDtcbiAgICAgICAgbWVzc2FnZS5oZWFsdGhyYXRpb09sZCA9IChfYiA9IG9iamVjdC5oZWFsdGhyYXRpb09sZCkgIT09IG51bGwgJiYgX2IgIT09IHZvaWQg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cihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNDU1Vzck1zZ0VudGl0eU91dGxpbmVIaWdobGlnaHQoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmVudGlkeCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucmVtb3ZlaGlnaGxpZ2h0ID0gcmVhZGVyLmJvb2woKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNDU1Vzck1zZ0VudGl0eU91dGxpbmVIaWdobGlnaHQoKTtcbiAgICAgICAgbWVzc2FnZS5lbnRpZHggPSAoX2EgPSBvYmplY3QuZW50aWR4KSAhPT0gbnVsbCAmJiBfYSAhPT0gdm9pZCAwID8gX2EgOiAwO1xuICAgICAgICB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uICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmFtb3VudCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYTtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDQ1NVc3JNc2dBZGp1c3RNb25leSgpO1xuICAgICAgICBtZXNzYWdlLmFtb3VudCA9IChfYSA9IG9iamVjdC5hbW91bnQpICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6IDA7XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH1cbn07XG5mdW5jdGlvbiBjcmVhdGVCYXNlQ0NTVXNyTXNnUmVwb3J0SGl0KCkge1xuICAgIHJldHVybiB7IHBvc1g6IDAsIHBvc1k6IDAsIHRpbWVzdGFtcDogMCwgcG9zWjogMCB9O1xufVxuZXhwb3J0cy5DQ1NVc3JNc2dSZXBvcnRIaXQgPSB7XG4gICAgZW5jb2RlKG1lc3NhZ2UsIHdyaXRlciA9IG1pbmltYWxfMS5Xcml0ZXIuY3JlYXRlKCkpIHtcbiAgICAgICAgaWYgKG1lc3NhZ2UucG9zWCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigxMykuZmxvYXQobWVzc2FnZS5wb3NYKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5wb3NZICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDIxKS5mbG9hdChtZXNzYWdlLnBvc1kpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnRpbWVzdGFtcCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigzNykuZmxvYXQobWVzc2FnZS50aW1lc3RhbXApO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnBvc1ogIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMjkpLmZsb2F0KG1lc3NhZ2UucG9zWik7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDQ1NVc3JNc2dSZXBvcnRIaXQoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnBvc1ggPSByZWFkZXIuZmxvYXQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnBvc1kgPSByZWFkZXIuZmxvYXQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnRpbWVzdGFtcCA9IHJlYWRlci5mbG9hdCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucG9zWiA9IHJlYWRlci5mbG9hdCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2IsIF9jLCBfZDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDQ1NVc3JNc2dSZXBvcnRIaXQoKTtcbiAgICAgICAgbWVzc2FnZS5wb3NYID0gKF9hID0gb2JqZWN0LnBvc1gpICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6IDA7XG4gICAgICAgIG1lc3NhZ2UucG9zWSA9IChfYiA9IG9iamVjdC5wb3NZKSAhPT0gbnVsbCAmJiBfYiAhPT0gdm9pZCAwID8gX2IgOiAwO1xuICAgICAgICBtZXNzYWdlLnRpbWVzdGFtcCA9IChfYyA9IG9iamVjdC50aW1lc3RhbXApICE9PSBudWxsICYmIF9jICE9PSB2b2lkIDAgPyBfYyA6IDA7XG4gICAgICAgIG1lc3NhZ2UucG9zWiA9IChfZCA9IG9iamVjdC5wb3NaKSAhPT0gbnVsbCAmJiBfZCAhPT0gdm9pZCAwID8gX2QgOiAwO1xuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9XG59O1xuZnVuY3Rpb24gY3JlYXRlQmFzZUNDU1Vzck1zZ0tpbG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dCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5vYnNNb2RlID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5maXJzdFRhcmdldCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc2Vjb25kVGFyZ2V0ID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCBfYiwgX2M7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ0NTVXNyTXNnS2lsbENhbSgpO1xuICAgICAgICBtZXNzYWdlLm9ic01vZGUgPSAoX2EgPSBvYmplY3Qub2JzTW9kZSkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogMDtcbiAgICAgICAgbWVzc2FnZS5maXJzdFRhcmdldCA9IChfYiA9IG9iamVjdC5maXJzdFRhcmdldCkgIT09IG51bGwgJiYgX2IgIT09IHZvaWQgMCA/IF9iIDogMDtcbiAgICAgICAgbWVzc2FnZS5zZWNvbmRU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AgICAgICB3cml0ZXIudWludDMyKDM3KS5mbG9hdChtZXNzYWdlLnN0YXJ0QmxlbmRUaW1lKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNDU1Vzck1zZ0Rlc2lyZWRUaW1lc2NhbGUoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmRlc2lyZWRUaW1lc2NhbGUgPSByZWFkZXIuZmxvYXQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmR1cmF0aW9uUmVhbHRpbWVTZWMgPSByZWFkZXIuZmxvYXQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmludGVycG9sYXRvclR5cGUgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA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AgICAgICB3cml0ZXIudWludDMyKDI0KS5pbnQzMihtZXNzYWdlLnVzZXJJZCk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDQ1NVc3JNc2dBY2hpZXZlbWVudEV2ZW50KCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5hY2hpZXZlbWVudCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuY291bnQgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnVzZXJJZCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4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AgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5tcE1heHJvdW5kcyAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigxNikuaW50MzIobWVzc2FnZS5tcE1heHJvdW5kcyk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UubXBXaW5saW1pdCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigyNCkuaW50MzIobWVzc2FnZS5tcFdpbmxpbWl0KTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5tcFRpbWVsaW1pdCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigzMikuaW50MzIobWVzc2FnZS5tcFRpbWVsaW1pdCk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDQ1NVc3JNc2dNYXRjaEVuZENvbmRpdGlvbnMoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmZyYWdsaW1pdCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubXBNYXhyb3VuZHMgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm1wV2lubGltaXQgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm1wVGltZWxpbWl0ID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCBfYiwgX2MsIF9kO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNDU1Vzck1zZ01hdGNoRW5kQ29uZGl0aW9ucygpO1xuICAgICAgICBtZXNzYWdlLmZyYWdsaW1pdCA9IChfYSA9IG9iamVjdC5mcmFnbGltaXQpICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6IDA7XG4gICAgICAgIG1lc3NhZ2UubXBNYXhyb3VuZHMgPSAoX2IgPSBvYmplY3QubXBNYXhyb3VuZHMpICE9PSBudWxsICYmIF9iICE9PSB2b2lkIDAgPyBfYiA6IDA7XG4gICAgICAgIG1lc3NhZ2UubXBXaW5saW1pdCA9IChfYyA9IG9iamVjdC5tcFdpbmx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4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDQ1NVc3JNc2dQbGF5ZXJTdGF0c1VwZGF0ZSgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudmVyc2lvbiA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc3RhdHMucHVzaChleHBvcnRzLkNDU1Vzck1zZ1BsYXllclN0YXRzVXBkYXRlX1N0YXQuZGVjb2RlKHJlYWRlciwgcmVhZGVyLnVpbnQzMigpKSk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS51c2VySWQgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA2OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdl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NwbGF5ID09PSB0cnVlKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDgpLmJvb2wobWVzc2FnZS5kaXNwbGF5KTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS51c2VySWQgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTYpLmludDMyKG1lc3NhZ2UudXNlcklkKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNDU1Vzck1zZ0Rpc3BsYXlJbnZlbnRvcnkoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmRpc3BsYXkgPSByZWFkZXIuYm9vbCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudXNlcklkID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRl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WludDMyKDE2KS51aW50MzIobWVzc2FnZS5ub3JtYWxQb2ludHMpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmJvbnVzUG9pbnRzICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDI0KS51aW50MzIobWVzc2FnZS5ib251c1BvaW50cyk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuaXNFdmVudFF1ZXN0ID09PSB0cnVlKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDMyKS5ib29sKG1lc3NhZ2UuaXNFdmVudFF1ZXN0KTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNDU1Vzck1zZ1F1ZXN0UHJvZ3Jlc3MoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnF1ZXN0SWQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5ub3JtYWxQb2ludHMgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5ib251c1BvaW50cyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmlzRXZlbnRRdWVzdCA9IHJlYWRlci5ib29sKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCBfYiwgX2MsIF9kO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNDU1Vzck1zZ1F1ZXN0UHJvZ3Jlc3MoKTtcbiAgICAgICAgbWVzc2FnZS5xdWVzdElkID0gKF9hID0gb2JqZWN0LnF1ZXN0SWQpICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6IDA7XG4gICAgICAgIG1lc3NhZ2Uubm9ybWFsUG9pbnRzID0gKF9iID0gb2JqZWN0Lm5vcm1hbFBvaW50cykgIT09IG51bGwgJiYgX2IgIT09IHZvaWQgMCA/IF9iIDogMDtcbiAgICAgICAgbWVzc2FnZS5ib251c1BvaW50cyA9IChfYyA9IG9iamVjdC5ib251c1BvaW50cykgIT09IG51bGwgJiYgX2MgIT09IHZvaWQgMCA/IF9jIDogMDtcbiAgICAgICAgbWVzc2FnZS5pc0V2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xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZGF0YSA9IGNzdHJpa2UxNV9nY21lc3NhZ2VzXzEuU2NvcmVMZWFkZXJib2FyZERhdGEuZGVjb2RlKHJlYWRlciwgcmVhZGVyLnVpbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNDU1Vzck1zZ1Njb3JlTGVhZGVyYm9hcmREYXRhKCk7XG4gICAgICAgIG1lc3NhZ2UuZGF0YSA9XG4gICAgICAgICAgICBvYmplY3QuZGF0YSAhPT0gdW5kZWZpbmVkICYmIG9iamVjdC5kYXRhICE9PSBudWxsXG4gICAgICAgICAgICAgICAgPyBjc3RyaWtlMTVfZ2NtZXNzYWdlc18xLlNjb3JlTGVhZGVyYm9hcmREYXRhLmZyb21QYXJ0aWFsKG9iamVjdC5kYXRhKVxuICAgICAgICAgICAgICAgIDogdW5kZWZpbmVkO1xuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9XG59O1xuZnVuY3Rpb24gY3JlYXRlQmFzZUNDU1Vzck1zZ1BsYXllckRlY2FsRGlnaXRhbFNpZ25hdHVyZSgpIHtcbiAgICByZXR1cm4geyBkYXRhOiB1bmRlZmluZWQgfTtcbn1cbmV4cG9ydHMuQ0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B9XG4gICAgICAgIGlmIChtZXNzYWdlLmNvbnRyb2xsZXIgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTYpLmludDMyKG1lc3NhZ2UuY29udHJvbGxlcik7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDQ1NVc3JNc2dYUmFua0dldCgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubW9kZUlkeCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuY29udHJvbGxlciA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJld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S5yYW5raW5nKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNDU1Vzck1zZ1hSYW5rVXBkKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5tb2RlSWR4ID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5jb250cm9sbGVyID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5yYW5raW5nID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB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uICAgICAgICB9XG4gICAgICAgIHJldHVybiB3cml0ZXI7XG4gICAgfSxcbiAgICBkZWNvZGUoaW5wdXQsIGxlbmd0aCkge1xuICAgICAgICBjb25zdCByZWFkZXIgPSBpbnB1dCBpbnN0YW5jZW9mIG1pbmltYWxfMS5SZWFkZXIgPyBpbnB1dCA6IG5ldyBtaW5pbWFsXzEuUmVhZGVyKGlucHV0KTtcbiAgICAgICAgbGV0IGVuZCA9IGxlbmd0aCA9PT0gdW5kZWZpbmVkID8gcmVhZGVyLmxlbiA6IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ0NTVXNyTXNnQ2FsbFZvdGVGYWlsZWQoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnJlYXNvbiA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudGltZSA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2I7XG4gICAgICAgIGNvbnN0IG1lc3N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OiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNDU1Vzck1zZ1ZvdGVTdGFydCgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudGVhbSA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZW50SWR4ID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS52b3RlVHlwZSA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZGlzcFN0ciA9IHJlYWRlci5zdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA1OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmRldGFpbHNTdHIgPSByZWFkZXIuc3RyaW5nKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5vdGhlclRlYW1TdHIgPSByZWFkZXIuc3RyaW5nKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5pc1llc05vVm90ZSA9IHJlYWRlci5ib29sKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgODpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5lbnRpZHhUYXJnZXQgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iLCBfYywgX2QsIF9lLCBfZiwgX2csIF9oO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNDU1Vzck1zZ1ZvdGVTdGFydCgpO1xuICAgICAgICBtZXNzYWdlLnRlYW0gPSAoX2EgPSBvYmplY3QudGVhbSkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogMDtcbiAgICAgICAgbWVzc2FnZS5lbnRJZHggPSAoX2IgPSBvYmplY3QuZW50SWR4KSAhPT0gbnVsbCAmJiBfYiAhPT0gdm9pZCAwID8gX2IgOiAwO1xuICAgICAgICBtZXNzYWdlLnZvdGVUeXBlID0gKF9jID0gb2JqZWN0LnZvdGVUeXBlKSAhPT0gbnVsbCAmJiBfYyAhPT0gdm9pZCAwID8gX2MgOiAwO1xuICAgICAgICBtZXNzYWdlLmRpc3BTdHIgPSAoX2QgPSBvYmplY3QuZGlzcFN0cikgIT09IG51bGwgJiYgX2QgIT09IHZvaWQgMCA/IF9kIDogXCJcIjtcbiAgICAgICAgbWVzc2FnZS5kZXRhaWxzU3RyID0gKF9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09IFwiXCIpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMjYpLnN0cmluZyhtZXNzYWdlLmRpc3BTdHIpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmRldGFpbHNTdHIgIT09IFwiXCIpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMzQpLnN0cmluZyhtZXNzYWdlLmRldGFpbHNTdHIpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiB3cml0ZXI7XG4gICAgfSxcbiAgICBkZWNvZGUoaW5wdXQsIGxlbmd0aCkge1xuICAgICAgICBjb25zdCByZWFkZXIgPSBpbnB1dCBpbnN0YW5jZW9mIG1pbmltYWxfMS5SZWFkZXIgPyBpbnB1dCA6IG5ldyBtaW5pbWFsXzEuUmVhZGVyKGlucHV0KTtcbiAgICAgICAgbGV0IGVuZCA9IGxlbmd0aCA9PT0gdW5kZWZpbmVkID8gcmVhZGVyLmxlbiA6IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ0NTVXNyTXNnVm90ZVBhc3MoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnRlYW0gPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnZvdGVUeXBlID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAg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AgICAgIHdyaXRlci51aW50MzIoMTApLnN0cmluZyh2KTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNDU1Vzck1zZ1ZvdGVTZXR1cCgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucG90ZW50aWFsSXNzdWVzLnB1c2gocmVhZGVyLnN0cmluZygpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2E7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ0NTVXNyTXNnVm90ZVNldHVwKCk7XG4gICAgICAgIG1lc3NhZ2UucG90Z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WdlVGFrZW4pO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiB3cml0ZXI7XG4gICAgfSxcbiAgICBkZWNvZGUoaW5wdXQsIGxlbmd0aCkge1xuICAgICAgICBjb25zdCByZWFkZXIgPSBpbnB1dCBpbnN0YW5jZW9mIG1pbmltYWxfMS5SZWFkZXIgPyBpbnB1dCA6IG5ldyBtaW5pbWFsXzEuUmVhZGVyKGlucHV0KTtcbiAgICAgICAgbGV0IGVuZCA9IGxlbmd0aCA9PT0gdW5kZWZpbmVkID8gcmVhZGVyLmxlbiA6IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ0NTVXNyTXNnU2VuZExhc3RLaWxsZXJEYW1hZ2VUb0NsaWVudCgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubnVtSGl0c0dpdmVuID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5kYW1hZ2VHaXZlbiA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubnVtSGl0c1Rha2VuID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5kYW1hZ2VUYWtlbiA9IHJ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SgpKSB7XG4gICAgICAgIGlmIChtZXNzYWdlLmFjY291bnRJZCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig4KS5pbnQzMihtZXNzYWdlLmFjY291bnRJZCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UucmFua09sZCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigxNikuaW50MzIobWVzc2FnZS5yYW5rT2xkKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5yYW5rTmV3ICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDI0KS5pbnQzMihtZXNzYWdlLnJhbmtOZXcpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLm51bVdpbnMgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMzIpLmludDMyKG1lc3NhZ2UubnVtV2lucyk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UucmFua0NoYW5nZSAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig0NSkuZmxvYXQobWVzc2FnZS5yYW5rQ2hhbmdlKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5yYW5rVHlwZUlkICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDQ4KS5pbnQzMihtZXNzYWdlLnJhbmtUeXBlSWQpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiB3cml0ZXI7XG4gICAgfSxcbiAgICBkZWNvZGUoaW5wdXQsIGxlbmd0aCkge1xuICAgICAgICBjb25zdCByZWFkZXIgPSBpbnB1dCBpbnN0YW5jZW9mIG1pbmltYWxfMS5SZWFkZXIgPyBpbnB1dCA6IG5ldyBtaW5pbWFsXzEuUmVhZGVyKGlucHV0KTtcbiAgICAgICAgbGV0IGVuZCA9IGxlbmd0aCA9PT0gdW5kZWZpbmVkID8gcmVhZGVyLmxlbiA6IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ0NTVXNyTXNnU2VydmVyUmFua1VwZGF0ZV9SYW5rVXBkYXRlKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5hY2NvdW50SWQgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnJhbmtPbGQgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnJhbmtOZXcgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm51bVdpbnMgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA1OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnJhbmtDaGFuZ2UgPSByZWFkZXIuZmxvYXQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA2OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnJhbmtUeXBlSWQgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlY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ICBpZiAobWVzc2FnZS5pdGVtICE9PSBcIlwiKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDEwKS5zdHJpbmcobWVzc2FnZS5pdGVtKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNDU1Vzck1zZ0l0ZW1QaWNrdXAoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLml0ZW0gPSByZWFkZXIuc3RyaW5nKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNDU1V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lJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNDU1Vzck1zZ1Nob3dNZW51KCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5iaXRzVmFsaWRTbG90cyA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZGlzcGxheVRpbWUgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm1lbnVTdHJpbmcgPSByZWFkZXIuc3RyaW5nKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCBfYiwgX2M7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ0NTVXNyTXNnU2hvd01lbn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DApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoOCkuaW50MzIobWVzc2FnZS5hbW1vSWR4KTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNDU1Vzck1zZ0FtbW9EZW5pZWQoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmFtbW9JZHggPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2E7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ0NTVXNyTXNnQW1tb0RlbmllZCgpO1xuICAgICAgIC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gICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5pdGVtaWQgPSByZWFkZXIuaW50NjQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmRlYXRoID0gcmVhZGVyLmJvb2woKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2E7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ0NTVXNyTXNnSXRlbURyb3AoKTtcbiAgICAgICAgbWVzc2FnZS5pdGVtaWQgPVxuICAgICAgICAgICAgb2JqZWN0Lml0ZW1pZCAhPT0gdW5kZWZpbmVkICYmIG9iamVjdC5pdGVtaWQgIT09IG51bGxcbiAgICAgICAgICAgICAgICA/IExvbmcuZnJvbVZhbHVlKG9iamVjdC5pdGVtaWQpXG4gICAgICAgICAgICAgICAgOiBMb25nLlpFUk87XG4gICAgICAgIG1lc3NhZ2UuZGVhdGggPSAoX2EgPSBvYmplY3QuZGVhdGgpICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6IGZhbHNlO1xuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9XG59O1xuZnVuY3Rpb24gY3JlYXRlQmFzZUNDU1Vzck1zZ0dsb3dQcm9wVHVybk9mZigpIHtcbiAgICByZXR1cm4geyBlbnRpZHg6IDAgfTtcbn1cbmV4cG9ydHMuQ0NTVXNyTXNnR2xvd1Byb3BUdXJuT2ZmID0ge1xuICAgIGVuY29kZShtZXNzYWdlLCB3cml0ZXIgPSBtaW5pbWFsXzEuV3JpdGVyLmNyZWF0ZSgpKSB7XG4gICAgICAgIGlmIChtZXNzYWdlLmVudGlkeCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig4KS5pbnQzMihtZXNzYWdlLmVudGlkeCk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDQ1NVc3JNc2dHbG93UHJvcFR1cm5PZmYoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmVudGlkeCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICA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DM0KS5zdHJpbmcobWVzc2FnZS5uaWNlbmFtZSk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDQ1NVc3JNc2dSb3VuZEJhY2t1cEZpbGVuYW1lcygpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuY291bnQgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmluZGV4ID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5maWxlbmFtZSA9IHJlYWRlci5zdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm5pY2VuYW1lID0gcmVhZGVyLnN0cmluZygpO1x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3cml0ZXIgPSBtaW5pbWFsXzEuV3JpdGVyLmNyZWF0ZSgpKSB7XG4gICAgICAgIGlmIChtZXNzYWdlLnNob3cgPT09IHRydWUpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoOCkuYm9vbChtZXNzYWdlLnNob3cpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnN0YXJ0VGltZSAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigyMSkuZmxvYXQobWVzc2FnZS5zdGFydFRpbWUpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmVuZFRpbWUgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMjkpLmZsb2F0KG1lc3NhZ2UuZW5kVGltZSk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDQ1NVc3JNc2dTU1VJKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zaG93ID0gcmVhZGVyLmJvb2woKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnN0YXJ0VGltZSA9IHJlYWRlci5mbG9hdCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZW5kVGltZSA9IHJlYWRlci5mbG9hdCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2IsIF9jO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNDU1Vzck1zZ1NTVUkoKTtcbiAgICAgICAgbWVzc2FnZS5zaG93ID0gKF9hID0gb2JqZWN0LnNob3cpICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6IGZhbHNlO1xuICAgICAgICBtZXNzYWdlLnN0YXJ0VGltZSA9IChfYiA9IG9iamVjdC5zdGFydFRpbWUpICE9PSBudWxsICYmIF9iICE9PSB2b2lkIDAgPyBfYiA6IDA7XG4gICAgICAgIG1lc3NhZ2UuZW5kVGltZSA9IChfYyA9IG9iamVjdC5lbmRUaW1lKSAhPT0gbnVsbCAmJiBfYyAhPT0gdm9pZCAwID8gX2MgOiAwO1xuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9XG59O1xuZnVuY3Rpb24gY3JlYXRlQmFzZUNDU1Vzck1zZ1N1cnZpdmFsU3RhdHMoKSB7XG4gICAgcmV0dXJuIHsgeHVpZDogTG9uZy5VWkVS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4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNDU1Vzck1zZ1N1cnZpdmFsU3RhdHMoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnh1aWQgPSByZWFkZXIudWludDY0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5mYWN0cy5wdXNoKGV4cG9ydHMuQ0NTVXNyTXNnU3Vydml2YWxTdGF0c19GYWN0LmRlY29kZShyZWFkZXIsIHJlYWRlci51aW50MzIoKSkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudXNlcnMucHVzaChleHBvcnRzLkNDU1Vzck1zZ1N1cnZpdmFsU3RhdHNfUGxhY2VtZW50LmRlY29kZShyZWFkZXIsIHJlYWRlci51aW50MzIoKSkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZGFtYWdlcy5wdXNoKGV4cG9ydHMuQ0NTVXNyTXNnU3Vydml2YWxTdGF0c19EYW1hZ2UuZGVjb2RlKHJlYWRlciwgcmVhZGVyLnVpbnQzMigpKSk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50aWNrbnVtYmVyID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCBfYiwgX2MsIF9kO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNDU1Vzck1zZ1N1cnZpdmFsU3RhdHMoKTtcbiAgICAgICAgbWVzc2FnZS54dWlkID1cbiAgICAgICAgICAgIG9iamVjdC54dWlkICE9PSB1bmRlZmluZWQgJiYgb2JqZWN0Lnh1aWQgIT09IG51bGxcbiAgICAgICAgICAgICAgICA/IExvbmcuZnJvbVZhbHVlKG9iamVjdC54dWlkKVxuICAgICAgICAgICAgICAgIDogTG9uZy5VWkVSTztcbiAgICAgICAgbWVzc2FnZS5mYWN0cyA9XG4gICAgICAgICAgICAoKF9hID0gb2JqZWN0LmZhY3RzKSA9PT0gbnVsbCB8fCBfYSA9PT0gdm9pZCAwID8gdm9pZCAwIDogX2EubWFwKGUgPT4gZXhwb3J0cy5DQ1NVc3JNc2dTdXJ2aXZhbFN0YXRzX0ZhY3QuZnJvbVBhcnR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S50eXBlKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5kaXNwbGF5ICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDE2KS5pbnQzMihtZXNzYWdlLmRpc3BsYXkpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnZhbHVlICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDI0KS5pbnQzMihtZXNzYWdlLnZhbHVlKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5pbnRlcmVzdGluZ25lc3MgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMzcpLmZsb2F0KG1lc3NhZ2UuaW50ZXJlc3RpbmduZXNzKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNDU1Vzck1zZ1N1cnZpdmFsU3RhdHNfRmFjdCgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudHlwZSA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZGlzcGxheSA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudmFsdWUgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmludGVyZXN0aW5nbmVzcyA9IHJlYWRlci5mbG9hdCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2IsIF9jLCBfZDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDQ1NVc3JNc2dTdXJ2aXZhbFN0YXRzX0ZhY3QoKTtcbiAgICAgICAgbWVzc2FnZS50eXBlID0gKF9hID0gb2JqZWN0LnR5cGUpICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6IDA7XG4gICAgICAgIG1lc3NhZ2UuZGlzcGxheSA9IChfYiA9IG9iamVjdC5kaXNwbGF5KSAhPT0gbnVsbCAmJiBfYiAhPT0gdm9pZCAwID8gX2IgOiAwO1xuICAgICAgICBtZXNzYWdlLnZhbHVlID0gKF9jID0gb2JqZWN0LnZhbHVlKSAhPT0gbnVsbCAmJiBfYyAhPT0gdm9pZCAwID8gX2M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XIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDQ1NVc3JNc2dTdXJ2aXZhbFN0YXRzX1BsYWNlbWVudCgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UueHVpZCA9IHJlYWRlci51aW50NjQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnRlYW1udW1iZXIgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnBsYWNlbWVudCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2I7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ0NTVXNyTXNnU3Vydml2YWxTdGF0c19QbGFjZW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udG9IaXRzICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDI0KS5pbnQzMihtZXNzYWdlLnRvSGl0cyk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuZnJvbSAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigzMikuaW50MzIobWVzc2FnZS5mcm9tKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5mcm9tSGl0cyAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig0MCkuaW50MzIobWVzc2FnZS5mcm9tSGl0cyk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDQ1NVc3JNc2dTdXJ2aXZhbFN0YXRzX0RhbWFnZSgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UueHVpZCA9IHJlYWRlci51aW50NjQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnRvID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50b0hpdHMgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmZyb20gPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA1OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmZyb21IaXRzID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCBfYiwgX2MsIF9kO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNDU1Vzck1zZ1N1cnZpdmFsU3RhdHNfRGFtYWdlKCk7XG4gICAgICAgIG1lc3NhZ2UueHVpZCA9XG4gICAgICAgICAgICBvYmplY3QueHVpZCAhPT0gdW5kZWZpbmVkICYmIG9iamVjdC54dWlkICE9PSBudWxsXG4gICAgICAgICAgICAgICAgPyBMb25nLmZyb21WYWx1ZShvYmplY3QueHVpZClcbiAgICAgICAgICAgICAgICA6IExvbmcuVVpFUk87XG4gICAgICAgIG1lc3NhZ2UudG8gPSAoX2EgPSBvYmplY3QudG8pICE9PSBudWxsICYm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gICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDQ1NVc3JNc2dFbmRPZk1hdGNoQWxsUGxheWVyc0RhdGEoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmFsbHBsYXllcmRhdGEucHVzaChleHBvcnRzLkNDU1Vzck1zZ0VuZE9mTWF0Y2hBbGxQbGF5ZXJzRGF0YV9QbGF5ZXJEYXRhLmRlY29kZShyZWFkZXIsIHJlYWRlci51aW50MzIoKSkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc2NlbmUgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb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1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigyMSkuZmxvYXQobWVzc2FnZS52YWx1ZSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UucG9zaXRpb24gIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMjQpLmludDMyKG1lc3NhZ2UucG9zaXRpb24pO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiB3cml0ZXI7XG4gICAgfSxcbiAgICBkZWNvZGUoaW5wdXQsIGxlbmd0aCkge1xuICAgICAgICBjb25zdCByZWFkZXIgPSBpbnB1dCBpbnN0YW5jZW9mIG1pbmltYWxfMS5SZWFkZXIgPyBpbnB1dCA6IG5ldyBtaW5pbWFsXzEuUmVhZGVyKGlucHV0KTtcbiAgICAgICAgbGV0IGVuZCA9IGxlbmd0aCA9PT0gdW5kZWZpbmVkID8gcmVhZGVyLmxlbiA6IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ0NTVXNyTXNnRW5kT2ZNYXRjaEFsbFBsYXllcnNEYXRhX0FjY29sYWRlKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5lYWNjb2xhZGUgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnZhbHVlID0gcmVhZGVyLmZsb2F0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICA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gICAgICBtZXNzYWdlLmVudGluZGV4ID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS54dWlkID0gcmVhZGVyLnVpbnQ2NCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubmFtZSA9IHJlYWRlci5zdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnRlYW1udW1iZXIgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA1OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm5vbWluYXRpb24gPVxuICAgICAgICAgICAgICAgICAgICAgICAgZXhwb3J0cy5DQ1NVc3JNc2dFbmRPZk1hdGNoQWxsUGxheWVyc0RhdGFfQWNjb2xhZGUuZGVjb2RlKHJlYWRlciwgcmVhZGVyLnVpbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA2OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLml0ZW1zLnB1c2goY3N0cmlrZTE1X2djbWVzc2FnZXNfMS5DRWNvbkl0ZW1QcmV2aWV3RGF0YUJsb2NrLmRlY29kZShyZWFkZXIsIHJlYWRlci51aW50MzIoKSkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDc6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucGxheWVyY29sb3IgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA4OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmlzYm90ID0gcmVhZGVyLmJvb2woKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iLCBfYywgX2QsIF9lLCBfZjtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDQ1NVc3JNc2dFbmRPZk1hdGNoQWxsUGxheWVyc0RhdGFfUGxheWVyRGF0YSgpO1xuICAgICAgICBtZXNzYWdlLmVudGluZGV4ID0gKF9hID0gb2JqZWN0LmVudGluZGV4KSAhPT0gbnVsbCAmJiBfYSAhPT0gdm9pZCAwID8gX2EgOiAwO1xuICAgICAgICBtZXNzYWdlLnh1aWQgPVxuICAgICAgICAgICAgb2JqZWN0Lnh1aWQgIT09IHVuZGVmaW5lZCAmJiBvYmplY3QueHVpZCAhPT0gbnVsbFxuICAgICAgICAgICAgICAgID8gTG9uZy5mcm9tVmFsdWUob2JqZWN0Lnh1aWQpXG4gICAgICAgICAgICAgICAgOiBMb25nLlVaRVJPO1xuICAgICAgICBtZXNzYWdlLm5hbWUgPSAoX2IgPSBvYmplY3QubmFtZSkgIT09IG51bGwgJiYgX2IgIT09IHZvaWQgMCA/IF9iIDogXCJcIjtcbiAgICAgICAgbWVzc2FnZS50ZWFtbnVtYmVyID0gKF9jID0gb2JqZWN0LnRlYW1udW1iZXIpICE9PSBudWxsICYmIF9jICE9PSB2b2lkIDAgPyBfYyA6IDA7XG4gICAgICAgIG1l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4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuaW5pdENvbmRpdGlvbnMgPVxuICAgICAgICAgICAgICAgICAgICAgICAgZXhwb3J0cy5DQ1NVc3JNc2dSb3VuZEltcGFjdFNjb3JlRGF0YV9Jbml0aWFsQ29uZGl0aW9ucy5kZWNvZGUocmVhZGVyLCByZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuYWxsUmlzRXZlbnREYXRhLnB1c2goZXhwb3J0cy5DQ1NVc3JNc2dSb3VuZEltcGFjdFNjb3JlRGF0YV9SaXNFdmVudC5kZWNvZGUocmVhZGVyLCByZWFkZXIudWludDMyKCkpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2E7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ0NTVXNyTXNnUm91bmRJbXBhY3RTY29yZURhdGEoKTtcbiAgICAgICAgbWVzc2FnZS5pbml0Q29uZGl0aW9ucyA9XG4gICAgICAgICAgICBvYmplY3QuaW5pdENvbmRpdGlvbnMgIT09IHVuZGVmaW5lZCAmJiBvYmplY3QuaW5pdENvbmRpdGlvbnMgIT09IG51bGxcbiAgICAgICAgICAgICAgICA/IGV4cG9ydHMuQ0NTVXNyTXNnUm91bmRJbXBhY3RTY29yZURhdGFfSW5pdGlhbENvbmRpdGlvbnMuZnJvbVBhcnRpYWwob2JqZWN0L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gICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDQ1NVc3JNc2dSb3VuZEltcGFjdFNjb3JlRGF0YV9SaXNFdmVudCgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudGltZXN0YW1wID0gcmVhZGVyLmZsb2F0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50ZXJyb3Jpc3RPZGRzID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5jdEFsaXZlID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50QWxpdmUgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA1OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnZpY3RpbURhdGEgPVxuICAgICAgICAgICAgICAgICAgICAgICAgZXhwb3J0cy5DQ1NVc3JNc2dSb3VuZEltcGFjdFNjb3JlRGF0YV9SaXNFdmVudF9WaWN0aW0uZGVjb2RlKHJlYWRlciwgcmVhZGVyLnVpbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA2OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm9iamVjdGl2ZURhdGEgPVxuICAgICAgICAgICAgICAgICAgICAgICAgZXhwb3J0cy5DQ1NVc3JNc2dSb3VuZEltcGFjdFNjb3JlRGF0YV9SaXNFdmVudF9PYmplY3RpdmUuZGVjb2RlKHJlYWRlciwgcmVhZGVyLnVpbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA3OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmFsbERhbWFnZURhdGEucHVzaChleHBvcnRzLkNDU1Vzck1zZ1JvdW5kSW1wYWN0U2NvcmVEYXRhX1Jpc0V2ZW50X0RhbWFnZS5kZWNvZGUocmVhZGVyLCByZWFkZXIudWludDMyKCkpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iLCBfYywgX2QsIF9lO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNDU1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zIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnRlYW1OdW1iZXIgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmVudGluZGV4ID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS54dWlkID0gcmVhZGVyLnVpbnQ2NCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuY29sb3IgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA1OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmlzQm90ID0gcmVhZGVyLmJvb2woKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA2OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmlzRGVhZCA9IHJlYWRlci5ib29sKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCB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G59XG5leHBvcnRzLkNDU1Vzck1zZ1JvdW5kSW1wYWN0U2NvcmVEYXRhX1Jpc0V2ZW50X09iamVjdGl2ZSA9IHtcbiAgICBlbmNvZGUobWVzc2FnZSwgd3JpdGVyID0gbWluaW1hbF8xLldyaXRlci5jcmVhdGUoKSkge1xuICAgICAgICBpZiAobWVzc2FnZS50eXBlICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDgpLmludDMyKG1lc3NhZ2UudHlwZSk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDQ1NVc3JNc2dSb3VuZEltcGFjdFNjb3JlRGF0YV9SaXNFdmVudF9PYmplY3RpdmUoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnR5cGUgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgIC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1zZ1JvdW5kSW1wYWN0U2NvcmVEYXRhX1Jpc0V2ZW50X0RhbWFnZSgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudGFyZ2V0RW50aW5kZXggPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnRhcmdldFh1aWQgPSByZWFkZXIudWludDY0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5oZWFsdGhSZW1vdmVkID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5udW1IaXRzID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5yZXR1cm5IZWFsdGhSZW1vdmVkID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5udW1SZXR1cm5IaXRzID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICA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0YW5jZW9mIG1pbmltYWxfMS5SZWFkZXIgPyBpbnB1dCA6IG5ldyBtaW5pbWFsXzEuUmVhZGVyKGlucHV0KTtcbiAgICAgICAgbGV0IGVuZCA9IGxlbmd0aCA9PT0gdW5kZWZpbmVkID8gcmVhZGVyLmxlbiA6IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ0NTVXNyTXNnUm91bmRJbXBhY3RTY29yZURhdGFfSW5pdGlhbENvbmRpdGlvbnMoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmN0RXF1aXBWYWx1ZSA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudEVxdWlwVmFsdWUgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnRlcnJvcmlzdE9kZHMgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9i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jb2RlKHJlYWRlciwgcmVhZGVyLnVpbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNDU1Vzck1zZ0RlZXBTdGF0cygpO1xuICAgICAgICBtZXNzYWdlLnN0YXRzID1cbiAgICAgICAgICAgIG9iamVjdC5zdGF0cyAhPT0gdW5kZWZpbmVkICYmIG9iamVjdC5zdGF0cyAhPT0gbnVsbFxuICAgICAgICAgICAgICAgID8gY3N0cmlrZTE1X2djbWVzc2FnZXNfMS5DTXNnR0NDU3RyaWtlMTVDbGllbnREZWVwU3RhdHMuZnJvbVBhcnRpYWwob2JqZWN0LnN0YXRzKVxuICAgICAgICAgICAgICAgIDogdW5kZWZpbmVkO1xuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9XG59O1xuZnVuY3Rpb24gY3JlYXRlQmFzZUNDU1Vzck1zZ1Jlc2V0SHVkKCkge1xuICAgIHJldHVybiB7IHJlc2V0OiBmYWxzZSB9O1xufVxuZXhwb3J0cy5DQ1NVc3JNc2dSZXNldEh1ZCA9IHtcbiAgICBlbmNvZGUobWVzc2FnZSwgd3JpdGVyID0gbWluaW1hbF8xLldyaXRlci5jcmVhdGUoKSkge1xuICAgICAgICBpZiAobWVzc2FnZS5yZXNldCA9PT0gdHJ1ZSkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig4KS5ib29sKG1lc3NhZ2UucmVzZXQpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiB3cml0ZXI7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HVybiBtZXNzYWdlO1xuICAgIH1cbn07XG5mdW5jdGlvbiBjcmVhdGVCYXNlQ0NTVXNyTXNnR2FtZVRpdGxlKCkge1xuICAgIHJldHVybiB7IGR1bW15OiAwIH07XG59XG5leHBvcnRzLkNDU1Vzck1zZ0dhbWVUaXRsZSA9IHtcbiAgICBlbmNvZGUobWVzc2FnZSwgd3JpdGVyID0gbWluaW1hbF8xLldyaXRlci5jcmVhdGUoKSkge1xuICAgICAgICBpZiAobWVzc2FnZS5kdW1teSAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig4KS5pbnQzMihtZXNzYWdlLmR1bW15KTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNDU1Vzck1zZ0dhbWVUaXRsZSgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZHVtbXkgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVh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biAgICAgICAgaWYgKG1lc3NhZ2UuZHVtbXkgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoOCkuaW50MzIobWVzc2FnZS5kdW1teSk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDQ1NVc3JNc2dTdG9wU3BlY3RhdG9yTW9kZSgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZHVtbXkgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2E7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCY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hZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5kdW1teSA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYTtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDQ1NVc3JNc2dEaXNjb25uZWN0VG9Mb2JieSgpO1xuICAgICAgICBtZXNzYWdlLmR1bW15ID0gKF9hID0gb2JqZWN0LmR1bW15KSAhPT0gbnVsbCAmJiBfYSAhPT0gdm9pZCAwID8gX2EgOiAwO1xuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9XG59O1xuZnVuY3Rpb24gY3JlYXRlQmFzZUNDU1Vzck1zZ1dhcm11cEhhc0VuZGVkKCkge1xuICAgIHJldHVybiB7IGR1bW15OiAwIH07XG59XG5leHBvcnRzLkNDU1Vzck1zZ1dhcm11cEhhc0VuZGVkID0ge1xuICAgIGVuY29kZShtZXNzYWdlLCB3cml0ZXIgPSBtaW5pbWFsXzEuV3JpdGVyLmNyZWF0ZSgpKSB7XG4gICAgICAgIGlmIChtZXNzYWdlLmR1bW15ICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDgpLmludDMyKG1lc3NhZ2UuZHVtbXkpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiB3cml0ZXI7XG4gICAgfSxcbiAgICBkZWNvZGUoaW5wdXQsIGxlbmd0aCkge1xuICAgICAgICBjb25zdCByZW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4KS5mb3JrKCkpLmxkZWxpbSgpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiB3cml0ZXI7XG4gICAgfSxcbiAgICBkZWNvZGUoaW5wdXQsIGxlbmd0aCkge1xuICAgICAgICBjb25zdCByZWFkZXIgPSBpbnB1dCBpbnN0YW5jZW9mIG1pbmltYWxfMS5SZWFkZXIgPyBpbnB1dCA6IG5ldyBtaW5pbWFsXzEuUmVhZGVyKGlucHV0KTtcbiAgICAgICAgbGV0IGVuZCA9IGxlbmd0aCA9PT0gdW5kZWZpbmVkID8gcmVhZGVyLmxlbiA6IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ0NTVXNyTXNnU2VydmVyUmFua1JldmVhbEFsbCgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc2Vjb25kc1RpbGxTaHV0ZG93biA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucmVzZXJ2YXRpb24gPVxuICAgICAgICAgICAgICAgICAgICAgICAgY3N0cmlrZTE1X2djbWVzc2FnZXNfMS5DTXNnR0NDU3RyaWtlMTVWMk1hdGNobWFraW5nR0MyU2VydmVyUmVzZXJ2ZS5kZWNvZGUocmVhZGVyLCByZWFkZXIudWludDMyKCkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodG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kge1xuICAgICAgICBpZiAobWVzc2FnZS51dGlsQWN0aW9uICE9PSBcIlwiKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDEwKS5zdHJpbmcobWVzc2FnZS51dGlsQWN0aW9uKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS51dGlsMSAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigxNikuaW50MzIobWVzc2FnZS51dGlsMSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UudXRpbDIgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMjQpLmludDMyKG1lc3NhZ2UudXRpbDIpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnV0aWwzICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDMyKS5pbnQzMihtZXNzYWdlLnV0aWwzKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS51dGlsNCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig0MCkuaW50MzIobWVzc2FnZS51dGlsNCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UudXRpbDUgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNDgpLmludDMyKG1lc3NhZ2UudXRpbDUpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiB3cml0ZXI7XG4gICAgfSxcbiAgICBkZWNvZGUoaW5wdXQsIGxlbmd0aCkge1xuICAgICAgICBjb25zdCByZWFkZXIgPSBpbnB1dCBpbnN0YW5jZW9mIG1pbmltYWxfMS5SZWFkZXIgPyBpbnB1dCA6IG5ldyBtaW5pbWFsXzEuUmVhZGVyKGlucHV0KTtcbiAgICAgICAgbGV0IGVuZCA9IGxlbmd0aCA9PT0gdW5kZWZpbmVkID8gcmVhZGVyLmxlbiA6IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ0NTVXNyTXNnVXRpbE1zZygpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudXRpbEFjdGlvbiA9IHJlYWRlci5zdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnV0aWwxID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS51dGlsMiA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudXRpbDMgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA1OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnV0aWw0ID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS51dGlsNSA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAg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bmdpbmVHb3R2U3luY1BhY2tldCA9IHtcbiAgICBlbmNvZGUobWVzc2FnZSwgd3JpdGVyID0gbWluaW1hbF8xLldyaXRlci5jcmVhdGUoKSkge1xuICAgICAgICBpZiAoIW1lc3NhZ2UubWF0Y2hJZC5pc1plcm8oKSkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig4KS51aW50NjQobWVzc2FnZS5tYXRjaElkKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5pbnN0YW5jZUlkICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDE2KS51aW50MzIobWVzc2FnZS5pbnN0YW5jZUlkKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5zaWdudXBmcmFnbWVudCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigyNCkudWludDMyKG1lc3NhZ2Uuc2lnbnVwZnJhZ21lbnQpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmN1cnJlbnRmcmFnbWVudCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigzMikudWludDMyKG1lc3NhZ2UuY3VycmVudGZyYWdtZW50KTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS50aWNrcmF0ZSAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig0NSkuZmxvYXQobWVzc2FnZS50aWNrcmF0ZSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UudGljayAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig0OCkudWludDMyKG1lc3NhZ2UudGljayk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UucnRkZWxheSAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig2OSkuZmxvYXQobWVzc2FnZS5ydGRlbGF5KTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5yY3ZhZ2UgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNzcpLmZsb2F0KG1lc3NhZ2UucmN2YWdlKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5rZXlmcmFtZUludGVydmFsICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDg1KS5mbG9hdChtZXNzYWdlLmtleWZyYW1lSW50ZXJ2YWwpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmNkbmRlbGF5ICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDg4KS51aW50MzIobWVzc2FnZS5jZG5kZWxheSk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDRW5naW5lR290dlN5bmNQYWNrZXQoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm1hdGNoSWQgPSByZWFkZXIudWludDY0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5pbnN0YW5jZUlkID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc2lnbnVwZnJhZ21lbnQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5jdXJyZW50ZnJhZ21lbnQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50aWNrcmF0ZSA9IHJlYWRlci5mbG9hdCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDY6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudGljayA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA4OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnJ0ZGVsYXkgPSByZWFkZXIuZmxvYXQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA5OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnJjdmFnZSA9IHJlYWRlci5mbG9hdCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDEwOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmtleWZyYW1lSW50ZXJ2YWwgPSByZWFkZXIuZmxvYXQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5jZG5kZWxheSA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iLCBfYywgX2QsIF9lLCBfZiwgX2csIF9oLCBfajtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDRW5naW5lR290dlN5bmNQYWNrZXQoKTtcbiAgICAgICAgbWVzc2FnZS5tYXRjaElkID1cbiAgICAgICAgICAgIG9iamVjdC5tYXRjaElkICE9PSB1bmRlZmluZWQgJiYgb2JqZWN0Lm1hdGNoSWQgIT09IG51bGxcbiAgICAgICAgICAgICAgICA/IExvbmcuZnJvbVZhbHVlKG9iamVjdC5tYXRjaElkKVxuICAgICAgICAgICAgICAgIDogTG9uZy5VWkVSTztcbiAgICAgICAgbWVzc2FnZS5pbnN0YW5jZUlkID0gKF9hID0gb2JqZWN0Lmluc3RhbmNlSWQpICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6IDA7XG4gICAgICAgIG1lc3NhZ2Uuc2lnbnVwZnJhZ21lbnQgPSAoX2IgPSBvYmplY3Quc2lnbnVwZnJhZ21lbnQpICE9PSBudWxsICYmIF9iICE9PSB2b2lkIDAgPyBfYiA6IDA7XG4gICAgICAgIG1lc3NhZ2UuY3VycmVudGZyYWdtZW50ID0gKF9jID0gb2JqZWN0LmN1cnJlbnRmcmFnbWVudCkgIT09IG51bGwgJiYgX2MgIT09IHZvaWQg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pIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnggPSByZWFkZXIuZmxvYXQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnkgPSByZWFkZXIuZmxvYXQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnogPSByZWFkZXIuZmxvYXQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iLCBfYztcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnVmVjdG9yKCk7XG4gICAgICAgIG1lc3NhZ2UueCA9IChfYSA9IG9iamVjdC54KSAhPT0gbnVsbCAmJiBfYSAhPT0gdm9pZCAwID8gX2EgOiAwO1xuICAgICAgICBtZXNzYWdlLnkgPSAoX2IgPSBvYmplY3QueSkgIT09IG51bGwgJiYgX2IgIT09IHZvaWQgMCA/IF9iIDogMDtcbiAgICAgICAgbWVzc2FnZS56ID0gKF9jID0gb2JqZWN0LnopICE9PSBudWxsICYmIF9jICE9PSB2b2lkIDAgPyBfYyA6IDA7XG4gIC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dCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UueSA9IHJlYWRlci5mbG9hdCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2I7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ01zZ1ZlY3RvcjJEKCk7XG4gICAgICAgIG1lc3NhZ2UueCA9IChfYSA9IG9iamVjdC54KSAhPT0gbnVsbCAmJiBfYSAhPT0gdm9pZCAwID8gX2EgOiAwO1xuICAgICAgICBtZXNzYWdlLnkgPSAoX2IgPSBvYmplY3QueSkgIT09IG51bGwgJiYgX2IgIT09IHZvaWQgMCA/IF9iIDogMDtcbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfVxufTtcbmZ1bmN0aW9uIGNyZWF0ZUJhc2VDTXNnUUFuZ2xlKCkge1xuICAgIHJldHVybiB7IHg6IDAsIHk6IDAsIHo6IDAgfTtcbn1cbmV4cG9ydHMuQ01zZ1FBbmdsZSA9IHtcbiAgICBlbmNvZGUobWVzc2FnZSwgd3JpdGVyID0gbWluaW1hbF8xLldyaXRlci5jcmVhdGUoKSkge1xuICAgICAgICBpZiAobWVzc2FnZS54ICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDEzKS5mbG9hdChtZXNzYWdlLngpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnkgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMjEpLmZsb2F0KG1lc3NhZ2UueSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UueiAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigyOSkuZmxvYXQobWVzc2FnZS56KTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNNc2dRQW5nbGUoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnggPSByZWFkZXIuZmxvYXQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnkgPSByZWFkZXIuZmxvYXQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnogPSByZWFkZXIuZmxvYXQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iLCBfYztcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnUUFuZ2xlKCk7XG4gICAgICAgIG1lc3NhZ2UueCA9IChfYSA9IG9iamVjdC54KSAhPT0gbnVsbCAmJiBfYSAhPT0gdm9pZCAwID8gX2EgOiAwO1xuICAgICAgICBtZXNzYWdlLnkgPSAoX2IgPSBvYmplY3QueSkgIT09IG51bGwgJiYgX2IgIT09IHZvaWQgMCA/IF9iIDogMDtcbiAgICAgICAgbWVzc2FnZS56ID0gKF9jID0gb2JqZWN0LnopICE9PSBudWxsICYmIF9jICE9PSB2b2lkIDAgPyBfYyA6IDA7XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH1cbn07XG5mdW5jdGlvbiBjcmVhdGVCYXNlQ01zZ1JHQkEoKSB7XG4gICAgcmV0dXJuIHsgcjogMCwgZzogMCwgYjogMCwgYTogMCB9O1xufVxuZXhwb3J0cy5DTXNnUkdCQSA9IHtcbiAgICBlbmNvZGUobWVzc2FnZSwgd3JpdGVyID0gbWluaW1hbF8xLldyaXRlci5jcmVhdGUoKSkge1xuICAgICAgICBpZiAobWVzc2FnZS5yICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDgpLmludDMyKG1lc3NhZ2Uucik7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuZyAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigxNikuaW50MzIobWVzc2FnZS5nKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5iICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDI0KS5pbnQzMihtZXNzYWdlLmIpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmEgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMzIpLmludDMyKG1lc3NhZ2UuYSk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnUkdCQSgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuciA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZyA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuYiA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuYSA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2IsIF9jLCBfZDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnUkdCQSgpO1xuICAgICAgICBtZXNzYWdlLnIgPSAoX2EgPSBvYmplY3QucikgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogMDtcbiAgICAgICAgbWVzc2FnZS5nID0gKF9iID0gb2JqZWN0LmcpICE9PSBudWxsICYmIF9iICE9PSB2b2lkIDAgPyBfYiA6IDA7XG4gICAgICAgIG1lc3NhZ2UuYiA9IChfYyA9IG9iamVjdC5iKSAhPT0gbnVsbCAmJiBfYyAhPT0gdm9pZCAwID8gX2MgOiAwO1xuICAgICAgICBtZXNzYWdlLmEgPSAoX2QgPSBvYmplY3QuYSkgIT09IG51bGwgJiYgX2QgIT09IHZvaWQgMCA/IF9kIDogMDtcbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfVxufTtcbmZ1bmN0aW9uIGNyZWF0ZUJhc2VDTkVUTXNnVGljaygpIHtcbiAgICByZXR1cm4ge1xuICAgICAgICB0aWNrOiAwLFxuICAgICAgICBob3N0Q29tcHV0YXRpb250aW1lOiAwLFxuICAgICAgICBob3N0Q29tcHV0YXRpb250aW1lU3RkRGV2aWF0aW9uOiAwLFxuICAgICAgICBob3N0RnJhbWVzdGFydHRpbWVTdGREZXZpYXRpb246IDAsXG4gICAgICAgIGhsdHZSZXBsYXlGbGFnczogMFxuICAgIH07XG59XG5leHBvcnRzLkNORVRNc2dUaWNrID0ge1xuICAgIGVuY29kZShtZXNzYWdlLCB3cml0ZXIgPSBtaW5pbWFsXzEuV3JpdGVyLmNyZWF0ZSgpKSB7XG4gICAgICAgIGlmIChtZXNzYWdlLnRpY2sgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoOCkudWludDMyKG1lc3NhZ2UudGljayk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuaG9zdENvbXB1dGF0aW9udGltZSAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigzMikudWludDMyKG1lc3NhZ2UuaG9zdENvbXB1dGF0aW9udGltZSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuaG9zdENvbXB1dGF0aW9udGltZVN0ZERldmlhdGlvbiAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig0MCkudWludDMyKG1lc3NhZ2UuaG9zdENvbXB1dGF0aW9udGltZVN0ZERldmlhdGlvbik7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuaG9zdEZyYW1lc3RhcnR0aW1lU3RkRGV2aWF0aW9uICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDQ4KS51aW50MzIobWVzc2FnZS5ob3N0RnJhbWVzdGFydHRpbWVTdGREZXZpYXRpb24pO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmhsdHZSZXBsYXlGbGFncyAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig1NikudWludDMyKG1lc3NhZ2UuaGx0dlJlcGxheUZsYWdzKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNORVRNc2dUaWNrKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50aWNrID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuaG9zdENvbXB1dGF0aW9udGltZSA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA1OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmhvc3RDb21wdXRhdGlvbnRpbWVTdGREZXZpYXRpb24gPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5ob3N0RnJhbWVzdGFydHRpbWVTdGREZXZpYXRpb24gPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5obHR2UmVwbGF5RmxhZ3MgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCBfYiwgX2MsIF9kLCBfZTtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTkVUTXNnVGljaygpO1xuICAgICAgICBtZXNzYWdlLnRpY2sgPSAoX2EgPSBvYmplY3QudGljaykgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogMDtcbiAgICAgICAgbWVzc2FnZS5ob3N0Q29tcHV0YXRpb250aW1lID0gKF9iID0gb2JqZWN0Lmhvc3RDb21wdXRhdGlvbnRpbWUpICE9PSBudWxsICYmIF9iICE9PSB2b2lkIDAgPyBfYiA6IDA7XG4gICAgICAgIG1lc3NhZ2UuaG9zdENvbXB1dGF0aW9udGltZVN0ZERldmlhdGlvbiA9XG4gICAgICAgICAgICAoX2MgPSBvYmplY3QuaG9zdENvbXB1dGF0aW9udGltZVN0ZERldmlhdGlvbikgIT09IG51bGwgJiYgX2MgIT09IHZvaWQgMCA/IF9jIDogMDtcbiAgICAgICAgbWVzc2FnZS5ob3N0RnJhbWVzdGFydHRpbWVTdGREZXZpYXRpb24gPVxuICAgICAgICAgICAgKF9kID0gb2JqZWN0Lmhvc3RGcmFtZXN0YXJ0dGltZVN0ZERldmlhdGlvbikgIT09IG51bGwgJiYgX2QgIT09IHZvaWQgMCA/IF9kIDogMD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AgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuY29tbWFuZCA9IHJlYWRlci5zdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2E7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ05FVE1zZ1N0cmluZ0NtZCgpO1xuICAgICAgICBtZXNzYWdlLmNvbW1hbmQgPSAoX2EgPSBvYmplY3QuY29tbWFuZCkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogXCJcIjtcbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfVxufTtcbmZ1bmN0aW9uIGNyZWF0ZUJhc2VDTkVUTXNnU2lnbm9uU3RhdGUoKSB7XG4gICAgcmV0dXJuIHtcbiAgICAgICAgc2lnbm9uU3RhdGU6IDAsXG4gICAgICAgIHNwYXduQ291bnQ6IDAsXG4gICAgICAgIG51bVNlcnZlclBsYXllcnM6IDAsXG4gICAgICAgIHBsYXllcnNOZXR3b3JraWRzOiBbXSxcbiAgICAgICAgbWFwTmFtZTogXCJcIlxuICAgIH07XG59XG5leHBvcnRzLkNORVRNc2dTaWdub25TdGF0ZSA9IHtcbiAgICBlbmNvZGUobWVzc2FnZSwgd3JpdGVyID0gbWluaW1hbF8xLldyaXRlci5jcmVhdGUoKSkge1xuICAgICAgICBpZiAobWVzc2FnZS5zaWdub25TdGF0ZSAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig4KS51aW50MzIobWVzc2FnZS5zaWdub25TdGF0ZSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2Uuc3Bhd25Db3VudCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigxNikudWludDMyKG1lc3NhZ2Uuc3Bhd25Db3VudCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UubnVtU2VydmVyUGxheWVycyAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigyNCkudWludDMyKG1lc3NhZ2UubnVtU2VydmVyUGxheWVycyk7XG4gICAgICAgIH1cbiAgICAgICAgZm9yIChjb25zdCB2IG9mIG1lc3NhZ2UucGxheWVyc05ldHdvcmtpZHMpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMzQpLnN0cmluZyh2KTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5tYXBOYW1lICE9PSBcIlwiKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDQyKS5zdHJpbmcobWVzc2FnZS5tYXBOYW1lKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNORVRNc2dTaWdub25TdGF0ZSgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc2lnbm9uU3RhdGUgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zcGF3bkNvdW50ID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubnVtU2VydmVyUGxheWVycyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnBsYXllcnNOZXR3b3JraWRzLnB1c2gocmVhZGVyLnN0cmluZygpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA1OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm1hcE5hbWUgPSByZWFkZXIuc3RyaW5nKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCBfYiwgX2MsIF9kLCBfZTtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTkV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xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTXNnQ1ZhcnNfQ1ZhcigpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubmFtZSA9IHJlYWRlci5zdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnZhbHVlID0gcmVhZGVyLnN0cmluZygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZGljdGlvbmFyeU5hbWUgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCBfYiwgX2M7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ01zZ0NWYXJzX0NWYXIoKTtcbiAgICAgICAgbWVzc2FnZS5uYW1lID0gKF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uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTkVUTXNnU2V0Q29uVmFyKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5jb252YXJzID0gZXhwb3J0cy5DTXNnQ1ZhcnMuZGVjb2RlKHJlYWRlciwgcmVhZGVyLnVpbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNORVRNc2dTZXRDb25WYXIoKTtcbiAgICAgICAgbWVzc2FnZS5jb252YXJzID1cbiAgICAgICAgICAgIG9iamVjdC5jb252YXJzICE9PSB1bmRlZmluZWQgJiYgb2JqZWN0LmNvbnZhcnMgIT09IG51bGxcbiAgICAgICAgICAgICAgICA/IGV4cG9ydHMuQ01zZ0NWYXJzLmZyb21QYXJ0aWFsKG9iamVjdC5jb252YXJzKVxuICAgICAgICAgICAgICAgIDogdW5kZWZpbmVkO1xuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9XG59O1xuZnVuY3Rpb24gY3JlYXRlQmFzZUNORVRNc2dOT1AoKSB7XG4gICAgcmV0dXJuIHt9O1xufVxuZXhwb3J0cy5DTkVUTXNnTk9QID0ge1xuICAgIGVuY29k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ICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNORVRNc2dGaWxlKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50cmFuc2ZlcklkID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5maWxlTmFtZSA9IHJlYWRlci5zdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmlzUmVwbGF5RGVtb0ZpbGUgPSByZWFkZXIuYm9vbCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZGVueSA9IHJlYWRlci5ib29sKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bH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xuICAgICAgICBpZiAobWVzc2FnZS5zbG90ICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDgpLmludDMyKG1lc3NhZ2Uuc2xvdCk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDTkVUTXNnU3BsaXRTY3JlZW5Vc2VyKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zbG90ID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNORVRNc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E1zZ1BsYXllckF2YXRhckRhdGEoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmFjY291bnRpZCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnJnYiA9IHJlYWRlci5ieXRlcygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2I7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ05FVE1zZ1BsYXllckF2YXRhckRhdGEoKTtcbiAgICAgICAgbWVzc2FnZS5hY2NvdW50aWQgPSAoX2EgPSBvYmplY3QuYWNjb3VudGlkKSAhPT0gbnVsbCAmJiBfYSAhPT0gdm9pZCAwID8gX2EgOiAwO1xuICAgICAgICBtZXNzYWdlLnJnYiA9IChfYiA9IG9iamVjdC5yZ2IpICE9PSBudWxsICYmIF9iICE9PSB2b2lkIDAgPyBfYiA6IG5ldyBVaW50OEFycmF5KCk7XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH1cbn07XG5mdW5jdGlvbiBjcmVhdGVCYXNlQ0NMQ01zZ0NsaWVudEluZm8oKSB7XG4gICAgcmV0dXJuIHtcbiAgICAgICAgc2VuZFRhYmxlQ3JjOiAwLFxuICAgICAgICBzZXJ2ZXJDb3VudDogMCxcbiAgICAgICAgaXNIbHR2OiBmYWxzZSxcbiAgICAgICAgaXNSZXBsYXk6IGZhbHNlLFxuICAgICAgICBmcmllbmRzSWQ6IDAsXG4gICAgICAgIGZyaWVuZHNOYW1lOiBcIlwiLFxuICAgICAgICBjdXN0b21GaWxlczogW11cbiAgICB9O1xufVxuZXhwb3J0cy5DQ0xDTXNnQ2xpZW50SW5mbyA9IHtcbiAgICBlbmNvZGUobWVzc2FnZSwgd3JpdGVyID0gbWluaW1hbF8xLldyaXRlci5jcmVhdGUoKSkge1xuICAgICAgICBpZiAobWVzc2FnZS5zZW5kVGFibGVDcmMgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTMpLmZpeGVkMzIobWVzc2FnZS5zZW5kVGFibGVDcmMpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnNlcnZlckNvdW50ICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDE2KS51aW50MzIobWVzc2FnZS5zZXJ2ZXJDb3VudCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuaXNIbHR2ID09PSB0cnVlKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDI0KS5ib29sKG1lc3NhZ2UuaXNIbHR2KTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5pc1JlcGxheSA9PT0gdHJ1ZSkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigzMikuYm9vbChtZXNzYWdlLmlzUmVwbGF5KTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5mcmllbmRzSWQgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNDApLnVpbnQzMihtZXNzYWdlLmZyaWVuZHNJ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ICAgbWVzc2FnZS5zZXJ2ZXJDb3VudCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmlzSGx0diA9IHJlYWRlci5ib29sKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5pc1JlcGxheSA9IHJlYWRlci5ib29sKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5mcmllbmRzSWQgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5mcmllbmRzTmFtZSA9IHJlYWRlci5zdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA3OlxuICAgICAgICAgICAgICAgICAgICBpZiAoKHRhZyAmIDcpID09PSAyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBlbmQyID0gcmVhZGVyLnVpbnQzMigpICsgcmVhZGVyLnBvcztcbiAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuY3VzdG9tRmlsZXMucHVzaChyZWFkZXIuZml4ZWQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuY3VzdG9tRmlsZXMucHVzaChyZWFkZXIuZml4ZWQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2IsIF9jLCBfZCwgX2UsIF9mLCBfZztcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDQ0xDTXNnQ2xpZW50SW5mbygpO1xuICAgICAgICBtZXNzYWdlLnNlbmRUYWJsZUNyYyA9IChfYSA9IG9iamVjdC5zZW5kVGFibGVDcmMpICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6IDA7XG4gICAgICAgIG1lc3NhZ2Uuc2VydmVyQ291bnQgPSAoX2IgPSBvYmplY3Quc2VydmVyQ291bnQpICE9PSBudWxsICYmIF9iICE9PSB2b2lkIDAgPyBfYiA6IDA7XG4gICAgICAgIG1lc3NhZ2UuaXNIbHR2ID0gKF9jID0gb2JqZWN0LmlzSGx0dikgIT09IG51bGwgJiYgX2MgIT09IHZvaWQgMCA/IF9jIDogZmFsc2U7XG4gICAgICAgIG1lc3NhZ2UuaXNSZXBsYXkgPSAoX2QgPSBvYmplY3QuaXNSZXBsYXkpICE9PSBudWxsICYmIF9kICE9PSB2b2lkIDAgPyBfZCA6IGZhbHNlO1xuICAgICAgICBtZXNzYWdlLmZyaWVuZHNJZCA9IChfZSA9IG9iamVjdC5mcmllbmRzSWQpICE9PSBudWxsICYmIF9lICE9PSB2b2lkIDAgPyBfZSA6IDA7XG4gICAgICAgIG1lc3NhZ2UuZnJpZW5kc05hbWUgP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biAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNDTENNc2dNb3ZlKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5udW1CYWNrdXBDb21tYW5kcyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm51bU5ld0NvbW1hbmRzID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZGF0YSA9IHJlYWRlci5ieXRlcygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhci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gICAgICB9XG4gICAgICAgIGlmICghbWVzc2FnZS54dWlkLmlzWmVybygpKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDE3KS5maXhlZDY0KG1lc3NhZ2UueHVpZCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuZm9ybWF0ICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDI0KS5pbnQzMihtZXNzYWdlLmZvcm1hdCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2Uuc2VxdWVuY2VCeXRlcyAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigzMikuaW50MzIobWVzc2FnZS5zZXF1ZW5jZUJ5dGVzKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5zZWN0aW9uTnVtYmVyICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDQwKS51aW50MzIobWVzc2FnZS5zZWN0aW9uTnVtYmVyKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS51bmNvbXByZXNzZWRTYW1wbGVPZmZzZXQgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNDgpLnVpbnQzMihtZXNzYWdlLnVuY29tcHJlc3NlZFNhbXBsZU9mZnNldCk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDQ0xDTXNnVm9pY2VEYXRhKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5kYXRhID0gcmVhZGVyLmJ5dGVzKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS54dWlkID0gcmVhZGVyLmZpeGVkNjQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmZvcm1hdCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc2VxdWVuY2VCeXRlcyA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc2VjdGlvbk51bWJlciA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA2OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnVuY29tcHJlc3NlZFNhbXBsZU9mZnNldCA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKH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ByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5iYXNlbGluZVRpY2sgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmJhc2VsaW5lTnIgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNDTENNc2dCYXNlbGluZUFjaygpO1xuICAgICAgICBtZXNzYWdlLmJhc2VsaW5lVGljayA9IChfYSA9IG9iamVjdC5iYXNlbGluZVRpY2spICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6IDA7XG4gICAgICAgIG1lc3NhZ2UuYmFzZWxpbmVOciA9IChfYiA9IG9iamVjdC5iYXNlbGluZU5yKSAhPT0gbnVsbCAmJiBfYiAhPT0gdm9pZCAwID8gX2IgOiAwO1xuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9XG59O1xuZnVuY3Rpb24gY3JlYXRlQmFzZUNDTENNc2dMaXN0ZW5FdmVudHMoKSB7XG4gICAgcmV0dXJuIHsgZXZlbnRNYXNrOiBbXSB9O1xufVxuZXhwb3J0cy5DQ0xDTXNnTGlzdGVuRXZlbnRzID0ge1xuICAgIGVuY29kZShtZXNzYWdlLCB3cml0ZXIgPSBtaW5pbWFsXzEuV3JpdGVyLmNyZWF0ZSgpKSB7XG4gICAgICAgIHdyaXRlci51aW50MzIoMTApLmZvcmsoKTtcbiAgICAgICAgZm9yIChjb25zdCB2IG9mIG1lc3NhZ2UuZXZlbnRNYXNrKSB7XG4gICAgICAgICAgICB3cml0ZXIuZml4ZWQzMih2KTtcbiAgICAgICAgfVxuICAgICAgICB3cml0ZXIubGRlbGltKCk7XG4gICAgICAgIHJldHVybiB3cml0ZXI7XG4gICAgfSxcbiAgICBkZWNvZGUoaW5wdXQsIGxlbmd0aCkge1xuICAgICAgICBjb25zdCByZWFkZXIgPSBpbnB1dCBpbnN0YW5jZW9mIG1pbmltYWxfMS5SZWFkZXIgPyBpbnB1dCA6IG5ldyBtaW5pbWFsXzEuUmVhZGVyKGlucHV0KTtcbiAgICAgICAgbGV0IGVuZCA9IGxlbmd0aCA9PT0gdW5kZWZpbmVkID8gcmVhZGVyLmxlbiA6IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ0NMQ01zZ0xpc3RlbkV2ZW50cygpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIGlmICgodGFnICYgNykgPT09IDIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGVuZDIgPSByZWFkZXIudWludDMyKCkgKyByZWFkZXIucG9zO1xuICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAg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S5Xcml0ZXIuY3JlYXRlKCkpIHtcbiAgICAgICAgaWYgKG1lc3NhZ2UuY29va2llICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDgpLmludDMyKG1lc3NhZ2UuY29va2llKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5zdGF0dXNDb2RlICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDE2KS5pbnQzMihtZXNzYWdlLnN0YXR1c0NvZGUpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLm5hbWUgIT09IFwiXCIpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMjYpLnN0cmluZyhtZXNzYWdlLm5hbWUpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnZhbHVlICE9PSBcIlwiKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDM0KS5zdHJpbmcobWVzc2FnZS52YWx1ZSk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDQ0xDTXNnUmVzcG9uZEN2YXJWYWx1ZSgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuY29va2llID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zdGF0dXNDb2RlID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5uYW1lID0gcmVhZGVyLnN0cmluZygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudmFsdWUgPSByZWFkZXIuc3RyaW5nKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCBfYiwgX2MsIF9kO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNDTENNc2dSZXNwb25kQ3ZhclZhbHVlKCk7XG4gICAgICAgIG1lc3NhZ2UuY29va2llID0gKF9hID0gb2JqZWN0LmNvb2tpZSkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogMDtcbiAgICAgICAgbWVzc2FnZS5zdGF0dXNDb2RlID0gKF9iID0gb2JqZWN0LnN0YXR1c0NvZGUpICE9PSBudWxsICYmIF9iICE9PSB2b2lkID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dlLnBhdGgpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmNvZGVGaWxlbmFtZSAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigyNCkuaW50MzIobWVzc2FnZS5jb2RlRmlsZW5hbWUpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmZpbGVuYW1lICE9PSBcIlwiKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDM0KS5zdHJpbmcobWVzc2FnZS5maWxlbmFtZSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuZmlsZUZyYWN0aW9uICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDQwKS5pbnQzMihtZXNzYWdlLmZpbGVGcmFjdGlvbik7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UubWQ1Lmxlbmd0aCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig1MCkuYnl0ZXMobWVzc2FnZS5tZDUpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmNyYyAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig1NikudWludDMyKG1lc3NhZ2UuY3JjKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5maWxlSGFzaFR5cGUgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNjQpLmludDMyKG1lc3NhZ2UuZmlsZUhhc2hUeXBlKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5maWxlTGVuICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDcyKS5pbnQzMihtZXNzYWdlLmZpbGVMZW4pO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnBhY2tGaWxlSWQgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoODApLmludDMyKG1lc3NhZ2UucGFja0ZpbGVJZCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UucGFja0ZpbGVOdW1iZXIgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoODgpLmludDMyKG1lc3NhZ2UucGFja0ZpbGVOdW1iZXIpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiB3cml0ZXI7XG4gICAgfSxcbiAgICBkZWNvZGUoaW5wdXQsIGxlbmd0aCkge1xuICAgICAgICBjb25zdCByZWFkZXIgPSBpbnB1dCBpbnN0YW5jZW9mIG1pbmltYWxfMS5SZWFkZXIgPyBpbnB1dCA6IG5ldyBtaW5pbWFsXzEuUmVhZGVyKGlucHV0KTtcbiAgICAgICAgbGV0IGVuZCA9IGxlbmd0aCA9PT0gdW5kZWZpbmVkID8gcmVhZGVyLmxlbiA6IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ0NMQ01zZ0ZpbGVDUkNDaGVjaygpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuY29kZVBhdGggPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnBhdGggPSByZWFkZXIuc3RyaW5nKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5jb2RlRmlsZW5hbWUgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmZpbGVuYW1lID0gcmVhZGVyLnN0cmluZygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZmlsZUZyYWN0aW9uID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5tZDUgPSByZWFkZXIuYnl0ZXMoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA3OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmNyYyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA4OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmZpbGVIYXNoVHlwZSA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDk6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZmlsZUxlbiA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDEwOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnBhY2tGaWxlSWQgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5wYWNrRmlsZU51bWJlciA9IHJlYWRlci5pbnQzMigpO1xuICAgICA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cjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDQ0xDTXNnTG9hZGluZ1Byb2dyZXNzKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5wcm9ncmVzcyA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYTtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDQ0xDTXNnTG9hZGluZ1Byb2dyZXNzKCk7XG4gICAgICAgIG1lc3NhZ2UucHJvZ3Jlc3MgPSAoX2EgPSBvYmplY3QucHJvZ3Jlc3MpICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6IDA7XG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4gICAgICAgICAgICB3cml0ZXIudWludDMyKDU2KS5pbnQzMihtZXNzYWdlLmNPcyk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UubWFwQ3JjICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDY5KS5maXhlZDMyKG1lc3NhZ2UubWFwQ3JjKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5jbGllbnRDcmMgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNzcpLmZpeGVkMzIobWVzc2FnZS5jbGllbnRDcmMpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnN0cmluZ1RhYmxlQ3JjICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDg1KS5maXhlZDMyKG1lc3NhZ2Uuc3RyaW5nVGFibGVDcmMpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLm1heENsaWVudHMgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoODgpLmludDMyKG1lc3NhZ2UubWF4Q2xpZW50cyk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UubWF4Q2xhc3NlcyAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig5NikuaW50MzIobWVzc2FnZS5tYXhDbGFzc2VzKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5wbGF5ZXJTbG90ICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDEwNCkuaW50MzIobWVzc2FnZS5wbGF5ZXJTbG90KTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS50aWNrSW50ZXJ2YWwgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTE3KS5mbG9hdChtZXNzYWdlLnRpY2tJbnRlcnZhbCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuZ2FtZURpciAhPT0gXCJcIikge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigxMjIpLnN0cmluZyhtZXNzYWdlLmdhbWVEaXIpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLm1hcE5hbWUgIT09IFwiXCIpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTMwKS5zdHJpbmcobWVzc2FnZS5tYXBOYW1lKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5tYXBHcm91cE5hbWUgIT09IFwiXCIpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTM4KS5zdHJpbmcobWVzc2FnZS5tYXBHcm91cE5hbWUpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnNreU5hbWUgIT09IFwiXCIpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTQ2KS5zdHJpbmcobWVzc2FnZS5za3lOYW1lKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5ob3N0TmFtZSAhPT0gXCJcIikge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigxNTQpLnN0cmluZyhtZXNzYWdlLmhvc3ROYW1lKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5wdWJsaWNJcCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigxNjApLnVpbnQzMihtZXNzYWdlLnB1YmxpY0lwKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAoIW1lc3NhZ2UudWdjTWFwSWQuaXNaZXJvKCkpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTc2KS51aW50NjQobWVzc2FnZS51Z2NNYXBJZCk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDU1ZDTXNnU2VydmVySW5mbygpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucHJvdG9jb2wgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnNlcnZlckNvdW50ID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5pc0RlZGljYXRlZCA9IHJlYWRlci5ib29sKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5pc09mZmljaWFsVmFsdmVTZXJ2ZXIgPSByZWFkZXIuYm9vbCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuaXNIbHR2ID0gcmVhZGVyLmJvb2woKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA2OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmlzUmVwbGF5ID0gcmVhZGVyLmJvb2woKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5pc1JlZGlyZWN0aW5nVG9Qcm94eVJlbGF5ID0gcmVhZGVyLmJvb2woKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA3OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmNPcyA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDg6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubWFwQ3JjID0gcmVhZGVyLmZpeGVkMzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA5OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmNsaWVudENyYyA9IHJlYWRlci5maXhlZDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTA6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc3RyaW5nVGFibGVDcmMgPSByZWFkZXIuZml4ZWQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDExOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm1heENsaWVudHMgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5tYXhDbGFzc2VzID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucGxheWVyU2xvdCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDE0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnRpY2tJbnRlcnZhbCA9IHJlYWRlci5mbG9hdCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDE1OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmdhbWVEaXIgPSByZWFkZXIuc3RyaW5nKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTY6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubWFwTmFtZSA9IHJlYWRlci5zdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxNzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5tYXBHcm91cE5hbWUgPSByZWFkZXIuc3RyaW5nKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTg6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc2t5TmFtZSA9IHJlYWRlci5zdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxOTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5ob3N0TmFtZSA9IHJlYWRlci5zdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyMDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5wdWJsaWNJcCA9IHJlYWRlci51aW50MzIo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IubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDU1ZDTXNnQ2xhc3NJbmZvKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5jcmVhdGVPbkNsaWVudCA9IHJlYWRlci5ib29sKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5jbGFzc2VzLnB1c2goZXhwb3J0cy5DU1ZDTXNnQ2xhc3NJbmZvX2NsYXNzVC5kZWNvZGUocmVhZGVyLCByZWFkZXIudWludDMyKCkpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNTVkNNc2dDbGFzc0luZm8oKTtcbiAgICAgICAgbWVzc2FnZS5jcmVhdGVPbkNsaWVudCA9IChfYSA9IG9iamVjdC5jcmVhdGVPbkNsaWVudCkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogZmFsc2U7XG4gICAgICAgIG1lc3NhZ2UuY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b2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDU1ZDTXNnQ2xhc3NJbmZvX2NsYXNzVCgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuY2xhc3NJZCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZGF0YVRhYmxlTmFtZSA9IHJlYWRlci5zdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmNsYXNzTmFtZSA9IHJlYWRlci5zdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iLCBfYztcbiAgICAgICAgY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2FnZS5uZWVkc0RlY29kZXIgPT09IHRydWUpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMjQpLmJvb2wobWVzc2FnZS5uZWVkc0RlY29kZXIpO1xuICAgICAgICB9XG4gICAgICAgIGZvciAoY29uc3QgdiBvZiBtZXNzYWdlLnByb3BzKSB7XG4gICAgICAgICAgICBleHBvcnRzLkNTVkNNc2dTZW5kVGFibGVfc2VuZHByb3BULmVuY29kZSh2LCB3cml0ZXIudWludDMyKDM0KS5mb3JrKCkpLmxkZWxpbSgpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiB3cml0ZXI7XG4gICAgfSxcbiAgICBkZWNvZGUoaW5wdXQsIGxlbmd0aCkge1xuICAgICAgICBjb25zdCByZWFkZXIgPSBpbnB1dCBpbnN0YW5jZW9mIG1pbmltYWxfMS5SZWFkZXIgPyBpbnB1dCA6IG5ldyBtaW5pbWFsXzEuUmVhZGVyKGlucHV0KTtcbiAgICAgICAgbGV0IGVuZCA9IGxlbmd0aCA9PT0gdW5kZWZpbmVkID8gcmVhZGVyLmxlbiA6IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ1NWQ01zZ1NlbmRUYWJsZSgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuaXNFbmQgPSByZWFkZXIuYm9vbCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubmV0VGFibGVOYW1lID0gcmVhZGVyLnN0cmluZygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubmVlZHNEZWNvZGVyID0gcmVhZGVyLmJvb2woKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnByb3BzLnB1c2goZXhwb3J0cy5DU1ZDTXNnU2VuZFRhYmxlX3NlbmRwcm9wVC5kZWNvZGUocmVhZGVyLCByZWFkZXIudWludDMyKCkpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iLCBfYywgX2Q7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ1NWQ01zZ1NlbmRUYWJsZSgpO1xuICAgICAgICBtZXNzYWdlLmlzRW5kID0gKF9hID0gb2JqZWN0LmlzRW5kKSAhPT0gbnVsbCAmJiBfYSAhPT0gdm9pZCAwID8gX2EgOiBmYWxzZTtcbiAgICAgICAgbWVzc2FnZS5uZXRUYWJsZU5hbWUgPSAoX2IgPSBvYmplY3QubmV0VGFibGVOYW1lKSAhPT0gbnVsbCAmJiBfYiAhPT0gdm9pZCAwID8gX2IgOiBcIlwiO1xuICAgICAgICBtZXNzYWdlLm5lZWRzRGVjb2RlciA9IChfYyA9IG9iamVjdC5uZWVkc0RlY29kZXIpICE9PSBudWxsICYmIF9jICE9PSB2b2lkIDAgPyBfYyA6IGZhbHNlO1xuICAg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gICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNTVkNNc2dTZW5kVGFibGVfc2VuZHByb3BUKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50eXBlID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS52YXJOYW1lID0gcmVhZGVyLnN0cmluZygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZmxhZ3MgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnByaW9yaXR5ID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5kdE5hbWUgPSByZWFkZXIuc3RyaW5nKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5udW1FbGVtZW50cyA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDc6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubG93VmFsdWUgPSByZWFkZXIuZmxvYXQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA4OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmhpZ2hWYWx1ZSA9IHJlYWRlci5mbG9hdCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDk6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubnVtQml0cyA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2IsIF9jLCBfZCwgX2UsIF9mLCBfZywgX2gsIF9qO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNTVkNNc2dTZW5kVGFibGVfc2VuZHByb3BUKCk7XG4gICAgICAgIG1lc3NhZ2UudHlwZSA9IChfYSA9IG9iamVjdC50eXBlKSAhPT0gbnVsbCAmJiBfYSAhPT0gdm9pZCAwID8gX2EgOiAwO1xuICAgICAgICBtZXNzYWdlLnZhck5hbWUgPSAoX2IgPSBvYmplY3QudmFyTmFtZSkgIT09IG51bGwgJiYgX2IgIT09IHZvaWQgMCA/IF9iIDogXCJcIjtcbiAgICAgICAgbWVzc2FnZS5mbGFncyA9IChfYyA9IG9iamVjdC5mbGFncykgIT09IG51bGwgJiYgX2Mg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0KTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNTVkNNc2dQcmludCgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudGV4dCA9IHJlYWRlci5zdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2E7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ1NWQ01zZ1ByaW50KCk7XG4gICAgICAgIG1lc3NhZ2UudGV4dCA9IChfYSA9IG9iamVjdC50ZXh0KSAhPT0gbnVsbCAmJiBfYSAhPT0gdm9pZCAwID8gX2EgOiB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HJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ1NWQ01zZ1NldFZpZXcoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmVudGl0eUluZGV4ID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNTVkNNc2dTZXRWaWV3KCk7XG4gICAgICAgIG1lc3NhZ2UuZW50aXR5SW5kZXggPSAoX2EgPSBvYmplY3QuZW50aXR5SW5kZXgpICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6IDA7XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH1cbn07XG5mdW5jdGlvbiBjcmVhdGVCYXNlQ1NWQ01zZ0NyZWF0ZVN0cmluZ1RhYmxlKCkge1xuICAgIHJldHVybiB7XG4gICAgICAgIG5hbWU6IFwiXCIsXG4gICAgICAgIG1heEVudHJpZXM6IDAsXG4gICAgICAgIG51bUVudHJpZXM6IDAsXG4gICAgICAgIHVzZXJEYXRhRml4ZWRTaXplOiBmYWxzZSxcbiAgICAgICAgdXNlckRhdGFTaXplOiAwLFxuICAgICAgICB1c2VyRGF0YVNpemVCaXRzOiAwLFxuICAgICAgICBmbGFnczogMCxcbiAgICAgICAgc3RyaW5nRGF0YTogbmV3IFVpbnQ4QXJyYXkoKVxuICAgIH07XG59XG5leHBvcnRzLkNTVkNNc2dDcmVhdGVTdHJpbmdUYWJsZSA9IHtcbiAgICBlbmNvZGUobWVzc2FnZSwgd3JpdGVyID0gbWluaW1hbF8xLldyaXRlci5jcmVhdGUoKSkge1xuICAgICAgICBpZiAobWVzc2FnZS5uYW1lICE9PSBcIlwiKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDEwKS5zdHJpbmcobWVzc2FnZS5uYW1lKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5tYXhFbnRyaWVzICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDE2KS5pbnQzMihtZXNzYWdlLm1heEVudHJpZXMpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLm51bUVudHJpZXMgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMjQpLmludDMyKG1lc3NhZ2UubnVtRW50cmllcyk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UudXNlckRhdGFGaXhlZFNpemUgPT09IHRydWUpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMzIpLmJvb2wobWVzc2FnZS51c2VyRGF0YUZpeGVkU2l6ZSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UudXNlckRhdGFTaXplICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDQwKS5pbnQzMihtZXNzYWdlLnVzZXJEYXRhU2l6ZSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UudXNlckRhdGFTaXplQml0cyAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyL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FbnRyaWVzID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5udW1FbnRyaWVzID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS51c2VyRGF0YUZpeGVkU2l6ZSA9IHJlYWRlci5ib29sKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS51c2VyRGF0YVNpemUgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA2OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnVzZXJEYXRhU2l6ZUJpdHMgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA3OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmZsYWdzID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgODpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zdHJpbmdEYXRhID0gcmVhZGVyLmJ5dGVzKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4g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WluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNTVkNNc2dVcGRhdGVTdHJpbmdUYWJsZSgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudGFibGVJZCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubnVtQ2hhbmdlZEVudHJpZXMgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnN0cmluZ0RhdGEgPSByZWFkZXIuYnl0ZXMoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iLCBfYztcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDU1ZDTXNn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LnZlcnNpb24pO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiB3cml0ZXI7XG4gICAgfSxcbiAgICBkZWNvZGUoaW5wdXQsIGxlbmd0aCkge1xuICAgICAgICBjb25zdCByZWFkZXIgPSBpbnB1dCBpbnN0YW5jZW9mIG1pbmltYWxfMS5SZWFkZXIgPyBpbnB1dCA6IG5ldyBtaW5pbWFsXzEuUmVhZGVyKGlucHV0KTtcbiAgICAgICAgbGV0IGVuZCA9IGxlbmd0aCA9PT0gdW5kZWZpbmVkID8gcmVhZGVyLmxlbiA6IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ1NWQ01zZ1ZvaWNlSW5pdCgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucXVhbGl0eSA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuY29kZWMgPSByZWFkZXIuc3RyaW5nKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS52ZXJzaW9uID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgIC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ZGUobWVzc2FnZSwgd3JpdGVyID0gbWluaW1hbF8xLldyaXRlci5jcmVhdGUoKSkge1xuICAgICAgICBpZiAobWVzc2FnZS5jbGllbnQgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoOCkuaW50MzIobWVzc2FnZS5jbGllbnQpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnByb3hpbWl0eSA9PT0gdHJ1ZSkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigxNikuYm9vbChtZXNzYWdlLnByb3hpbWl0eSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKCFtZXNzYWdlLnh1aWQuaXNaZXJvKCkpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMjUpLmZpeGVkNjQobWVzc2FnZS54dWlkKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5hdWRpYmxlTWFzayAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigzMikuaW50MzIobWVzc2FnZS5hdWRpYmxlTWFzayk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2Uudm9pY2VEYXRhLmxlbmd0aCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig0MikuYnl0ZXMobWVzc2FnZS52b2ljZURhdGEpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmNhc3RlciA9PT0gdHJ1ZSkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig0OCkuYm9vbChtZXNzYWdlLmNhc3Rlcik7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuZm9ybWF0ICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDU2KS5pbnQzMihtZXNzYWdlLmZvcm1hdCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2Uuc2VxdWVuY2VCeXRlcyAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig2NCkuaW50MzIobWVzc2FnZS5zZXF1ZW5jZUJ5dGVzKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5zZWN0aW9uTnVtYmVyICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDcyKS51aW50MzIobWVzc2FnZS5zZWN0aW9uTnVtYmVyKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS51bmNvbXByZXNzZWRTYW1wbGVPZmZzZXQgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoODApLnVpbnQzMihtZXNzYWdlLnVuY29tcHJlc3NlZFNhbXBsZU9mZnNldCk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDU1ZDTXNnVm9pY2VEYXRhKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5jbGllbnQgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnByb3hpbWl0eSA9IHJlYWRlci5ib29sKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS54dWlkID0gcmVhZGVyLmZpeGVkNjQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmF1ZGlibGVNYXNrID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS52b2ljZURhdGEgPSByZWFkZXIuYnl0ZXMoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA2OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmNhc3RlciA9IHJlYWRlci5ib29sKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5mb3JtYXQgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA4OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnNlcXVlbmNlQnl0ZXMgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA5OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnNlY3Rpb25OdW1iZXIgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTA6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudW5jb21wcmVzc2VkU2FtcGxlT2Zmc2V0ID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2IsIF9jLCBfZCwgX2UsIF9mLCBfZywgX2gsIF9qO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNTVkNNc2dWb2ljZURhdGEoKTtcbiAgICAgICAgbWVzc2FnZS5jbGllbnQgPSAoX2EgPSBvYmplY3QuY2xpZW50KSAhPT0gbnVsbCAmJiBfYSAhPT0gdm9pZCAwID8gX2EgOiAwO1xuICAgICAgICBtZXNzYWdlLnByb3hpbWl0eSA9IChfYiA9IG9iamVjdC5wcm94aW1pdHkpICE9PSBudWxsICYmIF9iICE9PSB2b2lkIDAgPyBfYiA6IGZhbHNlO1xuICAgICAgICBtZXNzYWdlLnh1aWQgPVxuICAgICAgICAgICAgb2JqZWN0Lnh1aWQgIT09IHVuZGVmaW5lZCAmJiBvYmplY3QueHVpZCAhPT0gbnVsbFxuICAgICAgICAgICAgICAgID8gTG9uZy5mcm9tVmFsdWUob2JqZWN0Lnh1aWQpXG4gICAgICAgICAgICAgICAgOiBMb25nLlVaRVJPO1xuICAgICAgICBtZXNzYWdlLmF1ZGlibGVNYXNrID0gKF9jID0gb2JqZWN0LmF1ZGlibGVNYXNrKSAhPT0gbnVsbCAmJiBfYyAhPT0gdm9pZCAwID8gX2MgOiAwO1xuICAgICAgICBtZXNzYWdlLnZvaWNlRGF0Y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09IHRydWUpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoOCkuYm9vbChtZXNzYWdlLnJlbGF0aXZlKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5hbmdsZSAhPT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgICBleHBvcnRzLkNNc2dRQW5nbGUuZW5jb2RlKG1lc3NhZ2UuYW5nbGUsIHdyaXRlci51aW50MzIoMTgpLmZvcmsoKSkubGRlbGltKCk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDU1ZDTXNnRml4QW5nbGUoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnJlbGF0aXZlID0gcmVhZGVyLmJvb2woKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmFuZ2xlID0gZXhwb3J0cy5DTXNnUUFuZ2xlLmRlY29kZShyZWFkZXIsIHJlYWRlci51aW50MzIoKSk7XG4gIC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ydHMuQ01zZ1FBbmdsZS5lbmNvZGUobWVzc2FnZS5hbmdsZSwgd3JpdGVyLnVpbnQzMigxMCkuZm9yaygpKS5sZGVsaW0oKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNTVkNNc2dDcm9zc2hhaXJBbmdsZSgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuYW5nbGUgPSBleHBvcnRzLkNNc2dRQW5nbGUuZGVjb2RlKHJlYWRlciwgcmVhZGVyLnVpbnQzMigpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlY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G4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zb3VuZEluZGV4ID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNTVkNNc2dQcmVmZXRjaCgpO1xuICAgICAgICBtZXNzYWdlLnNvdW5kSW5kZXggPSAoX2EgPSBvYmplY3Quc291bmRJbmRleCkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogMDtcbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfVxufTtcbmZ1bmN0aW9uIGNyZWF0ZUJhc2VDU1ZDTXNnQlNQRGVjYWwoKSB7XG4gICAgcmV0dXJuIHtcbiAgICAgICAgcG9zOiB1bmRlZmluZWQsXG4gICAgICAgIGRlY2FsVGV4dHVyZUluZGV4OiAwLFxuICAgICAgICBlbnRpdHlJbmRleDogMCxcbiAgICAgICAgbW9kZWxJbmRleDogMCxcbiAgICAgICAgbG93UHJpb3JpdHk6IGZhbHNlXG4gICAgfTtcbn1cbmV4cG9ydHMuQ1NWQ01zZ0JTUERlY2FsID0ge1xuICAgIGVuY29kZShtZX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ZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNTVkNNc2dCU1BEZWNhbCgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucG9zID0gZXhwb3J0cy5DTXNnVmVjdG9yLmRlY29kZShyZWFkZXIsIHJlYWRlci51aW50MzIoKSk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5kZWNhbFRleHR1cmVJbmRleCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZW50aXR5SW5kZXggPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm1vZGVsSW5kZXggPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA1OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmxvd1ByaW9yaXR5ID0gcmVhZGVyLmJvb2woKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xu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2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS50eXBlID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zbG90ID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5wbGF5ZXJJbmRleCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2IsIF9jO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNTVkNNc2dTcGxpdFNjcmVlbigpO1xuICAgICAgICBtZXNzYWdlLnR5cGUgPSAoX2EgPSBvYmplY3QudHlwZSkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogMDtcbiAgICAgICAgbWVzc2FnZS5zbG90ID0gKF9iID0gb2JqZWN0LnNsb3QpICE9PSBudWxsICYmIF9iICE9PSB2b2lkIDAgPyBfYiA6IDA7XG4gICAgICAgIG1lc3NhZ2UucGxheWVySW5kZXggPSAoX2MgPSBvYmplY3QucGxheWVySW5kZXgpICE9PSBudWxsICYmIF9jICE9PSB2b2lkIDAgPyBfYyA6IDA7XG4gICAgICAgIHJld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ICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuY29va2llID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5jdmFyTmFtZSA9IHJlYWRlci5zdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNTVkNNc2dHZXRDdmFyVmFsdWUoKTtcbiAgICAgICAgbWVzc2FnZS5jb29raWUgPSAoX2EgPSBvYmplY3QuY29va2llKSAhPT0gbnVsbCAmJiBfYSAhPT0gdm9pZCAwID8gX2EgOiAwO1xuICAgICAgICBtZXNzYWdlLmN2YXJOYW1lID0gKF9iID0gb2JqZWN0LmN2YXJOYW1lKSAhPT0gbnVsbCAmJiBfYiAhPT0gdm9pZCAwID8gX2IgOiBcIlwiO1xuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9XG59O1xuZnVuY3Rpb24gY3JlYXRlQmFzZUNTVkNNc2dNZW51KCkge1xuICAgIHJldHVybiB7IGRpYWxvZ1R5cGU6IDAsIG1lbnVLZXlWYWx1ZXM6IG5ldyBVaW50OEFycmF5KCkgfTtcbn1cbmV4cG9ydHMuQ1NWQ01zZ01lbnUgPSB7XG4gICAgZW5jb2RlKG1lc3NhZ2UsIHdyaXRlciA9IG1p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WludG1hcERhdGEgPSB7XG4gICAgZW5jb2RlKG1lc3NhZ2UsIHdyaXRlciA9IG1pbmltYWxfMS5Xcml0ZXIuY3JlYXRlKCkpIHtcbiAgICAgICAgaWYgKG1lc3NhZ2UucGFpbnRtYXAubGVuZ3RoICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDEwKS5ieXRlcyhtZXNzYWdlLnBhaW50bWFwKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNTVkNNc2dQYWludG1hcERhdGEoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnBhaW50bWFwID0gcmVhZGVyLmJ5dGVzKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3N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2UucGFzc3Rocm91Z2ggIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMzIpLmludDMyKG1lc3NhZ2UucGFzc3Rocm91Z2gpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiB3cml0ZXI7XG4gICAgfSxcbiAgICBkZWNvZGUoaW5wdXQsIGxlbmd0aCkge1xuICAgICAgICBjb25zdCByZWFkZXIgPSBpbnB1dCBpbnN0YW5jZW9mIG1pbmltYWxfMS5SZWFkZXIgPyBpbnB1dCA6IG5ldyBtaW5pbWFsXzEuUmVhZGVyKGlucHV0KTtcbiAgICAgICAgbGV0IGVuZCA9IGxlbmd0aCA9PT0gdW5kZWZpbmVkID8gcmVhZGVyLmxlbiA6IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ1NWQ01zZ0dhbWVFdmVudCgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZXZlbnROYW1lID0gcmVhZGVyLnN0cmluZygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZXZlbnRpZCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uua2V5cy5wdXNoKGV4cG9ydHMuQ1NWQ01zZ0dhbWVFdmVudF9rZXlULmRlY29kZShyZWFkZXIsIHJlYWRlci51aW50MzIoKSkpO1xuICAgICAgICA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ICAgfVxuICAgICAgICBpZiAobWVzc2FnZS52YWxTaG9ydCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig0MCkuaW50MzIobWVzc2FnZS52YWxTaG9ydCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UudmFsQnl0ZSAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig0OCkuaW50MzIobWVzc2FnZS52YWxCeXRlKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS52YWxCb29sID09PSB0cnVlKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDU2KS5ib29sKG1lc3NhZ2UudmFsQm9vbCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKCFtZXNzYWdlLnZhbFVpbnQ2NC5pc1plcm8oKSkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig2NCkudWludDY0KG1lc3NhZ2UudmFsVWludDY0KTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS52YWxXc3RyaW5nLmxlbmd0aCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig3NCkuYnl0ZXMobWVzc2FnZS52YWxXc3RyaW5nKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd3JpdGVyO1xuICAgIH0sXG4gICAgZGVjb2RlKGlucHV0LCBsZW5ndGgpIHtcbiAgICAgICAgY29uc3QgcmVhZGVyID0gaW5wdXQgaW5zdGFuY2VvZiBtaW5pbWFsXzEuUmVhZGVyID8gaW5wdXQgOiBuZXcgbWluaW1hbF8xLlJlYWRlcihpbnB1dCk7XG4gICAgICAgIGxldCBlbmQgPSBsZW5ndGggPT09IHVuZGVmaW5lZCA/IHJlYWRlci5sZW4gOiByZWFkZXIucG9zICsgbGVuZ3RoO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNTVkNNc2dHYW1lRXZlbnRfa2V5VCgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudHlwZSA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudmFsU3RyaW5nID0gcmVhZGVyLnN0cmluZygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudmFsRmxvYXQgPSByZWFkZXIuZmxvYXQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnZhbExvbmcgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA1OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnZhbFNob3J0ID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS52YWxCeXRlID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS52YWxCb29sID0gcmVhZGVyLmJvb2woKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA4OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnZhbFVpbnQ2NCA9IHJlYWRlci51aW50NjQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA5OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnZhbFdzdHJpbmcgPSByZWFkZXIuYnl0ZXMoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iLCBfYywgX2QsIF9lLCBfZiwgX2csIF9oO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNTVkNNc2dHYW1lRXZlbnRfa2V5VCgpO1xuICAgICAgICBtZXNzYWdlLnR5cGUgPSAoX2EgPSBvYmplY3QudHlwZSkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogMDtcbiAgICAgICAgbWVzc2FnZS52YWxTdHJpbmcgPSAoX2IgPSBvYmplY3QudmFsU3RyaW5nKSAhPT0gbnVsbCAmJiBfYiAhPT0gdm9pZCAwID8gX2IgOiBcIlwiO1xuICAgICAgICBtZXNzYWdlLnZhbEZsb2F0ID0gKF9jID0gb2JqZWN0LnZhbEZsb2F0KSAhPT0gbnVsbCAmJiBfYyAhPT0gdm9pZCAwID8gX2MgOiAwO1xuICAgICAgICBtZXNzYWdlLnZhbExvbmcgPSAoX2QgPSBvYmplY3QudmFsTG9uZykgIT09IG51bGwgJiYgX2QgIT09IHZvaWQgMCA/IF9kIDogMDtcbiAgICAgICAgbWVzc2FnZS52YWx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VFdmVudExpc3RfZGVzY3JpcHRvclQuZW5jb2RlKHYsIHdyaXRlci51aW50MzIoMTApLmZvcmsoKSkubGRlbGltKCk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDU1ZDTXNnR2FtZUV2ZW50TGlzdCgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZGVzY3JpcHRvcnMucHVzaChleHBvcnRzLkNTVkNNc2dHYW1lRXZlbnRMaXN0X2Rlc2NyaXB0b3JULmRlY29kZShyZWFkZXIsIHJlYWRlci51aW50MzIoKSkpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZh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yKGlucHV0KTtcbiAgICAgICAgbGV0IGVuZCA9IGxlbmd0aCA9PT0gdW5kZWZpbmVkID8gcmVhZGVyLmxlbiA6IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ1NWQ01zZ0dhbWVFdmVudExpc3Rfa2V5VCgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UudHlwZSA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubmFtZSA9IHJlYWRlci5zdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iO1xuICAgICAgICBjb25zdCBtZXNzYWdlID0gY3JlYXRlQmFzZUNTVkNNc2dHYW1lRXZlbnRMaXN0X2tleVQoKTtcbiAgICAgICAgbWVzc2FnZS50eXBlID0gKF9hID0gb2JqZWN0LnR5cGUpICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6IDA7XG4gICAgICAgIG1lc3NhZ2UubmFtZSA9IChfYiA9IG9i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VuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDU1ZDTXNnR2FtZUV2ZW50TGlzdF9kZXNjcmlwdG9yVCgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZXZlbnRpZCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UubmFtZSA9IHJlYWRlci5zdHJpbmcoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmtleXMucHVzaChleHBvcnRzLkNTVkNNc2dHYW1lRXZlbnRMaXN0X2tleVQuZGVjb2RlKHJlYWRlciwgcmVhZGVyLnVpbnQzMigpKSk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHJlYWRlci5za2lwVHlwZSh0YWcgJiA3KTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1lc3NhZ2U7XG4gICAgfSxcbiAgICBmcm9tUGFydGlhbChvYmplY3QpIHtcbiAgICAgICAgdmFyIF9hLCBfYiwgX2M7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXN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gICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuZW50aXR5RGF0YS5sZW5ndGggIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMjYpLmJ5dGVzKG1lc3NhZ2UuZW50aXR5RGF0YSk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDU1ZDTXNnVGVtcEVudGl0aWVzKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5yZWxpYWJsZSA9IHJlYWRlci5ib29sKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5udW1FbnRyaWVzID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5lbnRpdHlEYXRhID0gcmVhZGVyLmJ5dGVzKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZ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3IFVpbnQ4QXJyYXkoKVxuICAgIH07XG59XG5leHBvcnRzLkNTVkNNc2dQYWNrZXRFbnRpdGllcyA9IHtcbiAgICBlbmNvZGUobWVzc2FnZSwgd3JpdGVyID0gbWluaW1hbF8xLldyaXRlci5jcmVhdGUoKSkge1xuICAgICAgICBpZiAobWVzc2FnZS5tYXhFbnRyaWVzICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDgpLmludDMyKG1lc3NhZ2UubWF4RW50cmllcyk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UudXBkYXRlZEVudHJpZXMgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTYpLmludDMyKG1lc3NhZ2UudXBkYXRlZEVudHJpZXMpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmlzRGVsdGEgPT09IHRydWUpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMjQpLmJvb2wobWVzc2FnZS5pc0RlbHRhKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS51cGRhdGVCYXNlbGluZSA9PT0gdHJ1ZSkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigzMikuYm9vbChtZXNzYWdlLnVwZGF0ZUJhc2VsaW5lKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5iYXNlbGluZSAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig0MCkuaW50MzIobWVzc2FnZS5iYXNlbGluZSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuZGVsdGFGcm9tICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDQ4KS5pbnQzMihtZXNzYWdlLmRlbHRhRnJvbSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuZW50aXR5RGF0YS5sZW5ndGggIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNTgpLmJ5dGVzKG1lc3NhZ2UuZW50aXR5RGF0YSk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDU1ZDTXNnUGFja2V0RW50aXRpZXMoKTtcbiAgICAgICAgd2hpbGUgKHJlYWRlci5wb3MgPCBlbmQpIHtcbiAgICAgICAgICAgIGNvbnN0IHRhZyA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgIHN3aXRjaCAodGFnID4+PiAzKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm1heEVudHJpZXMgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnVwZGF0ZWRFbnRyaWVzID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5pc0RlbHRhID0gcmVhZGVyLmJvb2woKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnVwZGF0ZUJhc2VsaW5lID0gcmVhZGVyLmJvb2woKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA1OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmJhc2VsaW5lID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5kZWx0YUZyb20gPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA3OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmVudGl0eURhdGEgPSByZWFkZXIuYnl0ZXMoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjdCkge1xuICAgICAgICB2YXIgX2EsIF9iLCBfYywgX2QsIF9lLCBfZiwgX2c7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ1NWQ01zZ1BhY2tldEVudGl0aWVzKCk7XG4gICAgICAgIG1lc3NhZ2UubWF4RW50cmllcyA9IChfYSA9IG9iamVjdC5tYXhFbnRyaWVzKSAhPT0gbnVsbCAmJiBfYSAhPT0gdm9pZCAwID8gX2EgOiAwO1xuICAgICAgICBtZXNzYWdlLnVwZGF0ZWRFbnRyaWVzID0gKF9iID0gb2JqZWN0LnVwZGF0ZWRFbnRyaWVzKSAhPT0gbnVsbCAmJiBfYiAhPT0gdm9pZCAwID8gX2IgOiAw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IHYgb2YgbWVzc2FnZS5zb3VuZHMpIHtcbiAgICAgICAgICAgIGV4cG9ydHMuQ1NWQ01zZ1NvdW5kc19zb3VuZGRhdGFULmVuY29kZSh2LCB3cml0ZXIudWludDMyKDE4KS5mb3JrKCkpLmxkZWxpbSgpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiB3cml0ZXI7XG4gICAgfSxcbiAgICBkZWNvZGUoaW5wdXQsIGxlbmd0aCkge1xuICAgICAgICBjb25zdCByZWFkZXIgPSBpbnB1dCBpbnN0YW5jZW9mIG1pbmltYWxfMS5SZWFkZXIgPyBpbnB1dCA6IG5ldyBtaW5pbWFsXzEuUmVhZGVyKGlucHV0KTtcbiAgICAgICAgbGV0IGVuZCA9IGxlbmd0aCA9PT0gdW5kZWZpbmVkID8gcmVhZGVyLmxlbiA6IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ1NWQ01zZ1NvdW5kcygpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucmVsaWFibGVTb3VuZCA9IHJlYWRlci5ib29sKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zb3VuZHMucHVzaChleHBvcnRzLkNTVkNNc2dTb3VuZHNfc291bmRkYXRhVC5kZWNvZGUocmVhZGVyLCByZWFkZXIudWludDMyKCkpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICA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ZTogMCxcbiAgICAgICAgc3BlYWtlckVudGl0eTogMCxcbiAgICAgICAgcmFuZG9tU2VlZDogMCxcbiAgICAgICAgc291bmRMZXZlbDogMCxcbiAgICAgICAgaXNTZW50ZW5jZTogZmFsc2UsXG4gICAgICAgIGlzQW1iaWVudDogZmFsc2VcbiAgICB9O1xufVxuZXhwb3J0cy5DU1ZDTXNnU291bmRzX3NvdW5kZGF0YVQgPSB7XG4gICAgZW5jb2RlKG1lc3NhZ2UsIHdyaXRlciA9IG1pbmltYWxfMS5Xcml0ZXIuY3JlYXRlKCkpIHtcbiAgICAgICAgaWYgKG1lc3NhZ2Uub3JpZ2luWCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig4KS5zaW50MzIobWVzc2FnZS5vcmlnaW5YKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5vcmlnaW5ZICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDE2KS5zaW50MzIobWVzc2FnZS5vcmlnaW5ZKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5vcmlnaW5aICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDI0KS5zaW50MzIobWVzc2FnZS5vcmlnaW5aKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS52b2x1bWUgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMzIpLnVpbnQzMihtZXNzYWdlLnZvbHVtZSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuZGVsYXlWYWx1ZSAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig0NSkuZmxvYXQobWVzc2FnZS5kZWxheVZhbHVlKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5zZXF1ZW5jZU51bWJlciAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig0OCkuaW50MzIobWVzc2FnZS5zZXF1ZW5jZU51bWJlcik7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UuZW50aXR5SW5kZXggIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNTYpLmludDMyKG1lc3NhZ2UuZW50aXR5SW5kZXgpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmNoYW5uZWwgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNjQpLmludDMyKG1lc3NhZ2UuY2hhbm5lbCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UucGl0Y2ggIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoNzIpLmludDMyKG1lc3NhZ2UucGl0Y2gpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmZsYWdzICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDgwKS5pbnQzMihtZXNzYWdlLmZsYWdzKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5zb3VuZE51bSAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig4OCkudWludDMyKG1lc3NhZ2Uuc291bmROdW0pO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnNvdW5kTnVtSGFuZGxlICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDEwMSkuZml4ZWQzMihtZXNzYWdlLnNvdW5kTnVtSGFuZGxlKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5zcGVha2VyRW50aXR5ICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDEwNCkuaW50MzIobWVzc2FnZS5zcGVha2VyRW50aXR5KTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5yYW5kb21TZWVkICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDExMikuaW50MzIobWVzc2FnZS5yYW5kb21TZWVkKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5zb3VuZExldmVsICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDEyMCkuaW50MzIobWVzc2FnZS5zb3VuZExldmVsKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5pc1NlbnRlbmNlID09PSB0cnVlKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDEyOCkuYm9vbChtZXNzYWdlLmlzU2VudGVuY2UpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLmlzQW1iaWVudCA9PT0gdHJ1ZSkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigxMzYpLmJvb2wobWVzc2FnZS5pc0FtYmllbnQpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiB3cml0ZXI7XG4gICAgfSxcbiAgICBkZWNvZGUoaW5wdXQsIGxlbmd0aCkge1xuICAgICAgICBjb25zdCByZWFkZXIgPSBpbnB1dCBpbnN0YW5jZW9mIG1pbmltYWxfMS5SZWFkZXIgPyBpbnB1dCA6IG5ldyBtaW5pbWFsXzEuUmVhZGVyKGlucHV0KTtcbiAgICAgICAgbGV0IGVuZCA9IGxlbmd0aCA9PT0gdW5kZWZpbmVkID8gcmVhZGVyLmxlbiA6IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ1NWQ01zZ1NvdW5kc19zb3VuZGRhdGFUKCk7XG4gICAgICAgIHdoaWxlIChyZWFkZXIucG9zIDwgZW5kKSB7XG4gICAgICAgICAgICBjb25zdCB0YWcgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICBzd2l0Y2ggKHRhZyA+Pj4gMykge1xuICAgICAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5vcmlnaW5YID0gcmVhZGVyLnNpbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uub3JpZ2luWSA9IHJlYWRlci5zaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLm9yaWdpblogPSByZWFkZXIuc2ludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS52b2x1bWUgPSByZWFkZXIudWludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5kZWxheVZhbHVlID0gcmVhZGVyLmZsb2F0KCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zZXF1ZW5jZU51bWJlciA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDc6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZW50aXR5SW5kZXggPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA4OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmNoYW5uZWwgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA5OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnBpdGNoID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTA6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZmxhZ3MgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxMTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zb3VuZE51bSA9IHJlYWRlci51aW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxMjpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zb3VuZE51bUhhbmRsZSA9IHJlYWRlci5maXhlZDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTM6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc3BlYWtlckVudGl0eSA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDE0OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnJhbmRvbVNlZWQgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAxNTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5zb3VuZExldmVsID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTY6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuaXNTZW50ZW5jZSA9IHJlYWRlci5ib29sKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgMTc6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuaXN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QsIGxlbmd0aCkge1xuICAgICAgICBjb25zdCByZWFkZXIgPSBpbnB1dCBpbnN0YW5jZW9mIG1pbmltYWxfMS5SZWFkZXIgPyBpbnB1dCA6IG5ldyBtaW5pbWFsXzEuUmVhZGVyKGlucHV0KTtcbiAgICAgICAgbGV0IGVuZCA9IGxlbmd0aCA9PT0gdW5kZWZpbmVkID8gcmVhZGVyLmxlbiA6IHJlYWRlci5wb3MgKyBsZW5ndGg7XG4gICAgICAgIGNvbnN0IG1lc3NhZ2UgPSBjcmVhdGVCYXNlQ1NWQ01zZ0VudGl0eU1zZygpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZW50SW5kZXggPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmNsYXNzSWQgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmVudERhdGEgPSByZWFkZXIuYnl0ZXMoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWVzc2FnZTtcbiAgICB9LFxuICAgIGZyb21QYXJ0aWFsKG9iamVjd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gICAgICAgIHJlcGxheVNsb3dkb3duRW5kOiAwLFxuICAgICAgICByZXBsYXlTbG93ZG93blJhdGU6IDBcbiAgICB9O1xufVxuZXhwb3J0cy5DU1ZDTXNnSGx0dlJlcGxheSA9IHtcbiAgICBlbmNvZGUobWVzc2FnZSwgd3JpdGVyID0gbWluaW1hbF8xLldyaXRlci5jcmVhdGUoKSkge1xuICAgICAgICBpZiAobWVzc2FnZS5kZWxheSAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig4KS5pbnQzMihtZXNzYWdlLmRlbGF5KTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5wcmltYXJ5VGFyZ2V0ICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDE2KS5pbnQzMihtZXNzYWdlLnByaW1hcnlUYXJnZXQpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnJlcGxheVN0b3BBdCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMigyNCkuaW50MzIobWVzc2FnZS5yZXBsYXlTdG9wQXQpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtZXNzYWdlLnJlcGxheVN0YXJ0QXQgIT09IDApIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMzIpLmludDMyKG1lc3NhZ2UucmVwbGF5U3RhcnRBdCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UucmVwbGF5U2xvd2Rvd25CZWdpbiAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig0MCkuaW50MzIobWVzc2FnZS5yZXBsYXlTbG93ZG93bkJlZ2luKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWVzc2FnZS5yZXBsYXlTbG93ZG93bkVuZCAhPT0gMCkge1xuICAgICAgICAgICAgd3JpdGVyLnVpbnQzMig0OCkuaW50MzIobWVzc2FnZS5yZXBsYXlTbG93ZG93bkVuZCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1lc3NhZ2UucmVwbGF5U2xvd2Rvd25SYXRlICE9PSAwKSB7XG4gICAgICAgICAgICB3cml0ZXIudWludDMyKDYxKS5mbG9hdChtZXNzYWdlLnJlcGxheVNsb3dkb3duUmF0ZSk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDU1ZDTXNnSGx0dlJlcGxheSgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuZGVsYXkgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnByaW1hcnlUYXJnZXQgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnJlcGxheVN0b3BBdCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucmVwbGF5U3RhcnRBdCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucmVwbGF5U2xvd2Rvd25CZWdpbiA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDY6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucmVwbGF5U2xvd2Rvd25FbmQgPSByZWFkZXIuaW50MzIoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSA3OlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnJlcGxheVNsb3dkb3duUmF0ZSA9IHJlYWRlci5mbG9hdCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZWN0KSB7XG4gICAgICAgIHZhciBfYSwgX2IsIF9jLCBfZCwgX2UsIF9mLCBfZztcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDU1ZDTXNnSGx0dlJlcGxheSgpO1xuICAgICAgICBtZXNzYWdlLmRlbGF5ID0gKF9hID0gb2JqZWN0LmRlbGF5KSAhPT0gbnVsbCAmJiBfYSAhPT0gdm9pZCAwID8gX2EgOiAwO1xuICAgICAgICBtZXNzYWdlLnByaW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XQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDQ0xDTXNnSGx0dlJlcGxheSgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucmVxdWVzdCA9IHJlYWRlci5pbnQzMigpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2Uuc2xvd2Rvd25MZW5ndGggPSByZWFkZXIuZmxvYXQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnNsb3dkb3duUmF0ZSA9IHJlYWRlci5mbG9hdCgpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UucHJpbWFyeVRhcmdldEVudEluZGV4ID0gcmVhZGVyLmludDMyKCk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIGNhc2UgNTpcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZS5ldmVudFRpbWUgPSByZWFkZXIuZmxvYXQoKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgcmVhZGVyLnNraXBUeXBlKHRhZyAmIDcp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FuZCA9IHtcbiAgICBlbmNvZGUobWVzc2FnZSwgd3JpdGVyID0gbWluaW1hbF8xLldyaXRlci5jcmVhdGUoKSkge1xuICAgICAgICBpZiAobWVzc2FnZS5jbWQgIT09IFwiXCIpIHtcbiAgICAgICAgICAgIHdyaXRlci51aW50MzIoMTApLnN0cmluZyhtZXNzYWdlLmNtZCk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHdyaXRlcjtcbiAgICB9LFxuICAgIGRlY29kZShpbnB1dCwgbGVuZ3RoKSB7XG4gICAgICAgIGNvbnN0IHJlYWRlciA9IGlucHV0IGluc3RhbmNlb2YgbWluaW1hbF8xLlJlYWRlciA/IGlucHV0IDogbmV3IG1pbmltYWxfMS5SZWFkZXIoaW5wdXQpO1xuICAgICAgICBsZXQgZW5kID0gbGVuZ3RoID09PSB1bmRlZmluZWQgPyByZWFkZXIubGVuIDogcmVhZGVyLnBvcyArIGxlbmd0aDtcbiAgICAgICAgY29uc3QgbWVzc2FnZSA9IGNyZWF0ZUJhc2VDU1ZDTXNnQnJvYWRjYXN0Q29tbWFuZCgpO1xuICAgICAgICB3aGlsZSAocmVhZGVyLnBvcyA8IGVuZCkge1xuICAgICAgICAgICAgY29uc3QgdGFnID0gcmVhZGVyLnVpbnQzMigpO1xuICAgICAgICAgICAgc3dpdGNoICh0YWcgPj4+IDMpIHtcbiAgICAgICAgICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuY21kID0gcmVhZGVyLnN0cmluZygpO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICByZWFkZXIuc2tpcFR5cGUodGFnICYgNyk7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZXNzYWdlO1xuICAgIH0sXG4gICAgZnJvbVBhcnRpYWwob2JqZ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XNzZXJ0X2V4aXN0c18xLmRlZmF1bHQpKHRoaXMuZmluZFRhYmxlQnlOYW1lKG5hbWUpKTtcbiAgICAgICAgY29uc3QgbnVtRW50cmllcyA9IGJpdGJ1Zi5yZWFkVUludDE2KCk7XG4gICAgICAgIGZvciAobGV0IGVudHJ5SW5kZXggPSAwOyBlbnRyeUluZGV4IDwgbnVtRW50cmllczsgKytlbnRyeUluZGV4KSB7XG4gICAgICAgICAgICBjb25zdCBlbnRyeSA9IGJpdGJ1Zi5yZWFkQ1N0cmluZygpO1xuICAgICAgICAgICAgbGV0IHVzZXJEYXRhID0gbnVsbDtcbiAgICAgICAgICAgIC8vIGhhcyB1c2VyIGRhdGE/XG4gICAgICAgICAgICBpZiAoYml0YnVmLnJlYWRPbmVCaXQoKSkge1xuICAgICAgICAgICAgICAgIGNvbnN0IHVzZXJEYXRhU2l6ZSA9IGJpdGJ1Zi5yZWFkVUludDE2KCk7XG4gICAgICAgICAgICAgICAgY29uc3QgdXNlckRhdGFCdWYgPSBiaXRidWYucmVhZEJ5dGVzKHVzZXJEYXRhU2l6ZSk7XG4gICAgICAgICAgICAgICAgdXNlckRhdGEgPVxuICAgICAgICAgICAgICAgICAgICB1c2VyRGF0YUNhbGxiYWNrID09PSB1bmRlZmluZWRcbiAgICAgICAgICAgICAgICAgICAgICAgID8gdXNlckRhdGFCdWZcbiAgICAgICAgICAgICAgICAgICAgICAgIDogdXNlckRhdGFDYWxsYmFjayh1c2VyRGF0YUJ1Zik7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBjb25zdCBvbGRVc2VyRGF0YSA9IChfYSA9IHRhYmxlLmVudHJpZXNbZW50cnlJbmRleF0pID09PSBudWxsIHx8IF9hID09PSB2b2lkIDAgPyB2b2lkIDAgOiBfYS51c2VyRGF0YTtcbiAgICAgICAgICAgIHRhYmxlLmVudHJpZXNbZW50cnlJbmRleF0gPSB7IGVudHJ5LCB1c2VyRGF0YSB9O1xuICAgICAgICAgICAgdGhpcy5lbWl0KFwidXBkYXRlXCIsIHtcbiAgICAgICAgICAgICAgICB0YWJsZSxcbiAgICAgICAgICAgICAgICBlbnRyeUluZGV4LFxuICAgICAgICAgICAgICAgIGVudHJ5LFxuICAgICAgICAgICAgICAgIHVzZXJEYXRhLFxuICAgICAgICAgICAgICAgIG9sZFVzZXJEYXRhXG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfVxuICAgICAgICAvLyBwYXJzZSBjbGllbnQtc2lkZSBlbnRyaWVzXG4gICAgICAgIGlmIChiaXRidWYucmVhZE9uZUJpdCgpKSB7XG4gICAgICAgICAgICBjb25zdCBudW1TdHJpbmdzID0gYml0YnVmLnJlYWRVSW50MTYoKTtcbiAgICAgICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgbnVtU3RyaW5nczsgKytpKSB7XG4gICAgICAgICAgICAgICAgLy8gZXNsaW50LWRpc2FibGUtbmV4dC1saW5lIEB0eXBlc2NyaXB0LWVzbGludC9uby11bnVzZWQtdmFyc1xuICAgICAgICAgICAgICAgIGNvbnN0IGVudHJ5ID0gYml0YnVmLnJlYWRDU3RyaW5nKCk7XG4gICAgICAgICAgICAgICAgbGV0IHVzZXJEYXRhID0gbnVsbDtcbiAgICAgICAgICAgICAgICBpZiAoYml0YnVmLnJlYWRPbmVCaXQoKSkge1xuICAgICAgICAgICAgICAgICAgICBjb25zdCB1c2VyRGF0YVNpemUgPSBiaXRidWYucmVhZFVJbnQxNigpO1xuICAgICAgICAgICAgICAgICAgICBjb25zdCB1c2VyRGF0YUJ1ZiA9IGJpdGJ1Zi5yZWFkQnl0ZXModXNlckRhdGFTaXplKTtcbiAgICAgICAgICAgICAgICAgICAgLy8gZXNsaW50LWRpc2FibGUtbmV4dC1saW5lIEB0eXBlc2NyaXB0LWVzbGludC9uby11bnVzZWQtdmFyc1xuICAgICAgICAgICAgICAgICAgICB1c2VyRGF0YSA9XG4gICAgICAgICAgICAgICAgICAgICAgICB1c2VyRGF0YUNhbGxiYWNrID09PSB1bmRlZmluZWRcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICA/IHVzZXJEYXRhQnVmXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgOiB1c2VyRGF0YUNhbGxiYWNrKHVzZXJEYXRhQnVmKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgLy8gVE9ETzogZG8gc29tZXRoaW5nIHdpdGggY2xpZW50LXNpZGUgZW50cmllc1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIC8vIHRhYmxlIGlzIHJlYWR5XG4gICAgICAgIHRoaXMuZW1pdChcInBvc3RjcmVhdGVcIiwgdGFibGUpO1xuICAgIH1cbiAgICBfcGFyc2VTdHJpbmdUYWJsZVVwZGF0ZShiaXRidWYsIHRhYmxlLCBlbnRyaWVzKSB7XG4gICAgICAgIGNvbnN0IGhpc3RvcnkgPSBbXTtcbiAgICAgICAgY29uc3QgZW50cnlCaXRzID0gTWF0aC5jZWlsKE1hdGgubG9nMih0YWJsZS5tYXhFbnRyaWVzKSk7XG4gICAgICAgIGNvbnN0IHVzZXJEYXRhQ2FsbGJhY2sgPSB0aGlzLnVzZXJEYXRhQ2FsbGJhY2tzW3RhYmxlLm5hbWVdO1xuICAgICAgICBhc3NlcnQoIWJpdGJ1Zi5yZWFkT25lQml0KCksIFwiZGljdGlvbmFyeSBlbmNvZGluZyB1bnN1cHBvcnRlZFwiKTtcbiAgICAgICAgbGV0IGVudHJ5SW5kZXggPSAtMTtcbiAgICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCBlbnRyaWVzOyArK2kpIHtcbiAgICAgICAgICAgIGVudHJ5SW5kZXggKz0gMTtcbiAgICAgICAgICAgIGlmICghYml0YnVmLnJlYWRPbmVCaXQoKSkge1xuICAgICAgICAgICAgICAgIGVudHJ5SW5kZXggPSBiaXRidWYucmVhZFVCaXRzKGVudHJ5Qml0cyk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBhc3NlcnQoZW50cnlJbmRleCA+PSAwICYmIGVudHJ5SW5kZXggPCB0YWJsZS5tYXhFbnRyaWVzLCBcImJvZ3VzIHN0cmluZyBpbmRleFwiKTtcbiAgICAgICAgICAgIGNvbnN0IGV4aXN0aW5nRW50cnkgPSB0YWJsZS5lbnRyaWVzW2VudHJ5SW5kZXhdO1xuICAgICAgICAgICAgbGV0IGVudHJ5ID0gbnVsbDtcbiAgICAgICAgICAgIC8vIGhhcyB0aGUgZW50cnkgY2hhbmdlZD9cbiAgICAgICAgICAgIGlmIChiaXRidWYucmVhZE9uZUJpdCgpKSB7XG4gICAgICAgICAgICAgICAgLy8gc3Vic3RyaW5nIGNoZWNrXG4gICAgICAgICAgICAgICAgaWYgKGJpdGJ1Zi5yZWFkT25lQml0KCkpIHtcbiAgICAgICAgICAgICAgICAgICAgY29uc3QgaW5kZXggPSBiaXRidWYucmVhZFVCaXRzKDUpO1xuICAgICAgICAgICAgICAgICAgICBjb25zdCBieXRlc1RvQ29weSA9IGJpdGJ1Zi5yZWFkVUJpdHMoY29uc3RzLlNVQlNUUklOR19CSVRTKTtcbiAgICAgICAgICAgICAgICAgICAgY29uc3QgbGFzdCA9IGhpc3RvcnlbaW5kZXhdO1xuICAgICAgICAgICAgICAgICAgICBpZiAobGFzdCA9PSBudWxsKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXCJzdHJpbmcgdGFibGUgZW50cnkgaXMgZGVsdGEgZnJvbSBub24gZXhpc3RlbnQgZW50cnlcIik7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgY29uc3Qgc3ViU3RyID0gbGFzdC5zbGljZSgwLCBieXRlc1RvQ29weSk7XG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IHN1ZmZpeCA9IGJpdGJ1Zi5yZWFkQ1N0cmluZygpO1xuICAgICAgICAgICAgICAgICAgICBlbnRyeSA9IHN1YlN0ciArIHN1ZmZpeDtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIGVudHJ5ID0gYml0YnVmLnJlYWRDU3RyaW5nKCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgLy8gSWYgdGhlIHN0cmluZyBpdHNlbGYgaGFzbid0IGNoYW5nZWQsIHRoaXMgZW50cnkgbXVzdCBhbHJlYWR5IGV4aXN0XG4gICAgICAgICAgICAgICAgZW50cnkgPSAoMCwgYXNzZXJ0X2V4aXN0c18xLmRlZmF1bHQpKGV4aXN0aW5nRW50cnkpLmVudHJ5O1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgLy8gcmVhZCBpbiB0aGUgdXNlciBkYXRhXG4gICAgICAgICAgICBsZXQgdXNlckRhdGEgPSBudWxsO1xuICAgICAgICAgICAgaWYgKGJpdGJ1Zi5yZWFkT25lQml0KCkpIHtcbiAgICAgICAgICAgICAgICAvLyBkb24ndCByZWFkIHRoZSBsZW5ndGgsIGl0J3MgZml4ZWQgbGVuZ3RoIGFuZCB0aGUgbGVuZ3RoIHdhcyBuZXR3b3JrZWQgZG93biBhbHJlYWR5XG4gICAgICAgICAgICAgICAgaWYgKHRhYmxlLnVzZXJEYXRhRml4ZWRTaXplKSB7XG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IHVzZXJEYXRhQXJyYXkgPSBbYml0YnVmLnJlYWRVQml0cyh0YWJsZS51c2VyRGF0YVNpemVCaXRzKV07XG4gICAgICAgICAgICAgICAgICAgIHVzZXJEYXRhID0gQnVmZmVyLmZyb20odXNlckRhdGFBcnJheSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICBjb25zdCBieXRlcyA9IGJpdGJ1Zi5yZWFkVUJpdHMoY29uc3RzLk1BWF9VU0VSREFUQV9CSVRTKTtcbiAgICAgICAgICAgICAgICAgICAgdXNlckRhdGEgPSBiaXRidWYucmVhZEJ5dGVzKGJ5dGVzKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgaWYgKHVzZXJEYXRhQ2FsbGJhY2sgIT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgICAgICAgICB1c2VyRGF0YSA9IHVzZXJEYXRhQ2FsbGJhY2sodXNlckRhdGEpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgIHVzZXJEYXRhID0gZXhpc3RpbmdFbnRyeSA9PT0gbnVsbCB8fCBleGlzdGluZ0VudHJ5ID09PSB2b2lkIDAgPyB2b2lkIDAgOiBleGlzdGluZ0VudHJ5LnVzZXJEYXRhO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgY29uc3Qgb2xkVXNlckRhdGEgPSBleGlzdGluZ0VudHJ5ID09PSBudWxsIHx8IGV4aXN0aW5nRW50cnkgPT09IHZvaWQgMCA/IHZvaWQgMCA6IGV4aXN0aW5nRW50cnkudXNlckRhdGE7XG4gICAgICAgICAgICB0YWJsZS5lbnRyaWVzW2VudHJ5SW5kZXhdID0geyBlbnRyeSwgdXNlckRhdGEgfTtcbiAgICAgICAgICAgIC8vIGFkZCB0byBoaXN0b3J5XG4gICAgICAgICAgICBpZiAoaGlzdG9yeS5sZW5ndGggPiAzMSkge1xuICAgICAgICAgICAgICAgIGhpc3Rvcnkuc2hpZnQoKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGhpc3RvcnkucHVzaChlbnRyeSk7XG4gICAgICAgICAgICB0aGlzLmVtaXQoXCJ1cGRhdGVcIiwge1xuICAgICAgICAgICAgICAgIHRhYmxlLFxuICAgICAgICAgICAgICAgIGVudHJ5SW5kZXgsXG4gICAgICAgICAgICAgICAgZW50cnksXG4gICAgICAgICAgICAgICAgdXNlckRhdGEsXG4gICAgICAgICAgICAgICAgb2xkVXNlckRhdGFcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgfVxuICAgIF9oYW5kbGVDcmVhdGVTdHJpbmdUYWJsZShtc2cpIHtcbiAgICAgICAgY29uc3QgYml0YnVmID0gYml0YnVmZmVyXzEuQml0U3RyZWFtLmZyb20obXNnLnN0cmluZ0RhdGEpO1xuICAgICAgICAvLyB0YWJsZSBzaG91bGRuJ3QgYWxyZWFkeSBleGlzdFxuICAgICAgICBhc3NlcnQodGhpcy5maW5kVGFibGVCeU5hbWUobXNnLm5hbWUpID09PSB1bmRlZmluZWQsIFwidGFibGUgYWxyZWFkeSBleGlzdHNcIik7XG4gICAgICAgIGFzc2VydChtc2cudXNlckRhdGFTaXplID09PSBNYXRoLmNlaWwobXNnLnVzZXJEYXRhU2l6ZUJpdHMgLyA4KSwgXCJpbnZhbGlkIHVzZXIgZGF0YSBieXRlIHNpemVcIik7XG4gICAgICAgIGFzc2VydChtc2cudXNlckRhdGFTaXplQml0cyA8PSAzMiwgXCJ1c2VyZGF0YSB2YWx1ZSB0b28gbGFyZ2VcIik7XG4gICAgICAgIC8vIGNyZWF0ZSBhbiBlbXB0eSB0YWJsZVxuICAgICAgICBjb25zdCB0YWJsZSA9IHtcbiAgICAgICAgICAgIG5hbWU6IG1zZy5uYW1lLFxuICAgICAgICAgICAgZW50cmllczogW10sXG4gICAgICAgICAgICB1c2VyRGF0YVNpemVCaXRzOiBtc2cudXNlckRhdGFTaXplQml0cyxcbiAgICAgICAgICAgIHVzZXJEYXRhRml4ZWRTaXplOiBtc2cudXNlckRhdGFGaXhlZFNpemUsXG4gICAgICAgICAgICBtYXhFbnRyaWVzOiBtc2cubWF4RW50cmllc1xuICAgICAgICB9O1xuICAgICAgICB0aGlzLmVtaXQoXCJjcmVhdGVcIiwgdGFibGUpO1xuICAgICAgICB0aGlzLl9wYXJzZVN0cmluZ1RhYmxlVXBkYXRlKGJpdGJ1ZiwgdGFibGUsIG1zZy5udW1FbnRyaWVzKTtcbiAgICAgICA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cHJvamVjdGlsZXNcbiAgICAgICAgICAgIGlmICghKGV2ZW50LmVudGl0eSBpbnN0YW5jZW9mIHByb2plY3RpbGVfMS5Qcm9qZWN0aWxlKSlcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICBhc3NlcnQoIXRyYWplY3Rvcmllcy5oYXMoZXZlbnQuZW50aXR5LmluZGV4KSk7XG4gICAgICAgICAgICB0cmFqZWN0b3JpZXMuc2V0KGV2ZW50LmVudGl0eS5pbmRleCwgW2V2ZW50LmVudGl0eS5wb3NpdGlvbl0pO1xuICAgICAgICB9XG4gICAgICAgIGZ1bmN0aW9uIG9uRW50aXR5UmVtb3ZlKGV2ZW50KSB7XG4gICAgICAgICAgICAvLyBJZiBhIHByb2plY3RpbGUgd2FzIHRocm93biBqdXN0IGJlZm9yZSByb3VuZCBlbmQsXG4gICAgICAgICAgICAvLyBpdCB3b3VsZCBiZSBkZWxldGVkIGJlZm9yZSBkZXRvbmF0aW5nLlxuICAgICAgICAgICAgdHJhamVjdG9yaWVzLmRlbGV0ZShldmVudC5pbmRleCk7XG4gICAgICAgIH1cbiAgICAgICAgZnVuY3Rpb24gb25FbnRpdHlDaGFuZ2UoZXZlbnQpIHtcbiAgICAgICAgICAgIGNvbnN0IGluZGV4ID0gZXZlbnQuZW50aXR5LmluZGV4O1xuICAgICAgICAgICAgaWYgKCF0cmFqZWN0b3JpZXMuaGFzKGluZGV4KSlcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICBjb25zdCBwcm9qZWN0aWxlID0gZXZlbnQuZW50aXR5O1xuICAgICAgICAgICAgZm9yIChjb25zdCBjaGFuZ2Ugb2YgZXZlbnQuY2hhbmdlcykge1xuICAgICAgICAgICAgICAgIGlmIChjaGFuZ2UudmFyTmFtZSAhPT0gXCJtX25Cb3VuY2VzXCIpXG4gICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlO1xuICAgICAgICAgICAgICAgIGNvbnN0IG9sZFZhbHVlID0gKGNoYW5nZS5vbGRWYWx1ZSB8fCAwKTtcbiAgICAgICAgICAgICAgICBjb25zdCBuZXdWYWx1ZSA9IGNoYW5nZS5uZXdWYWx1ZTtcbiAgICAgICAgICAgICAgICBpZiAobmV3VmFsdWUgPiBvbGRWYWx1ZSkge1xuICAgICAgICAgICAgICAgICAgICB0cmFqZWN0b3JpZXMuZ2V0KGluZGV4KS5wdXNoKHByb2plY3RpbGUucG9zaXRpb24pO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBmdW5jdGlvbiBvbkdyZW5hZGVEZXRvbmF0ZUV2ZW50KGV2ZW50KSB7XG4gICAgICAgICAgICBjb25zdCBwcm9qZWN0aWxlID0gZXZlbnQuZW50aXR5O1xuICAgICAgICAgICAgLy8gdG9kbzogd2hlbiBjb3VsZCB0aGlzIGJlIG51bGw/XG4gICAgICAgICAgICBjb25zdCB0cmFqZWN0b3J5ID0gdHJhamVjdG9yaWVzLmdldChldmVudC5lbnRpdHlpZCk7XG4gICAgICAgICAgICB0cmFqZWN0b3J5LnB1c2gocHJvamVjdGlsZS5wb3NpdGlvbik7XG4gICAgICAgICAgICBkZW1vLmVtaXQoXCJncmVuYWRlVHJhamVjdG9yeVwiLCB7XG4gICAgICAgICAgICAgICAgcHJvamVjdGlsZSxcbiAgICAgICAgICAgICAgICB0aHJvd2VyOiBldmVudC5wbGF5ZXIsXG4gICAgICAgICAgICAgICAgdHJhamVjdG9yeVxuICAgICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICAgICAgZnVuY3Rpb24gb25Nb2xvdG92RGV0b25hdGUoeyBwcm9qZWN0aWxlLCB0aHJvd2VyIH0pIHtcbiAgICAgICAgICAgIC8vIHRvZG86IHdoZW4gY291bGQgdGhpcyBiZSBudWxsP1xuICAgICAgICAgICAgY29uc3QgdHJhamVjdG9yeSA9IHRyYWplY3Rvcmllcy5nZXQocHJvamVjdGlsZS5pbmRleCk7XG4gICAgICAg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XRlbUluZGV4ID09PSA0OCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGRlbW8uZW1pdChcIml0ZW1QdXJjaGFzZVwiLCB7IC4uLnBlbmRpbmcsIHdlYXBvbiB9KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHBlbmRpbmdQdXJjaGFzZXMgPSBbXTtcbiAgICAgICAgfVxuICAgICAgICBmdW5jdGlvbiBvbkVudGl0eUNoYW5nZShlKSB7XG4gICAgICAgICAgICB2YXIgX2E7XG4gICAgICAgICAgICBpZiAoIShlLmVudGl0eSBpbnN0YW5jZW9mIHBsYXllcl8xLlBsYXllcikpXG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgLy8gUEVSRjogYWRkIGFiaWxpdHkgdG8gbGlzdGVuIG9uIHNwZWNpZmljIHRhYmxlc1xuICAgICAgICAgICAgZm9yIChjb25zdCBjaGFuZ2Ugb2YgZS5jaGFuZ2VzKSB7XG4gICAgICAgICAgICAgICAgaWYgKGNoYW5nZS50YWJsZU5hbWUgIT09IFwibV9pV2VhcG9uUHVyY2hhc2VzVGhpc1JvdW5kXCIpXG4gICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlO1xuICAgICAgICAgICAgICAgIGNvbnN0IHdlYXBvbklkID0gcGFyc2VJbnQoY2hhbmdlLnZhck5hbWUsIDEwKTtcbiAgICAgICAgICAgICAgICBjb25zdCBvbGRWYWx1ZSA9IChjaGFuZ2Uub2xkVmFsdWUgfHwgMCk7XG4gICAgICAgICAgICAgICAgY29uc3QgbmV3VmFsdWUgPSBjaGFuZ2UubmV3VmFsdWU7XG4gICAgICAgICAgICAgICAgY29uc3QgY291bnQgPSBuZXdWYWx1ZSAtIG9sZFZhbHVlO1xuICAgICAgICAgICAgICAgIGlmIChjb3VudCA+IDApIHtcbiAgICAgICAgICAgICAgICAgICAgcGVuZGluZ1B1cmNoYXNlcy5wdXNoKHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHBsYXllcjogZS5lbnRpdHksXG4gICAgICAgICAgICAgICAgICAgICAgICB3ZWFwb25JZCxcbiAgICAgICAgICAgICAgICAgICAgICAgIGl0ZW1OYW1lOiAoKF9hID0gaXRlbWRlZnNfMS5pdGVtRGVmaW5pdGlvbkluZGV4TWFwW3dlYXBvbklkXSkgPT09IG51bGwgfHwgX2EgPT09IHZvaWQgMCA/IHZvaWQgMCA6IF9hLml0ZW1OYW1lKSB8fFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVxdWlwbWVudElkTWFwW3dlYXBvbklkXSB8fFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwiVW5rbm93blwiLFxuICAgICAgICAgICAgICAgICAgICAgICAgY291bnQsXG4gICAgICAgICAgICAgICAgICAgICAgICB3ZWFwb246IHVuZGVmaW5lZFxuICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgZGVtby5vbihcInRpY2tlbmRcIiwgb25UaWNrRW5kKTtcbiAgICAgICAgZGVtby5lbnRpdGllcy5vbihcImNoYW5nZVwiLCBvbkVudGl0eUNoYW5nZSk7XG4gICAgICAgIHJldHVybiAoKSA9PiB7XG4gICAgICAgICAgICBkZW1vLm9mZihcInRpY2tlbmRcIiwgb25UaWNrRW5kKTtcbiAgICAgICAgICAgIGRlbW8uZW50aXRpZXMub2ZmKFwiY2hhbmdlXCIsIG9uRW50aXR5Q2hhbmdlKTtcbiAgICAgICAgfTtcbiAgICB9XG59O1xuZXhwb3J0cy5kZWZhdWx0ID0gc3VwcGxlbWVudDtcbi8vIyBzb3VyY2VNYXBwaW5nVVJMPWl0ZW1wdXJjaGFzZS5qcy5tYXAiLCJcInVzZSBzdHJpY3RcIjtcbk9iamVjdC5kZWZpbmVQcm9wZXJ0eShleHBvcnRzLCBcIl9fZXNNb2R1bGVcIiwgeyB2YWx1ZTogdHJ1ZSB9KTtcbmNvbnN0IGN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IHRoZSBtb2xvdG92IHByb2plY3RpbGUgY2xhc3MuXG4gICAgICAgIC8vIE5vdGUgdGhhdCB0aGlzIGVudGl0eSBpcyBzaGFyZWQgYmV0d2VlbiBtb2xvdG92IGFuZCBpbmNlbmRpYXJ5IGdyZW5hZGVzLlxuICAgICAgICBsZXQgbW9sb3RvdlByb2plY3RpbGVDbGFzcyA9IC0xO1xuICAgICAgICBmdW5jdGlvbiBvbkRhdGFUYWJsZXNSZWFkeSgpIHtcbiAgICAgICAgICAgIG1vbG90b3ZQcm9qZWN0aWxlQ2xhc3MgPSBkZW1vLmVudGl0aWVzLnNlcnZlckNsYXNzZXMuZmluZEluZGV4KHNjID0+IHNjLm5hbWUgPT09IFwiQ01vbG90b3ZQcm9qZWN0aWxlXCIpO1xuICAgICAgICB9XG4gICAgICAgIGZ1bmN0aW9uIG9uU291bmQoZSkge1xuICAgICAgICAgICAgaWYgKGZpcmVMb29wU291bmRJbmRleCA8IDAgfHwgbW9sb3RvdlByb2plY3RpbGVDbGFzcyA8IDApXG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgZm9yIChjb25zdCBzb3VuZCBvZiBlLnNvdW5kcykge1xuICAgICAgICAgICAgICAgIC8vIFdlIG9ubHkgY2FyZSBhYm91dCB0aGUgZmlyZSBsb29wIHNvdW5kXG4gICAgICAgICAgICAgICAgaWYgKHNvdW5kLnNvdW5kTnVtSGFuZGxlID09PSAwKSB7XG4gICAgICAgICAgICAgICAgICAgIGlmIChzb3VuZC5zb3VuZE51bSAhPT0gZmlyZUxvb3BTb3VuZEluZGV4KVxuICAgICAgICAgICAgICAgICAgICAgICAgY29udGludWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAvLyB0b2RvOiBuZXZlciBhY3R1YWxseSBzZWUgdGhpc1xuICAgICAgICAgICAgICAgICAgICBpZiAoc291bmQuc291bmROdW1IYW5kbGUgIT09IG1vbG90b3ZMb29wKVxuICAgICAgICAgICAgICAgICAgICAgICAgY29udGludWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIC8vIFRoZSBsb29wIHNvdW5kIHN0YXJ0cyB3aGVuIHRoZSBncmVuYWRlIGlzIHRocm93bixcbiAgICAgICAgICAgICAgICAvLyBhbmQgaXMgc3RvcHBlZCBvbiBkZXRvbmF0aW9uLlxuICAgICAgICAgICAgICAgIGlmICgoc291bmQuZmxhZ3MgJiBjb25zdHNfMS5TTkRfU1RPUCkgPT09IDApXG4gICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlO1xuICAgICAgICAgICAgICAgIGNvbnN0IHByb2plY3RpbGUgPSBkZW1vLmVudGl0aWVzLmVudGl0aWVzLmdldChzb3VuZC5lbnRpdHlJbmRleCk7XG4gICAgICAgICAgICAgICAgaWYgKCFwcm9qZWN0aWxlKVxuICAgICAgICAgICAgICAgICAgICBjb250aW51ZTtcbiAgICAgICAgICAgICAgICAvLyBUaGlzIHNvdW5kIGlzIGFsc28gc3RvcHBlZCBvbiB0aGUgcmVzdWx0aW5nIGluZmVybm9cbiAgICAgICAgICAgICAgICAvLyAoaS5lLiB0aGUgZmxhbWVzIHByb2R1Y2VkIGJ5IGEgZGV0b25hdGVkIGZpcmUgZ3JlbmFkZSkuXG4gICAgICAgICAgICAgICAgaWYgKHByb2plY3RpbGUuY2xhc3NJZCA9PT0gbW9sb3RvdlByb2plY3RpbGVDbGFzcykge1xuICAgICAgICAgICAgICAgICAgICBjb25zdCB0aHJvd2VyID0gcHJvamVjdGlsZS5vd25lcjtcbiAgICAgICAgICAgICAgICAgICAgZGVtby5lbWl0KFwibW9sb3RvdkRldG9uYXRlXCIsIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93ZXIsXG4gICAgICAgICAgICAgICAgICAgICAgICBwcm9qZWN0aWxlXG4gICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICA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BpbmRleCAgID0gMixcclxuICAgICAgICBwZW5kaW5nID0gdHJ1ZTtcclxuICAgIHdoaWxlIChpbmRleCA8IGFyZ3VtZW50cy5sZW5ndGgpXHJcbiAgICAgICAgcGFyYW1zW29mZnNldCsrXSA9IGFyZ3VtZW50c1tpbmRleCsrXTtcclxuICAgIHJldHVybiBuZXcgUHJvbWlzZShmdW5jdGlvbiBleGVjdXRvcihyZXNvbHZlLCByZWplY3QpIHtcclxuICAgICAgICBwYXJhbXNbb2Zmc2V0XSA9IGZ1bmN0aW9uIGNhbGxiYWNrKGVyci8qLCB2YXJhcmdzICovKSB7XHJcbiAgICAgICAgICAgIGlmIChwZW5kaW5nKSB7XHJcbiAgICAgICAgICAgICAgICBwZW5kaW5nID0gZmFsc2U7XHJcbiAgICAgICAgICAgICAgICBpZiAoZXJyKVxyXG4gICAgICAgICAgICAgICAgICAgIHJlamVjdChlcnIpO1xyXG4gICAgICAgICAgICAgICAgZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgdmFyIHBhcmFtcyA9IG5ldyBBcnJheShhcmd1bWVudHMubGVuZ3RoIC0gMSksXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIG9mZnNldCA9IDA7XHJcbiAgICAgICAgICAgICAgICAgICAgd2hpbGUgKG9mZnNldCA8IHBhcmFtcy5sZW5ndGgpXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHBhcmFtc1tvZmZzZXQrK10gPSBhcmd1bWVudHNbb2Zmc2V0XTtcclxuICAgICAgICAgICAgICAgICAgICByZXNvbHZlLmFwcGx5KG51bGwsIHBhcmFtcyk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9O1xyXG4gICAgICAgIHRyeSB7XHJcbiAgICAgICAgICAgIGZuLmFwcGx5KGN0eCB8fCBudWxsLCBwYXJhbXMpO1xyXG4gICAgICAgIH0gY2F0Y2ggKGVycikge1xyXG4gICAgICAgICAgICBpZiAocGVuZGluZyk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AgICAgICAgICBicmVhaztcclxuICAgICAgICAgICAgY2FzZSAxOlxyXG4gICAgICAgICAgICAgICAgY2h1bmtbaSsrXSA9IGI2NFt0IHwgYiA+PiA0XTtcclxuICAgICAgICAgICAgICAgIHQgPSAoYiAmIDE1KSA8PCAyO1xyXG4gICAgICAgICAgICAgICAgaiA9IDI7XHJcbiAgICAgICAgICAgICAgICBicmVhaztcclxuICAgICAgICAgICAgY2FzZSAyOlxyXG4gICAgICAgICAgICAgICAgY2h1bmtbaSsrXSA9IGI2NFt0IHwgYiA+PiA2XTtcclxuICAgICAgICAgICAgICAgIGNodW5rW2krK10gPSBiNjRbYiAmIDYzXTtcclxuICAgICAgICAgICAgICAgIGogPSAwO1xyXG4gICAgICAgICAgICAgICAgYnJlYWs7XHJcbiAgICAgICAgfVxyXG4gICAgICAgIGlmIChpID4gODE5MSkge1xyXG4gICAgICAgICAgICAocGFydHMgfHwgKHBhcnRzID0gW10pKS5wdXNoKFN0cmluZy5mcm9tQ2hhckNvZGUuYXBwbHkoU3RyaW5nLCBjaHVuaykpO1xyXG4gICAgICAgICAgICBpID0gMDtcclxuICAgICAgICB9XHJcbiAgICB9XHJcbiAgICBpZiAoaikge1xyXG4gICAgICAgIGNodW5rW2krK10gPSBiNjRbdF07XHJcbiAgICAgICAgY2h1bmtbaSsrXSA9IDYxO1xyXG4gICAgICAgIGlmIChqID09PSAxKVxyXG4gICAgICAgICAgICBjaHVua1tpKytdID0gNjE7XHJcbiAgICB9XHJcbiAgICBpZiAocGFydHMpIHtcclxuICAgICAgICBpZiAoaSlcclxuICAgICAgICAgICAgcGFydHMucHVzaChTdHJpbmcuZnJvbUNoYXJDb2RlLmFwcGx5KFN0cmluZywgY2h1bmsuc2xpY2UoMCwgaSkpKTtcclxuICAgICAgICByZXR1cm4gcGFydHMuam9pbihcIlwiKTtcclxuICAgIH1cclxuICAgIHJldHVybiBTdHJpbmcuZnJvbUNoYXJDb2RlLmFwcGx5KFN0cmluZywgY2h1bmsuc2x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JcbiAgICAgICAgICAgICAgICBqID0gMTtcclxuICAgICAgICAgICAgICAgIGJyZWFrO1xyXG4gICAgICAgICAgICBjYXNlIDE6XHJcbiAgICAgICAgICAgICAgICBidWZmZXJbb2Zmc2V0KytdID0gdCA8PCAyIHwgKGMgJiA0OCkgPj4gNDtcclxuICAgICAgICAgICAgICAgIHQgPSBjO1xyXG4gICAgICAgICAgICAgICAgaiA9IDI7XHJcbiAgICAgICAgICAgICAgICBicmVhaztcclxuICAgICAgICAgICAgY2FzZSAyOlxyXG4gICAgICAgICAgICAgICAgYnVmZmVyW29mZnNldCsrXSA9ICh0ICYgMTUpIDw8IDQgfCAoYyAmIDYwKSA+PiAyO1xyXG4gICAgICAgICAgICAgICAgdCA9IGM7XHJcbiAgICAgICAgICAgICAgICBqID0gMztcclxuICAgICAgICAgICAgICAgIGJyZWFrO1xyXG4gICAgICAgICAgICBjYXNlIDM6XHJcbiAgICAgICAgICAgICAgICBidWZmZXJbb2Zmc2V0KytdID0gKHQgJiAzKSA8PCA2IHwgYztcclxuICAgICAgICAgICAgICAgIGogPSAwO1xyXG4gICAgICAgICAgICAgICAgYnJlYWs7XHJcbiAgICAgICAgfVxyXG4gICAgfVxyXG4gICAgaWYgKGogPT09IDEpXHJcbiAgICAgICAgdGhyb3cgRXJyb3IoaW52YWxpZEVuY29kaW5nKTtcclxuICAgIHJldHVybiBvZmZzZXQgLSBzdGFydDtcclxufTtcclxuXHJcbi8qKlxyXG4gKiBUZXN0cyBpZiB0aGUgc3BlY2lmaWVkIHN0cmluZyBhcHBlYXJzIHRvIGJlIGJhc2U2NCBlbmNvZGVkLlxyXG4gKiBAcGFyYW0ge3N0cmluZ30gc3RyaW5nIFN0cmluZyB0byB0ZXN0XHJcbiAqIEByZXR1cm5zIHtib29sZWFufSBgdHJ1ZWAgaWYgcHJvYmFibHkgYmFzZTY0IGVuY29kZWQsIG90aGVyd2lzZSBmYWxzZVxyXG4gKi9cclxuYmFzZTY0LnRlc3QgPSBmdW5j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1bCBpZ25vcmUgbmV4dCAqL1xyXG4gICAgICAgIGV4cG9ydHMud3JpdGVGbG9hdExFID0gbGUgPyB3cml0ZUZsb2F0X2YzMl9jcHkgOiB3cml0ZUZsb2F0X2YzMl9yZXY7XHJcbiAgICAgICAgLyogaXN0YW5idWwgaWdub3JlIG5leHQgKi9cclxuICAgICAgICBleHBvcnRzLndyaXRlRmxvYXRCRSA9IGxlID8gd3JpdGVGbG9hdF9mMzJfcmV2IDogd3JpdGVGbG9hdF9mMzJfY3B5O1xyXG5cclxuICAgICAgICBmdW5jdGlvbiByZWFkRmxvYXRfZjMyX2NweShidWYsIHBvcykge1xyXG4gICAgICAgICAgICBmOGJbMF0gPSBidWZbcG9zICAgIF07XHJcbiAgICAgICAgICAgIGY4YlsxXSA9IGJ1Zltwb3MgKyAxXTtcclxuICAgICAgICAgICAgZjhiWzJdID0gYnVmW3BvcyArIDJdO1xyXG4gICAgICAgICAgICBmOGJbM10gPSBidWZbcG9zICsgM107XHJcbiAgICAgICAgICAgIHJldHVybiBmMzJbMF07XHJcbiAgICAgICAgfVxyXG5cclxuICAgICAgICBmdW5jdGlvbiByZWFkRmxvYXRfZjMyX3JldihidWYsIHBvcykge1xyXG4gICAgICAgICAgICBmOGJbM10gPSBidWZbcG9zICAgIF07XHJcbiAgICAgICAgICAgIGY4YlsyXSA9IGJ1Zltwb3MgKyAxXTtcclxuICAgICAgICAgICAgZjhiWzFdID0gYnVmW3BvcyArIDJdO1xyXG4gICAgICAgICAgICBmOGJbMF0gPSBidWZbcG9zICsgM107XHJcbiAgICAgICAgICAgIHJldHVybiBmMzJbMF07XHJcbiAgICAgICAgfVxyXG5cclxuICAgICAgICAvKiBpc3RhbmJ1bCBpZ25vcmUgbmV4dCAqL1xyXG4gICAgICAgIGV4cG9ydHMucmVhZEZsb2F0TEUgPSBsZSA/IHJlYWRGbG9hdF9mMzJfY3B5IDogcmVhZEZsb2F0X2YzMl9yZXY7XHJcbiAgICAgICAgLyogaXN0YW5idWw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IGJ1ZiwgcG9zKTtcclxuICAgICAgICAgICAgZWxzZSB7XHJcbiAgICAgICAgICAgICAgICB2YXIgZXhwb25lbnQgPSBNYXRoLmZsb29yKE1hdGgubG9nKHZhbCkgLyBNYXRoLkxOMiksXHJcbiAgICAgICAgICAgICAgICAgICAgbWFudGlzc2EgPSBNYXRoLnJvdW5kKHZhbCAqIE1hdGgucG93KDIsIC1leHBvbmVudCkgKiA4Mzg4NjA4KSAmIDgzODg2MDc7XHJcbiAgICAgICAgICAgICAgICB3cml0ZVVpbnQoKHNpZ24gPDwgMzEgfCBleHBvbmVudCArIDEyNyA8PCAyMyB8IG1hbnRpc3NhKSA+Pj4gMCwgYnVmLCBwb3MpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgfVxyXG5cclxuICAgICAgICBleHBvcnRzLndyaXRlRmxvYXRMRSA9IHdyaXRlRmxvYXRfaWVlZTc1NC5iaW5kKG51bGwsIHdyaXRlVWludExFKTtcclxuICAgICAgICBleHBvcnRzLndyaXRlRmxvYXRCRSA9IHdyaXRlRmxvYXRfaWVlZTc1NC5iaW5kKG51bGwsIHdyaXRlVWludEJFKTtcclxuXHJcbiAgICAgICAgZnVuY3Rpb24gcmVhZEZsb2F0X2llZWU3NTQocmVhZFVpbnQsIGJ1ZiwgcG9zKSB7XHJcbiAgICAgICAgICAgIHZhciB1aW50ID0gcmVhZFVpbnQoYnVmLCBwb3MpLFxyXG4gICAgICAgICAgICAgICAgc2lnbiA9ICh1aW50ID4+IDMxKSAqIDIgKyAxLFxyXG4gICAgICAgICAgICAgICAgZXhwb25lbnQgPSB1aW50ID4+PiAyMyAmIDI1NSxcclxuICAgICAgICAgICAgICAgIG1hbnRpc3NhID0gdWludCAmIDgzODg2MDc7XHJcbiAgICAgICAgICAgIHJldHVybiBleHBvbmVudCA9PT0gMjU1XHJcbiAgICAgICAgICAgICAgICA/IG1hbnRpc3NhXHJcbiAgICAgICAgICAgICAgICA/IE5hTlxyXG4gICAgICAgICAgICAgICAgOiBzaWduICogSW5maW5pdHlcclxuICAgICAgICAgICAgICAgIDogZXhwb25lbnQgPT09IDAgLy8gZGVub3JtYWxcclxuICAgICAgICAgICAgICAgID8gc2lnbiAqIDEuNDAxMjk4NDY0MzI0ODE3ZS00NSAqIG1hbnRpc3NhXHJcbiAgICAgICAgICAgICAgICA6IHNpZ24gKiBNYXRoLnBvdygyLCBleHBvbmVudCAtIDE1MCkgKiAobWFudGlzc2EgKyA4Mzg4NjA4KTtcclxuICAgICAgICB9XHJcblxyXG4gICAgICAgIGV4cG9ydHMucmVhZEZsb2F0TEUgPSByZWFkRmxvYXRfaWVlZTc1NC5iaW5kKG51bGwsIHJlYWRVaW50TEUpO1xyXG4gICAgICAgIGV4cG9ydHMucmVhZEZsb2F0QkUgPSByZWFkRmxvYXRfaWVlZTc1NC5iaW5kKG51bGwsIHJlYWRVaW50QkUpO1xyXG5cclxuICAgIH0pKCk7XHJcblxyXG4gICAgLy8gZG91YmxlOiB0eXBlZCBhcnJheVxyXG4gICAgaWYgKHR5cGVvZiBGbG9hdDY0QXJyYXkgIT09IFwidW5kZWZpbmVkXCIpIChmdW5jdGlvbigpIHtcclxuXHJcbiAgICAgICAgdmFyIGY2NCA9IG5ldyBGbG9hdDY0QXJyYXkoWy0wXSksXHJcbiAgICAgICAgICAgIGY4YiA9IG5ldyBVaW50OEFycmF5KGY2NC5idWZmZXIpLFxyXG4gICAgICAgICAgICBsZSAgPSBmOGJbN10gPT09IDEyODtcclxuXHJcbiAgICAgICAgZnVuY3Rpb24gd3JpdGVEb3VibGVfZjY0X2NweSh2YWwsIGJ1ZiwgcG9zKSB7XHJcbiAgICAgICAgICAgIGY2NFswXSA9IHZhbDtcclxuICAgICAgICAgICAgYnVmW3BvcyAgICBdID0gZjhiWzBdO1xyXG4gICAgICAgICAgICBidWZbcG9zICsgMV0gPSBmOGJbMV07XHJcbiAgICAgICAgICAgIGJ1Zltwb3MgKyAyXSA9IGY4YlsyXTtcclxuICAgICAgICAgICAgYnVmW3BvcyArIDNdID0gZjhiWzNdO1xyXG4gICAgICAgICAgICBidWZbcG9zICsgNF0gPSBmOGJbNF07XHJcbiAgICAgICAgICAgIGJ1Zltwb3MgKyA1XSA9IGY4Yls1XTtcclxuICAgICAgICAgICAgYnVmW3BvcyArIDZdID0gZjhiWzZdO1xyXG4gICAgICAgICAgICBidWZbcG9zICsgN10gPSBmOGJbN107XHJcbiAgICAgICAgfVxyXG5cclxuICAgICAgICBmdW5jdGlvbiB3cml0ZURvdWJsZV9mNjRfcmV2KHZhbCwgYnVmLCBwb3MpIHtcclxuICAgICAgICAgICAgZjY0WzBdID0gdmFsO1xyXG4gICAgICAgICAgICBidWZbcG9zICAgIF0gPSBmOGJbN107XHJcbiAgICAgICAgICAgIGJ1Zltwb3MgKyAxXSA9IGY4Yls2XTtcclxuICAgICAgICAgICAgYnVmW3BvcyArIDJdID0gZjhiWzVdO1xyXG4gICAgICAgICAgICBidWZbcG9zICsgM10gPSBmOGJbNF07XHJcbiAgICAgICAgICAgIGJ1Zltwb3MgKyA0XSA9IGY4YlszXTtcclxuICAgICAgICAgICAgYnVmW3BvcyArIDVdID0gZjhiWzJdO1xyXG4gICAgICAgICAgICBidWZbcG9zICsgNl0gPSBmOGJbMV07XHJcbiAgICAgICAgICAgIGJ1Zltwb3MgKyA3XSA9IGY4YlswXTtcclxuICAgICAgICB9XHJcblxyXG4gICAgICAgIC8qIGlzdGFuYnVsIGlnbm9yZSBuZXh0ICovXHJcbiAgICAgICAgZXhwb3J0cy53cml0ZURvdWJsZUxFID0gbGUgPyB3cml0ZURvdWJsZV9mNjRfY3B5IDogd3JpdGVEb3VibGVfZjY0X3JldjtcclxuICAgICAgICAvKiBpc3RhbmJ1bCBpZ25vcmUgbmV4dCAqL1xyXG4gICAgICAgIGV4cG9ydHMud3JpdGVEb3VibGVCRSA9IGxlID8gd3JpdGVEb3VibGVfZjY0X3JldiA6IHdyaXRlRG91YmxlX2Y2NF9jcHk7XHJcblxyXG4gICAgICAgIGZ1bmN0aW9uIHJlYWREb3VibGVfZjY0X2NweShidWYsIHBvcykge1xyXG4gICAgICAgICAgICBmOGJbMF0gPSBidWZbcG9zICAgIF07XHJcbiAgICAgICAgICAgIGY4YlsxXSA9IGJ1Zltwb3MgKyAxXTtcclxuICAgICAgICAgICAgZjhiWzJdID0gYnVmW3BvcyArIDJdO1xyXG4gICAgICAgICAgICBmOGJbM10gPSBidWZbcG9zICsgM107XHJcbiAgICAgICAgICAgIGY4Yls0XSA9IGJ1Zltwb3MgKyA0XTtcclxuICAgICAgICAgICAgZjhiWzVdID0gYnVmW3BvcyArIDVdO1xyXG4gICAgICAgICAgICBmOGJbNl0gPSBidWZbcG9zICsgNl07XHJcbiAgICAgICAgICAgIGY4Yls3XSA9IGJ1Zltwb3MgKyA3XTtcclxuICAgICAgICAgICAgcmV0dXJuIGY2NFswXTtcclxuICAgICAgICB9XHJcblxyXG4gICAgICAgIGZ1bmN0aW9uIHJlYWREb3VibGVfZjY0X3JldihidWYsIHBvcykge1xyXG4gICAgICAgICAgICBmOGJbN10gPSBidWZbcG9zICAgIF07XHJcbiAgICAgICAgICAgIGY4Yls2XSA9IGJ1Zltwb3MgKyAxXTtcclxuICAgICAgICAgICAgZjhiWzVdID0gYnVmW3BvcyArIDJdO1xyXG4gICAgICAgICAgICBmOGJbNF0gPSBidWZbcG9zICsgM107XHJcbiAgICAgICAgICAgIGY4YlszXSA9IGJ1Zltwb3MgKyA0XTtcclxuICAgICAgICAgICAgZjhiWzJdID0gYnVmW3BvcyArIDVdO1xyXG4gICAgICAgICAgICBmOGJbMV0gPSBidWZbcG9zICsgNl07XHJcbiAgICAgICAgICAgIGY4YlswXSA9IGJ1Zltwb3MgKyA3XTtcclxuICAgICAgICAgICAgcmV0dXJuIGY2NFswXTtcclxuICAgICAgICB9XHJcblxyXG4gICAgICAgIC8qIGlzdGFuYnVsIGlnbm9yZSBuZXh0ICovXHJcbiAgICAgICAgZXhwb3J0cy5yZWFkRG91YmxlTEUg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AgICAgICAgICAgd3JpdGVVaW50KDAsIGJ1ZiwgcG9zICsgb2ZmMCk7XHJcbiAgICAgICAgICAgICAgICB3cml0ZVVpbnQoKHNpZ24gPDwgMzEgfCAyMTQ2NDM1MDcyKSA+Pj4gMCwgYnVmLCBwb3MgKyBvZmYxKTtcclxuICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgIHZhciBtYW50aXNzYTtcclxuICAgICAgICAgICAgICAgIGlmICh2YWwgPCAyLjIyNTA3Mzg1ODUwNzIwMTRlLTMwOCkgeyAvLyBkZW5vcm1hbFxyXG4gICAgICAgICAgICAgICAgICAgIG1hbnRpc3NhID0gdmFsIC8gNWUtMzI0O1xyXG4gICAgICAgICAgICAgICAgICAgIHdyaXRlVWludChtYW50aXNzYSA+Pj4gMCwgYnVmLCBwb3MgKyBvZmYwKTtcclxuICAgICAgICAgICAgICAgICAgICB3cml0ZVVpbnQoKHNpZ24gPDwgMzEgfCBtYW50aXNzYSAvIDQyOTQ5NjcyOTYpID4+PiAwLCBidWYsIHBvcyArIG9mZjEpO1xyXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICB2YXIgZXhwb25lbnQgPSBNYXRoLmZsb29yKE1hdGgubG9nKHZhbCkgLyBNYXRoLkxOMik7XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKGV4cG9uZW50ID09PSAxMDI0KVxyXG4gICAgICAgICAgICAgICAgICAgICAgICBleHBvbmVudCA9IDEwMjM7XHJcbiAgICAgICAgICAgICAgICAgICAgbWFudGlzc2EgPSB2YWwgKiBNYXRoLnBvdygyLCAtZXhwb25lbnQpO1xyXG4gICAgICAgICAgICAgICAgICAgIHdyaXRlVWludChtYW50aXNzYSAqIDQ1MDM1OTk2MjczNzA0OTYgPj4+IDAsIGJ1ZiwgcG9zICsgb2ZmMCk7XHJcbiAgICAgICAgICAgICAgICAgICAgd3JpdGVVaW50KChzaWduIDw8IDMxIHwgZXhwb25lbnQgKyAxMDIzIDw8IDIwIHwgbWFudGlzc2EgKiAxMDQ4NTc2ICYgMTA0ODU3NSkgPj4+IDAsIGJ1ZiwgcG9zICsgb2ZmMSk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9XHJcblxyXG4gICAgICAgIGV4cG9ydHMud3JpdGVEb3VibGVMRSA9IHdyaXRlRG91YmxlX2llZWU3NTQuYmluZChudWxsLCB3cml0ZVVpbnRMRSwgMCwgNCk7XHJcbiAgICAgICAgZXhwb3J0cy53cml0ZURvdWJsZUJFID0gd3JpdGVEb3VibGVfaWVlZTc1NC5iaW5kKG51bGwsIHdyaXRlVWludEJFLCA0LCAwKTtcclxuXHJcbiAgICAgICAgZnVuY3Rpb24gcmVhZERvdWJsZV9pZWVlNzU0KHJlYWRVaW50LCBvZmYwLCBvZmYxLCBidWYsIHBvcykge1xyXG4gICAgICAgICAgICB2YXIgbG8gPSByZWFkVWludChidWYsIHBvcyArIG9mZjApLFxyXG4gICAgICAgICAgICAgICAgaGkgPSByZWFkVWludChidWYsIHBvcyArIG9mZjEpO1xyXG4gICAgICAgICAgICB2YXIgc2lnbiA9IChoaSA+PiAzMSkgKiAyICsgMSxcclxuICAgICAgICAgICAgICAgIGV4cG9uZW50ID0gaGkgPj4+IDIwICYgMjA0NyxcclxuICAgICAgICAgICAgICAgIG1hbnRpc3NhID0gNDI5NDk2NzI5NiAqIChoaSAmIDEwNDg1NzUpICsgbG87XHJcbiAgICAgICAgICAgIHJldHVybiBleHBvbmVudCA9PT0gMjA0N1xyXG4gICAgICAgICAgICAgICAgPyBtYW50aXNzYVxyXG4gICAgICAgICAgICAgICAgPyBOYU5cclxuICAgICAgICAgICAgICAgIDogc2lnbiAqIEluZmluaXR5XHJcbiAgICAgICAgICAgICAgICA6IGV4cG9uZW50ID09PSAwIC8vIGRlbm9ybWFsXHJcbiAgICAgICAgICAgICAgICA/IHNpZ24gKiA1ZS0zMjQgKiBtYW50a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bmQgLSBzdGFydDtcclxuICAgIGlmIChsZW4gPCAxKVxyXG4gICAgICAgIHJldHVybiBcIlwiO1xyXG4gICAgdmFyIHBhcnRzID0gbnVsbCxcclxuICAgICAgICBjaHVuayA9IFtdLFxyXG4gICAgICAgIGkgPSAwLCAvLyBjaGFyIG9mZnNldFxyXG4gICAgICAgIHQ7ICAgICAvLyB0ZW1wb3JhcnlcclxuICAgIHdoaWxlIChzdGFydCA8IGVuZCkge1xyXG4gICAgICAgIHQgPSBidWZmZXJbc3RhcnQrK107XHJcbiAgICAgICAgaWYgKHQgPCAxMjgpXHJcbiAgICAgICAgICAgIGNodW5rW2krK10gPSB0O1xyXG4gICAgICAgIGVsc2UgaWYgKHQgPiAxOTEgJiYgdCA8IDIyNClcclxuICAgICAgICAgICAgY2h1bmtbaSsrXSA9ICh0ICYgMzEpIDw8IDYgfCBidWZmZXJbc3RhcnQrK10gJiA2MztcclxuICAgICAgICBlbHNlIGlmICh0ID4gMjM5ICYmIHQgPCAzNjUpIHtcclxuICAgICAgICAgICAgdCA9ICgodCAmIDcpIDw8IDE4IHwgKGJ1ZmZlcltzdGFydCsrXSAmIDYzKSA8PCAxMiB8IChidWZmZXJbc3RhcnQrK10gJiA2MykgPDwgNiB8IGJ1ZmZlcltzdGFydCsrXSAmIDYzKSAtIDB4MTAwMDA7XHJcbiAgICAgICAgICAgIGNodW5rW2krK10gPSAweEQ4MDAgKyAodCA+PiAxMCk7XHJcbiAgICAgICAgICAgIGNodW5rW2krK10gPSAweERDMDAgKyAodCAmIDEwMjMpO1xyXG4gICAgICAgIH0gZWxzZVxyXG4gICAgICAgICAgICBjaHVua1tpKytdID0gKHQgJiAxNSkgPDwgMTIgfCAoYnVmZmVyW3N0YXJ0KytdICYgNjMpIDw8IDYgfCBidWZmZXJbc3RhcnQrK10gJiA2MztcclxuICAgICAgICBpZiAoaSA+IDgxOTEpIHtcclxuICAgICAgICAgICAgKHBhcnRzIHx8IChwYXJ0cyA9IFtdKSkucHVzaCh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4KSB7XHJcbiAgICAgICAgICAgIGJ1ZmZlcltvZmZzZXQrK10gPSBjMTtcclxuICAgICAgICB9IGVsc2UgaWYgKGMxIDwgMjA0OCkge1xyXG4gICAgICAgICAgICBidWZmZXJbb2Zmc2V0KytdID0gYzEgPj4gNiAgICAgICB8IDE5MjtcclxuICAgICAgICAgICAgYnVmZmVyW29mZnNldCsrXSA9IGMxICAgICAgICYgNjMgfCAxMjg7XHJcbiAgICAgICAgfSBlbHNlIGlmICgoYzEgJiAweEZDMDApID09PSAweEQ4MDAgJiYgKChjMiA9IHN0cmluZy5jaGFyQ29kZUF0KGkgKyAxKSkgJiAweEZDMDApID09PSAweERDMDApIHtcclxuICAgICAgICAgICAgYzEgPSAweDEwMDAwICsgKChjMSAmIDB4MDNGRikgPDwgMTApICsgKGMyICYgMHgwM0ZGKTtcclxuICAgICAgICAgICAgKytpO1xyXG4gICAgICAgICAgICBidWZmZXJbb2Zmc2V0KytdID0gYzEgPj4gMTggICAgICB8IDI0MDtcclxuICAgICAgICAgICAgYnVmZmVyW29mZnNldCsrXSA9IGMxID4+IDEyICYgNjMgfCAxMjg7XHJcbiAgICAgICAgICAgIGJ1ZmZlcltvZmZzZXQrK10gPSBjMSA+PiA2ICAmIDYzIHwgMTI4O1xyXG4gICAgICAgICAgICBidWZmZXJbb2Zmc2V0KytdID0gYzEgICAgICAgJiA2MyB8IDEyODtcclxuICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICBidWZmZXJbb2Zmc2V0KytdID0gYzEgPj4gMTIgICAgICB8IDIyNDtcclxuICAgICAgICAgICAgYnVmZmVyW29mZnNldCsrXSA9IGMxID4+IDYgICYgNjMgfCAxMjg7XHJcbiAgICAgICAgICAgIGJ1ZmZlcltvZmZzZXQrK10gPSBjMSAgICAgICAmIDYzIHwgMTI4O1xyXG4gICAgICAgIH1cclxuICAgIH1cclxuICAgIHJldHVybiBvZmZzZXQgLSBzdGFydDtcclxufTtcclxuIiwiJ3VzZSBzdHJpY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lZW4uaW5kZXhPZihkZXNjLnZhbHVlKSA8IDApIHtcbiAgICAgIGlmIChpc051bGwocmVjdXJzZVRpbWVzKSkge1xuICAgICAgICBzdHIgPSBmb3JtYXRWYWx1ZShjdHgsIGRlc2MudmFsdWUsIG51bGwpO1xuICAgICAgfSBlbHNlIHtcbiAgICAgICAgc3RyID0gZm9ybWF0VmFsdWUoY3R4LCBkZXNjLnZhbHVlLCByZWN1cnNlVGltZXMgLSAxKTtcbiAgICAgIH1cbiAgICAgIGlmIChzdHIuaW5kZXhPZignXFxuJykgPiAtMSkge1xuICAgICAgICBpZiAoYXJyYXkpIHtcbiAgICAgICAgICBzdHIgPSBzdHIuc3BsaXQoJ1xcbicpLm1hcChmdW5jdGlvbihsaW5lKSB7XG4gICAgICAgICAgICByZXR1cm4gJyAgJyArIGxpbmU7XG4gICAgICAgICAgfSkuam9pbignXFxuJykuc3Vic3RyKDIpO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgIHN0ciA9ICdcXG4nICsgc3RyLnNwbGl0KCdcXG4nKS5tYXAoZnVuY3Rpb24obGluZSkge1xuICAgICAgICAgICAgcmV0dXJuICcgICAnICsgbGluZTtcbiAgICAgICAgICB9KS5qb2luKCdcXG4nKTtcbiAgICAgICAgfVxuICAgICAgfVxuICAgIH0gZWxzZSB7XG4gICAgICBzdHIgPSBjdHguc3R5bGl6ZSgnW0NpcmN1bGFyXScsICdzcGVjaWFsJyk7XG4gICAgfVxuICB9XG4gIGlmIChpc1VuZGVmaW5lZChuYW1lKSkge1xuICAgIGlmIChhcnJheSAmJiBrZXkubWF0Y2goL15cXGQrJC8pKSB7XG4gICAgICByZXR1cm4gc3RyO1xuICAgIH1cbiAgICBuYW1lID0gSlNPTi5zdHJpbmdpZnkoJycgKyBrZXkpO1xuICAgIGlmIChuYW1lLm1hdGNoKC9eXCIoW2EtekEtWl9dW2EtekEtWl8wLTldKilcIiQvKSkge1xuICAgICAgbmFtZSA9IG5hbWUuc3Vic3RyKDEs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iAgICAgICAgICAgICAgICBkZWZhdWx0OiByZXR1cm4gYXJyWzBdICsgKGFyclsxXSArIGFyclsyXSAqIEJBU0UpICogQkFTRTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH1cclxuICAgICAgICByZXR1cm4gYXJyO1xyXG4gICAgfVxyXG5cclxuICAgIGZ1bmN0aW9uIHRyaW0odikge1xyXG4gICAgICAgIHZhciBpID0gdi5sZW5ndGg7XHJcbiAgICAgICAgd2hpbGUgKHZbLS1pXSA9PT0gMCk7XHJcbiAgICAgICAgdi5sZW5ndGggPSBpICsgMTtcclxuICAgIH1cclxuXHJcbiAgICBmdW5jdGlvbiBjcmVhdGVBcnJheShsZW5ndGgpIHsgLy8gZnVuY3Rpb24gc2hhbWVsZXNzbHkgc3RvbGVuIGZyb20gWWFmZmxlJ3MgbGlicmFyeSBodHRwczovL2dpdGh1Yi5jb20vWWFmZmxlL0JpZ0ludGVnZXJcclxuICAgICAgICB2YXIgeCA9IG5ldyBBcnJheShsZW5ndGgpO1xyXG4gICAgICAgIHZhciBpID0gLTE7XHJcbiAgICAgICAgd2hpbGUgKCsraSA8IGxlbmd0aCkge1xyXG4gICAgICAgICAgICB4W2ldID0gMDtcclxuICAgICAgICB9XHJcbiAgICAgICAgcmV0dXJuIHg7XHJcbiAgICB9XHJcblxyXG4gICAgZnVuY3Rpb24gdHJ1bmNhdGUobikge1xyXG4gICAgICAgIGlmIChuID4gMCkgcmV0dXJuIE1hdGguZmxvb3Iobik7XHJcbiAgICAgICAgcmV0dXJuIE1hdGguY2VpbChuKTtcclxuICAgIH1cclxuXHJcbiAgICBmdW5jdGlvbiBhZGQoYSwgYikgeyAvLyBhc3N1bWVzIGEgYW5kIGIgYXJlIGFycmF5cyB3aXRoIGEubGVuZ3RoID49IGIubGVuZ3RoXHJcbiAgICAgICAgdmFyIGxfYSA9IGEubGVuZ3RoLFxyXG4gICAgICAgICAgICBsX2IgPSBiLmxlbmd0aCxcclxuICAgICAgICAgICAgciA9IG5ldyBBcnJheShsX2EpLFxyXG4gICAgICAgICAgICBjYXJyeSA9IDAsXHJcbiAgICAgICAgICAgIGJhc2UgPSBCQVNFLFxyXG4gICAgICAgICAgICBzdW0sIGk7XHJcbiAgICAgICAgZm9yIChpID0gMDsgaSA8IGxfYjsgaSsrKSB7XHJcbiAgICAgICAgICAgIHN1bSA9IGFbaV0gKyBiW2ldICsgY2Fycnk7XHJcbiAgICAgICAgICAgIGNhcnJ5ID0gc3VtID49IGJhc2UgPyAxIDogMDtcclxuICAgICAgICAgICAgcltpXSA9IHN1bSAtIGNhcnJ5ICogYmFzZTtcclxuICAgICAgICB9XHJcbiAgICAgICAgd2hpbGUgKGkgPCBsX2EpIHtcclxuICAgICAgICAgICAgc3VtID0gYVtpXSArIGNhcnJ5O1xyXG4gICAgICAgICAgICBjYXJyeSA9IHN1bSA9PT0gYmFzZSA/IDEgOiAwO1xyXG4gICAgICAgICAgICByW2krK10gPSBzdW0gLSBjYXJyeSAqIGJhc2U7XHJcbiAgICAgICAgfVxyXG4gICAgICAgIGlmIChjYXJyeSA+IDApIHIucHVzaChjYXJyeSk7XHJcbiAgICAgICAgcmV0dXJuIHI7XHJcbiAgICB9XHJcblxyXG4gICAgZnVuY3Rpb24gYWRkQW55KGEsIGIpIHtcclxuICAgICAgICBpZiAoYS5sZW5ndGggPj0gYi5sZW5ndGgpIHJldHVybiBhZGQoYSwgYik7XHJcbiAgICAgICAgcmV0dXJuIGFkZChiLCBhKTtcclxuICAgIH1cclxuXHJcbiAgICBmdW5jdGlvbiBhZGRTbWFsbChhLCBjYXJyeSkgeyAvLyBhc3N1bWVzIGEgaXMgYXJyYXksIGNhcnJ5IGlzIG51bWJlciB3aXRoIDAgPD0gY2FycnkgPCBNQVhfSU5UXHJcbiAgICAgICAgdmFyIGwgPSBhLmxlbmd0aCxcclxuICAgICAgICAgICAgciA9IG5ldyBBcnJheShsKSxcclxuICAgICAgICAgICAgYmFzZSA9IEJBU0UsXHJcbiAgICAgICAgICAg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CBhID49IGJcclxuICAgICAgICB2YXIgYV9sID0gYS5sZW5ndGgsXHJcbiAgICAgICAgICAgIGJfbCA9IGIubGVuZ3RoLFxyXG4gICAgICAgICAgICByID0gbmV3IEFycmF5KGFfbCksXHJcbiAgICAgICAgICAgIGJvcnJvdyA9IDAsXHJcbiAgICAgICAgICAgIGJhc2UgPSBCQVNFLFxyXG4gICAgICAgICAgICBpLCBkaWZmZXJlbmNlO1xyXG4gICAgICAgIGZvciAoaSA9IDA7IGkgPCBiX2w7IGkrKykge1xyXG4gICAgICAgICAgICBkaWZmZXJlbmNlID0gYVtpXSAtIGJvcnJvdyAtIGJbaV07XHJcbiAgICAgICAgICAgIGlmIChkaWZmZXJlbmNlIDwgMCkge1xyXG4gICAgICAgICAgICAgICAgZGlmZmVyZW5jZSArPSBiYXNlO1xyXG4gICAgICAgICAgICAgICAgYm9ycm93ID0gMTtcclxuICAgICAgICAgICAgfSBlbHNlIGJvcnJvdyA9IDA7XHJcbiAgICAgICAgICAgIHJbaV0gPSBkaWZmZXJlbmNlO1xyXG4gICAgICAgIH1cclxuICAgICAgICBmb3IgKGkgPSBiX2w7IGkgPCBhX2w7IGkrKykge1xyXG4gICAgICAgICAgICBkaWZmZXJlbmNlID0gYVtpXSAtIGJvcnJvdztcclxuICAgICAgICAgICAgaWYgKGRpZmZlcmVuY2UgPCAwKSBkaWZmZXJlbmNlICs9IGJhc2U7XHJcbiAgICAgICAgICAgIGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgcltpKytdID0gZGlmZmVyZW5jZTtcclxuICAgICAgICAgICAgICAgIGJyZWFrO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHJbaV0gPSBkaWZmZXJlbmNlO1xyXG4gICAgICAgIH1cclxuICAgICAgICBmb3IgKDsgaSA8IGFfbDsgaSsrKSB7XHJcbiAgICAgICAgICAgIHJbaV0gPSBhW2ldO1xyXG4gICAgICAgIH1cclxuICAgICAgICB0cmltKHIpO1xyXG4gICAgICAgIHJldHVybiByO1xyXG4gICAgfVxyXG5cclxuICAgIGZ1bmN0aW9uIHN1YnRyYWN0QW55KGEsIGIsIHNpZ24pIHtcclxuICAgICAgICB2YXIgdmFsdWU7XHJcbiAgICAgICAgaWYgKGNvbXBhcmVBYnMoYSwgYikgPj0gMCkge1xyXG4gICAgICAgICAgICB2YWx1ZSA9IHN1YnRyYWN0KGEsIGIpO1xyXG4gICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgIHZhbHVlID0gc3VidHJhY3QoYiwgYSk7XHJcbiAgICAgICAgICAgIHNpZ24gPSAhc2lnbjtcclxuICAgICAgICB9XHJcbiAgICAgICAgdmFsdWUgPSBhcnJheVRvU21hbGwodmFsdWUpO1xyXG4gICAgICAgIGlmICh0eXBlb2YgdmFsdWUgPT09IFwibnVtYmVyXCIpIHtcclxuICAgICAgICAgICAgaWYgKHNpZ24pIHZhbHVlID0gLXZhbHVlO1xyXG4gICAgICAgICAgICByZXR1cm4gbmV3IFNtYWxsSW50ZWdlcih2YWx1ZSk7XHJcbiAgICAgICAgfVxyXG4gICAgICAgIHJldHVybiBuZXcgQmlnSW50ZWdlcih2YWx1ZSwgc2lnbik7XHJcbiAgICB9XHJcblxyXG4gICAgZnVuY3Rpb24gc3VidHJhY3RTbWFsbChhLCBiLCBzaWduKSB7IC8vIGFzc3VtZXMgYSBpcyBhcnJheSwgYiBpcyBudW1iZXIgd2l0aCAwIDw9IGIgPCBNQVhfSU5UXHJcbiAgICAgICAgdmFyIGwgPSBhLmxlbmd0aCxcclxuICAgICAgICAgICAgciA9IG5ldyBBcnJheShsKSxcclxuICAgICAgICAgICAgY2FycnkgPSAtYixcclxuICAgICAgICAgICAgYmFzZSA9IEJBU0UsXHJcbiAgICAgICAgICAgIGksIGRpZmZlcmVuY2U7XHJcbiAgICAgICAgZm9yIChpID0gMDsgaSA8IGw7IGkrKykge1xyXG4gICAgICAgICAgICBkaWZmZXJlbmNlID0gYVtpXSArIGNhcnJ5O1xyXG4gICAgICAgICAgICBjYXJyeSA9IE1hdGguZmxvb3IoZGlmZmVyZW5jZSAvIGJhc2UpO1xyXG4gICAgICAgICAgICBkaWZmZXJlbmNlICU9IGJhc2U7XHJcbiAgICAgICAgICAgIHJbaV0gPSBkaWZmZXJlbmNlIDwgMCA/IGRpZmZlcmVuY2UgKyBiYXNlIDogZGlmZmVyZW5jZTtcclxuICAgICAgICB9XHJcbiAgICAgICAgciA9IGFycmF5VG9TbWFsbChyKTtcclxuICAgICAgICBpZiAodHlwZW9mIHIgPT09IFwibnVtYmVyXCIpIHtcclxuICAgICAgICAgICAgaWYgKHNpZ24pIHIgPSAtcjtcclxuICAgICAgICAgICAgcmV0dXJuIG5ldyBTbWFsbEludGVnZXIocik7XHJcbiAgICAgICAgfSByZXR1cm4gbmV3IEJpZ0ludGVnZXIociwgc2lnbik7XHJcbiAgICB9XHJcblxyXG4gICAgQmlnSW50ZWdlci5wcm90b3R5cGUuc3VidHJhY3QgPSBmdW5jdGlvbiAodikge1xyXG4gICAgICAgIHZhciBuID0gcGFyc2VWYWx1ZSh2KTtcclxuICAgICAgICBpZiAodGhpcy5zaWduICE9PSBuLnNpZ24pIHtcclxuICAgICAgICAgICAgcmV0dXJuIHRoaXMuYWRkKG4ubmVnYXRlKCkpO1xyXG4gICAgICAgIH1cclxuICAgICAgICB2YXIgYSA9IHRoaXMudmFsdWUsIGIgPSBuLnZhbHVlO1xyXG4gICAgICAgIGlmIChuLmlzU21hbGwpXHJcbiAgICAgICAgICAgIHJldHVybiBzdWJ0cmFjdFNtYWxsKGEsIE1hdGguYWJzKGIpLCB0aGlzLnNpZ24pO1xyXG4gICAgICAgIHJldHVybiBzdWJ0cmFjdEFueShhLCBiLCB0aGlzLnNpZ24pO1xyXG4gICAgfTtcclxuICAgIEJpZ0ludGVnZXIucHJvdG90eXBlLm1pbnVzID0gQmlnSW50ZWdlci5wcm90b3R5cGUuc3VidHJhY3Q7XHJcblxyXG4gICAgU21hbGxJbnRlZ2VyLnByb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G4gICAgICAgICAgICBwcm9kdWN0LCBjYXJyeSwgaSwgYV9pLCBiX2o7XHJcbiAgICAgICAgZm9yIChpID0gMDsgaSA8IGFfbDsgKytpKSB7XHJcbiAgICAgICAgICAgIGFfaSA9IGFbaV07XHJcbiAgICAgICAgICAgIGZvciAodmFyIGogPSAwOyBqIDwgYl9sOyArK2opIHtcclxuICAgICAgICAgICAgICAgIGJfaiA9IGJbal07XHJcbiAgICAgICAgICAgICAgICBwcm9kdWN0ID0gYV9pICogYl9qICsgcltpICsgal07XHJcbiAgICAgICAgICAgICAgICBjYXJyeSA9IE1hdGguZmxvb3IocHJvZHVjdCAvIGJhc2UpO1xyXG4gICAgICAgICAgICAgICAgcltpICsgal0gPSBwcm9kdWN0IC0gY2FycnkgKiBiYXNlO1xyXG4gICAgICAgICAgICAgICAgcltpICsgaiArIDFdICs9IGNhcnJ5O1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgfVxyXG4gICAgICAgIHRyaW0ocik7XHJcbiAgICAgICAgcmV0dXJuIHI7XHJcbiAgICB9XHJcblxyXG4gICAgZnVuY3Rpb24gbXVsdGlwbHlTbWFsbChhLCBiKSB7IC8vIGFzc3VtZXMgYSBpcyBhcnJheSwgYiBpcyBudW1iZXIgd2l0aCB8YnwgPCBCQVNFXHJcbiAgICAgICAgdmFyIGwgPSBhLmxlbmd0aCxcclxuICAgICAgICAgICAgciA9IG5ldyBBcnJheShsKSxcclxuICAgICAgICAgICAgYmFzZSA9IEJBU0UsXHJcbiAgICAgICAgICAgIGNhcnJ5ID0gMCxcclxuICAgICAgICAgICAgcHJvZHVjdCwgaTtcclxuICAgICAgICBmb3IgKGkgPSAwOyBpIDwgbDsgaSsrKSB7XHJcbiAgICAgICAgICAgIHByb2R1Y3QgPSBhW2ldICogYiArIGNhcnJ5O1xyXG4gICAgICAgICAgICBjYXJyeSA9IE1hdGguZmxvb3IocHJvZHVjdCAvIGJhc2UpO1xyXG4gICAgICAgICAgICByW2ldID0gcHJvZHVjdCAtIGNhcnJ5ICogYmFzZTtcclxuICAgICAgICB9XHJcbiAgICAgICAgd2hpbGUgKGNhcnJ5ID4gMCkge1xyXG4gICAgICAgICAgICByW2krK10gPSBjYXJyeSAlIGJhc2U7XHJcbiAgICAgICAgICAgIGNhcnJ5ID0gTWF0aC5mbG9vcihjYXJyeSAvIGJhc2UpO1xyXG4gICAgICAgIH1cclxuICAgICAgICByZXR1cm4gcjtcclxuICAgIH1cclxuXHJcbiAgICBmdW5jdGlvbiBzaGlmdExlZnQoeCwgbikge1xyXG4gICAgICAgIHZhciByID0gW107XHJcbiAgICAgICAgd2hpbGUgKG4tLSA+IDApIHIucHVzaCgwKTtcclxuICAgICAgICByZXR1cm4gci5jb25jYXQoeCk7XHJcbiAgICB9XHJcblxyXG4gICAgZnVuY3Rpb24gbXVsdGlwbHlLYXJhdHN1YmEoeCwgeSkge1xyXG4gICAgICAgIHZhciBuID0gTWF0aC5tYXgoeC5sZW5ndGgsIHkubGVuZ3RoKTtcclxuXHJcbiAgICAgICAgaWYgKG4gPD0gMzApIHJldHVybiBtdWx0aXBseUxvbmcoeCwgeSk7XHJcbiAgICAgICAgbiA9IE1hdGguY2VpbChuIC8gMik7XHJcblxyXG4gICAgICAgIHZhciBiID0geC5zbGljZShuKSxcclxuICAgICAgICAgICAgYSA9IHguc2xpY2UoMCwgbiksXHJcbiAgICAgICAgICAgIGQgPSB5LnNsaWNlKG4pLFxyXG4gICAgICAgICAgICBjID0geS5zbGljZSgwLCBuKTtcclxuXHJcbiAgICAgICAgdmFyIGFjID0gbXVsdGlwbHlLYXJhdHN1YmEoYSwgYyksXHJcbiAgICAgICAgICAgIGJkID0gbXVsdGlwbHlLYXJhdHN1YmEoYiwgZCksXHJcbiAgICAgICAgICAgIGFiY2QgPSBtdWx0aXBseUthcmF0c3ViYShhZGRBbnkoYSwgYiksIGFkZEFueShjLCBkKSk7XHJcblxyXG4gICAgICAgIHZhciBwcm9kdWN0ID0gYWRkQW55KGFkZEFueShhY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ldHVybiBuZXcgTmF0aXZlQmlnSW50KHRoaXMudmFsdWUgKiBwYXJzZVZhbHVlKHYpLnZhbHVlKTtcclxuICAgIH1cclxuICAgIE5hdGl2ZUJpZ0ludC5wcm90b3R5cGUudGltZXMgPSBOYXRpdmVCaWdJbnQucHJvdG90eXBlLm11bHRpcGx5O1xyXG5cclxuICAgIGZ1bmN0aW9uIHNxdWFyZShhKSB7XHJcbiAgICAgICAgLy9jb25zb2xlLmFzc2VydCgyICogQkFTRSAqIEJBU0UgPCBNQVhfSU5UKTtcclxuICAgICAgICB2YXIgbCA9IGEubGVuZ3RoLFxyXG4gICAgICAgICAgICByID0gY3JlYXRlQXJyYXkobCArIGwpLFxyXG4gICAgICAgICAgICBiYXNlID0gQkFTRSxcclxuICAgICAgICAgICAgcHJvZHVjdCwgY2FycnksIGksIGFfaSwgYV9qO1xyXG4gICAgICAgIGZvciAoaSA9IDA7IGkgPCBsOyBpKyspIHtcclxuICAgICAgICAgICAgYV9pID0gYVtpXTtcclxuICAgICAgICAgICAgY2FycnkgPSAwIC0gYV9pICogYV9pO1xyXG4gICAgICAgICAgICBmb3IgKHZhciBqID0gaTsgaiA8IGw7IGorKykge1xyXG4gICAgICAgICAgICAgICAgYV9qID0gYVtqXTtcclxuICAgICAgICAgICAgICAgIHByb2R1Y3QgPSAyICogKGFfaSAqIGFfaikgKyByW2kgKyBqXSArIGNhcnJ5O1xyXG4gICAgICAgICAgICAgICAgY2FycnkgPSBNYXRoLmZsb29yKHByb2R1Y3QgLyBiYXNlKTtcclxuICAgICAgICAgICAgICAgIHJbaSArIGpdID0gcHJvZHVjdCAtIGNhcnJ5ICogYmFzZTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICByW2kgKyBsXSA9IGNhcnJ5O1xyXG4gICAgICAgIH1cclxuICAgICAgICB0cmltKHIpO1xyXG4gICAgICAgIHJldHVybiByO1xyXG4gICAgfVxyXG5cclxuICAgIEJpZ0ludGVnZXIucHJvdG90eXBlLnNxd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AgICAgLy8gbm9ybWFsaXphdGlvblxyXG4gICAgICAgICAgICBsYW1iZGEgPSBNYXRoLmNlaWwoYmFzZSAvICgyICogZGl2aXNvck1vc3RTaWduaWZpY2FudERpZ2l0KSksXHJcbiAgICAgICAgICAgIHJlbWFpbmRlciA9IG11bHRpcGx5U21hbGwoYSwgbGFtYmRhKSxcclxuICAgICAgICAgICAgZGl2aXNvciA9IG11bHRpcGx5U21hbGwoYiwgbGFtYmRhKSxcclxuICAgICAgICAgICAgcXVvdGllbnREaWdpdCwgc2hpZnQsIGNhcnJ5LCBib3Jyb3csIGksIGwsIHE7XHJcbiAgICAgICAgaWYgKHJlbWFpbmRlci5sZW5ndGggPD0gYV9sKSByZW1haW5kZXIucHVzaCgwKTtcclxuICAgICAgICBkaXZpc29yLnB1c2goMCk7XHJcbiAgICAgICAgZGl2aXNvck1vc3RTaWduaWZpY2FudERpZ2l0ID0gZGl2aXNvcltiX2wgLSAxXTtcclxuICAgICAgICBmb3IgKHNoaWZ0ID0gYV9sIC0gYl9sOyBzaGlmdCA+PSAwOyBzaGlmdC0tKSB7XHJcbiAgICAgICAgICAgIHF1b3RpZW50RGlnaXQgPSBiYXNlIC0gMTtcclxuICAgICAgICAgICAgaWYgKHJlbWFpbmRlcltzaGlmdCArIGJfbF0gIT09IGRpdmlzb3JNb3N0U2lnbmlmaWNhbnREaWdpdCkge1xyXG4gICAgICAgICAgICAgICAgcXVvdGllbnREaWdpdCA9IE1hdGguZmxvb3IoKHJlbWFpbmRlcltzaGlmdCArIGJfbF0gKiBiYXNlICsgcmVtYWluZGVyW3NoaWZ0ICsgYl9sIC0gMV0pIC8gZGl2aXNvck1vc3RTaWduaWZpY2FudERpZ2l0KTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAvLyBxdW90aWVudERpZ2l0IDw9IGJhc2UgLSAxXHJcbiAgICAgICAgICAgIGNhcnJ5ID0gMDtcclxuICAgICAgICAgICAgYm9ycm93ID0gMDtcclxuICAgICAgICAgICAgbCA9IGRpdmlzb3IubGVuZ3RoO1xyXG4gICAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgbDsgaSsrKSB7XHJcbiAgICAgICAgICAgICAgICBjYXJyeSArPSBxdW90aWVudERpZ2l0ICogZGl2aXNvcltpXTtcclxuICAgICAgICAgICAgICAgIHEgPSBNYXRoLmZsb29yKGNhcnJ5IC8gYmFzZSk7XHJcbiAgICAgICAgICAgICAgICBib3Jyb3cgKz0gcmVtYWluZGVyW3NoaWZ0ICsgaV0gLSAoY2FycnkgLSBxICogYmFzZSk7XHJcbiAgICAgICAgICAgICAgICBjYXJyeSA9IHE7XHJcbiAgICAgICAgICAgICAgICBpZiAoYm9ycm93IDwgMCkge1xyXG4gICAgICAgICAgICAgICAgICAgIHJlbWFpbmRlcltzaGlmdCArIGldID0gYm9ycm93ICsgYmFzZTtcclxuICAgICAgICAgICAgICAgICAgICBib3Jyb3cgPSAtMTtcclxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgcmVtYWluZGVyW3NoaWZ0ICsgaV0gPSBib3Jyb3c7XHJcbiAgICAgICAgICAgICAgICAgICAgYm9ycm93ID0gMDtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB3aGlsZSAoYm9ycm93ICE9PSAwKSB7XHJcbiAgICAgICAgICAgICAgICBxdW90aWVudERpZ2l0IC09IDE7XHJcbiAgICAgICAgICAgICAgICBjYXJyeSA9IDA7XHJcbiAgICAgICAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgbDsgaSsrKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgY2FycnkgKz0gcmVtYWluZGVyW3NoaWZ0ICsgaV0gLSBiYXNlICsgZGl2aXNvcltpXTtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoY2FycnkgPCAwKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlbWFpbmRlcltzaGlmdCArIGldID0gY2FycnkgKyBiYXNlO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBjYXJyeSA9IDA7XHJcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmVtYWluZGVyW3NoaWZ0ICsgaV0gPSBjYXJyeTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgY2FycnkgPSAxO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIGJvcnJvdyArPSBjYXJyeTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICByZXN1bHRbc2hpZnRdID0gcXVvdGllbnREaWdpdDtcclxuICAgICAgICB9XHJcbiAgICAgICAgLy8gZGVub3JtYWxpemF0aW9uXHJcbiAgICAgICAgcmVtYWluZGVyID0gZGl2TW9kU21hbGwocmVtYWluZGVyLCBsYW1iZGEpWzBdO1xyXG4gICAgICAgIHJldHVybiBbYXJyYXlUb1NtYWxsKHJlc3VsdCksIGFycmF5VG9TbWFsbChyZW1haW5kZXIpXTtcclxuICAgIH1cclxuXHJcbiAgICBmdW5jdGlvbiBkaXZNb2QyKGEsIGIpIHsgLy8gSW1wbGVtZW50YXRpb24gaWRlYSBzaGFtZWxlc3NseSBzdG9sZW4gZnJvbSBTaWxlbnQgTWF0dCdzIGxpYnJhcnkgaHR0cDovL3NpbGVudG1hdHQuY29tL2JpZ2ludGVnZXIvXHJcbiAgICAgICAgLy8gUGVyZm9ybXMgZmFzdGVyIHRoYW4gZGl2TW9kMSBvbiBsYXJnZXIgaW5wdXQgc2l6ZXMuXHJcbiAgICAgICAgdmFyIGFfbCA9IGEubGVuZ3RoLFxyXG4gICAgICAgICAgICBiX2wgPSBiLmxlbmd0aCxcclxuICAgICAgICAgICAgcmVzdWx0ID0gW10sXHJcbiAgICAgICAgICAgIHBhcnQgPSBbXSxcclxuICAgICAgICAgICAgYmFzZSA9IEJBU0UsXHJcbiAgICAgICAgICAgIGd1ZXNzLCB4bGVuLCBoaWdoeCwgaGlnaHksIGNoZWNrO1xyXG4gICAgICAgIHdoaWxlIChhX2wpIHtcclxuICAgICAgICAgICAgcGFydC51bnNoaWZ0KGFbLS1hX2xdKTtcclxuICAgICAgICAgICAgdHJpbShwYXJ0KTtcclxuICAgICAgICAgICAgaWYgKGNvbXBhcmVBYnMocGFydCwgYikgPCAwKSB7XHJcbiAgICAgICAgICAgICAgICByZXN1bHQucHVzaCgwKTtcclxuICAgICAgICAgICAgICAgIGNvbnRpbnVlO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHhsZW4gPSBwYXJ0Lmxlbmd0aDtcclxuICAgICAgICAgICAgaGlnaHggPSBwYXJ0W3hsZW4gLSAxXSAqIGJhc2UgKyBwYXJ0W3hsZW4gLSAyXTtcclxuICAgICAgICAgICAgaGlnaHkgPSBiW2JfbCAtIDFdICogYmFzZSArIGJbYl9sIC0gMl07XHJcbiAgICAgICAgICAgIGlmICh4bGVuID4gYl9sKSB7XHJcbiAgICAgICAgICAgICAgICBoaWdoeCA9IChoaWdoeCArIDEpICogYmFzZTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBndWVzcyA9IE1hdGguY2VpbChoaWdoeCAvIGhpZ2h5KTtcclxuICAgICAgICAgICAgZG8ge1xyXG4gICAgICAgICAgICAgICAgY2hlY2sgPSBtdWx0aXBseVNtYWxsKGIsIGd1ZXNzKTtcclxuICAgICAgICAgICAgICAgIGlmIChjb21wYXJlQWJzKGNoZWNrLCBwYXJ0KSA8PSAwKSBicmVhaztcclxuICAgICAgICAgICAgICAgIGd1ZXNzLS07XHJcbiAgICAgICAgICAgIH0gd2hpbGUgKGd1ZXNzKTtcclxuICAgICAgICAgICAgcmVzdWx0LnB1c2goZ3Vlc3MpO1xyXG4gICAgICAgICAgICBwYXJ0ID0gc3VidHJhY3QocGFydCwgY2hlY2spO1xyXG4gICAgICAgIH1cclxuICAgICAgICByZXN1bHQ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1xyXG4gICAgICAgIH1cclxuICAgICAgICB2YXIgYSA9IHNlbGYudmFsdWUsIGIgPSBuLnZhbHVlO1xyXG4gICAgICAgIHZhciBxdW90aWVudDtcclxuICAgICAgICBpZiAoYiA9PT0gMCkgdGhyb3cgbmV3IEVycm9yKFwiQ2Fubm90IGRpdmlkZSBieSB6ZXJvXCIpO1xyXG4gICAgICAgIGlmIChzZWxmLmlzU21hbGwpIHtcclxuICAgICAgICAgICAgaWYgKG4uaXNTbWFsbCkge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuIFtuZXcgU21hbGxJbnRlZ2VyKHRydW5jYXRlKGEgLyBiKSksIG5ldyBTbWFsbEludGVnZXIoYSAlIGIpXTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICByZXR1cm4gW0ludGVnZXJbMF0sIHNlbGZdO1xyXG4gICAgICAgIH1cclxuICAgICAgICBpZiAobi5pc1NtYWxsKSB7XHJcbiAgICAgICAgICAgIGlmIChiID09PSAxKSByZXR1cm4gW3NlbGYsIEludGVnZXJbMF1dO1xyXG4gICAgICAgICAgICBpZiAoYiA9PSAtMSkgcmV0dXJuIFtzZWxmLm5lZ2F0ZSgpLCBJbnRlZ2VyWzBdXTtcclxuICAgICAgICAgICAgdmFyIGFicyA9IE1hdGguYWJzKGIpO1xyXG4gICAgICAgICAgICBpZiAoYWJzIDwgQkFTRSkge1xyXG4gICAgICAgICAgICAgICAgdmFsdWUgPSBkaXZNb2RTbWFsbChhLCBhYnMpO1xyXG4gICAgICAgICAgICAgICAgcXVvdGllbnQgPSBhcnJheVRvU21hbGwodmFsdWVbMF0pO1xyXG4gICAgICAgICAgICAgICAgdmFyIHJlbWFpbmRlciA9IHZhbHVlWzFdO1xyXG4gICAgICAgICAgICAgICAgaWYgKHNlbGYuc2lnbikgcmVtYWluZGVyID0gLXJlbWFpbmRlcjtcclxuICAgICAgICAgICAgICAgIGlmICh0eXBlb2YgcXVvdGllbnQgPT09IFwibnVtYmVyXCIpIHtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoc2VsZi5zaWduICE9PSBuLnNpZ24pIHF1b3RpZW50ID0gLXF1b3RpZW50O1xyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBbbmV3IFNtYWxsSW50ZWdlcihxdW90aWVudCksIG5ldyBTbWFsbEludGVnZXIocmVtYWluZGVyKV07XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gW25ldyBCaWdJbnRlZ2VyKHF1b3RpZW50LCBzZWxmLnNpZ24gIT09IG4uc2lnbiksIG5ldyBTbWFsbEludGVnZXIocmVtYWluZGVyKV07XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgYiA9IHNtYWxsVG9BcnJheShhYnMpO1xyXG4gICAgICAgIH1cclxuICAgICAgICB2YXIgY29tcGFyaXNvbiA9IGNvbXBhcmVBYnMoYSwgYik7XHJcbiAgICAgICAgaWYgKGNvbXBhcmlzb24gPT09IC0xKSByZXR1cm4gW0ludGVnZXJbMF0sIHNlbGZdO1xyXG4gICAgICAgIGlmIChjb21wYXJpc29uID09PSAwKSByZXR1cm4gW0ludGVnZXJbc2VsZi5zaWduID09PSBuLnNpZ24gPyAxIDogLTFdLCBJbnRlZ2VyWzBdXTtcclxuXHJcbiAgICAgICAgLy8gZGl2TW9kMSBpcyBmYXN0ZXIgb24gc21hbGxlciBpbnB1dCBzaXplc1xyXG4gICAgICAgIGlmIChhLmxlbmd0aCArIGIubGVuZ3RoIDw9IDIwMClcclxuICAgICAgICAgICAgdmFsdWUgPSBkaXZNb2QxKGEsIGIpO1xyXG4gICAgICAgIGVsc2UgdmFsdWUgPSBkaXZNb2QyKGEsIGIpO1xyXG5cclxuICAgICAgICBxdW90aWVudCA9IHZhbHVlWzBdO1xyXG4gICAgICAgIHZhciBxU2lnbiA9IHNlbGYuc2lnbiAhPT0gbi5zaWduLFxyXG4gICAgICAgICAgICBtb2QgPSB2YWx1ZVsxXSxcclxuICAgICAgICA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dGhpcy52YWx1ZSxcclxuICAgICAgICAgICAgYiA9IG4udmFsdWUsXHJcbiAgICAgICAgICAgIHZhbHVlLCB4LCB5O1xyXG4gICAgICAgIGlmIChiID09PSAwKSByZXR1cm4gSW50ZWdlclsxXTtcclxuICAgICAgICBpZiAoYSA9PT0gMCkgcmV0dXJuIEludGVnZXJbMF07XHJcbiAgICAgICAgaWYgKGEgPT09IDEpIHJldHVybiBJbnRlZ2VyWzFdO1xyXG4gICAgICAgIGlmIChhID09PSAtMSkgcmV0dXJuIG4uaXNFdmVuKCkgPyBJbnRlZ2VyWzFdIDogSW50ZWdlclstMV07XHJcbiAgICAgICAgaWYgKG4uc2lnbikge1xyXG4gICAgICAgICAgICByZXR1cm4gSW50ZWdlclswXTtcclxuICAgICAgICB9XHJcbiAgICAgICAgaWYgKCFuLmlzU21hbGwpIHRocm93IG5ldyBFcnJvcihcIlRoZSBleHBvbmVudCBcIiArIG4udG9TdHJpbmcoKSArIFwiIGlzIHRvbyBsYXJnZS5cIik7XHJcbiAgICAgICAgaWYgKHRoaXMuaXNTbWFsbCkge1xyXG4gICAgICAgICAgICBpZiAoaXNQcmVjaXNlKHZhbHVlID0gTWF0aC5wb3coYSwgYikpKVxyXG4gICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBTbWFsbEludGVnZXIodHJ1bmNhdGUodmFsdWUpKTtcclxuICAgICAgICB9XHJcbiAgICAgICAgeCA9IHRoaXM7XHJcbiAgICAgICAgeSA9IEludGVnZXJbMV07XHJcbiAgICAgICAgd2hpbGUgKHRydWUpIHtcclxuICAgICAgICAgICAgaWYgKGIgJiAxID09PSAxKSB7XHJcbiAgICAgICAgICAgICAgICB5ID0geS50aW1lcyh4KTtcclxuICAgICAgICAgICAgICAgIC0tYjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBpZiAoYiA9PT0gMCkgYnJlYWs7XHJcbiAgICAgICAgICAgIGIgLz0gMjtcclxuICAgICAgICAgICAgeCA9IHguc3F1YXJlKCk7XHJcbiAgICAgICAgfVxyXG4gICAgICAgIHJldHVybiB5O1xyXG4gICAgfTtcclxuICAgIFNtYWxsSW50ZWdlci5wcm90b3R5cGUucG93ID0gQmlnSW50ZWdlci5wcm90b3R5cGUucG93O1xyXG5cclxuICAgIE5hdGl2ZUJpZ0ludC5wcm90b3R5cGUucG93ID0gZnVuY3Rpb24gKHYpIHtcclxuICAgICAgICB2YXIgbiA9IHBhcnNlVmFsdWUodik7XHJcbiAgICAgICAgdmFyIGEgPSB0aGlzLnZhbHVlLCBiID0gbi52YWx1ZTtcclxuICAgICAgICB2YXIgXzAgPSBCaWdJbnQoMCksIF8xID0gQmlnSW50KDEpLCBfMiA9IEJpZ0ludCgyKTtcclxuICAgICAgICBpZiAoYiA9PT0gXzApIHJldHVybiBJbnRlZ2VyWzFdO1xyXG4gICAgICAgIGlmIChhID09PSBfMCkgcmV0dXJuIEludGVnZXJbMF07XHJcbiAgICAgICAgaWYgKGEgPT09IF8xKSByZXR1cm4gSW50ZWdlclsxXTtcclxuICAgICAgICBpZiAoYSA9PT0gQmlnSW50KC0xKSkgcmV0dXJuIG4uaXNFdmVuKCkgPyBJbnRlZ2VyWzFdIDogSW50ZWdlclstMV07XHJcbiAgICAgICAgaWYgKG4uaXNOZWdhdGl2ZSgpKSByZXR1cm4gbmV3IE5hdGl2ZUJpZ0ludChfMCk7XHJcbiAgICAgICAgdmFyIHggPSB0aGlzO1xyXG4gICAgICAgIHZhciB5ID0gSW50ZWdlclsxXTtcclxuICAgICAgICB3aGlsZSAodHJ1ZSkge1xyXG4gICAgICAgICAgICBpZiAoKGIgJiBfMSkgPT09IF8xKSB7XHJcbiAgICAgICAgICAgICAgICB5ID0geS50aW1lcyh4KTtcclxuICAgICAgICAgICAgICAgIC0tYjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBpZiAoYiA9PT0gXzApIGJyZWFrO1xyXG4gICAgICAgICAgICBiIC89IF8yO1xyXG4gICAgICAgICAgICB4ID0geC5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m1vZFBvdztcclxuXHJcbiAgICBmdW5jdGlvbiBjb21wYXJlQWJzKGEsIGIpIHtcclxuICAgICAgICBpZiAoYS5sZW5ndGggIT09IGIubGVuZ3RoKSB7XHJcbiAgICAgICAgICAgIHJldHVybiBhLmxlbmd0aCA+IGIubGVuZ3RoID8gMSA6IC0xO1xyXG4gICAgICAgIH1cclxuICAgICAgICBmb3IgKHZhciBpID0gYS5sZW5ndGggLSAxOyBpID49IDA7IGktLSkge1xyXG4gICAgICAgICAgICBpZiAoYVtpXSAhPT0gYltpXSkgcmV0dXJuIGFbaV0gPiBiW2ldID8gMSA6IC0xO1xyXG4gICAgICAgIH1cclxuICAgICAgICByZXR1cm4gMDtcclxuICAgIH1cclxuXHJcbiAgICBCaWdJbnRlZ2VyLnByb3RvdHlwZS5jb21wYXJlQWJzID0gZnVuY3Rpb24gKHYpIHtcclxuICAgICAgICB2YXIgbiA9IHBhcnNlVmFsdWUodiksXHJcbiAgICAgICAgICAgIGEgPSB0aGlzLnZhbHVlLFxyXG4gICAgICAgICAgICBiID0gbi52YWx1ZTtcclxuICAgICAgICBpZiAobi5pc1NtYWxsKSByZXR1cm4gMTtcclxuICAgICAgICByZXR1cm4gY29tcGFyZUFicyhhLCBiKTtcclxuICAgIH07XHJcbiAgICBTbWFsbEludGVnZXIucHJvdG90eXBlLmNvbXBhcmVBYnMgPSBmdW5jdGlvbiAodikge1xyXG4gICAgICAgIHZhciBuID0gcGFyc2VWYWx1ZSh2KSxcclxuICAgICAgICAgICAgYSA9IE1hdGguYWJzKHRoaXMudmFsdWUpLFxyXG4gICAgICAgICAgICBiID0gbi52YWx1ZTtcclxuICAgICAgICBpZiAobi5pc1NtYWxsKSB7XHJcbiAgICAgICAgICAgIGIgPSBNYXRoLmFicyhiKTtcclxuICAgICAgICAgICAgcmV0dXJuIGEgPT09IGIgPyAwIDogYSA+IGIgPyAxIDogLTE7XHJcbiAgICAgICAgfVxyXG4gICAgICAgIHJldHVybiAtMTtcclxuICAgIH07XHJcbiAgICBOYXRpdmVCaWdJbnQucHJvdG90eXBlLmNvbXBhcmVBYnMgPSBmdW5jdGlvbiAodikge1xyXG4gICAgICAgIHZhciBhID0gdGhpcy52YWx1ZTtcclxuICAgICAgICB2YXIgYiA9IHBhcnNlVmFsdWUodikudmFsdWU7XHJcbiAgICAgICAgYSA9IGEgPj0gMCA/IGEgOiAtYTtcclxuICAgICAgICBiID0gYiA+PSAwID8gYiA6IC1iO1xyXG4gICAgICAgIHJldHVybiBhID09PSBiID8gMCA6IGEgPiBiID8gMSA6IC0xO1xyXG4gICAgfVxyXG5cclxuICAgIEJpZ0ludGVnZXIucHJvdG90eXBlLmNvbXBhcmUgPSBmdW5jdGlvbiAodikge1xyXG4gICAgICAgIC8vIFNlZSBkaXNjdXNzaW9uIGFib3V0IGNvbXBhcmlzb24gd2l0aCBJbmZpbml0eTpcclxuICAgICAgICAvLyBodHRwczovL2dpdGh1Yi5jb20vcGV0ZXJvbHNvbi9CaWdJbnRlZ2VyLmpzL2lzc3Vlcy82MVxyXG4gICAgICAgIGlmICh2ID09PSBJbmZpbml0eSkge1xyXG4gICAgICAgICAgICByZXR1cm4gLTE7XHJcbiAgICAgICAgfVxyXG4gICAgICAgIGlmICh2ID09PSAtSW5maW5pdHkpIHtcclxuICAgICAgICAgICAgcmV0dXJuIDE7XHJcbiAgICAgICAgfVxyXG5cclxuICAgICAgICB2YXIgbiA9IHBhcnNlVmFsdWUodiksXHJcbiAgICAgICAgICAgIGEgPSB0aGlzLnZhbHVlLFxyXG4gICAgICAgICAgICBiID0gbi52YWx1ZTtcclxuICAgICAgICBpZiAodGhpcy5zaWduICE9PSBuLnNpZ24pIHtcclxuICAgICAgICAgICAgcmV0dXJuIG4uc2lnbiA/IDEgOiAtMTtcclxuICAgICAgICB9XHJcbiAgICAgICAgaWYgKG4uaXNTbWFsbCkge1xyXG4gICAgICAgICAgICByZXR1cm4gdGhpcy5zaWduID8gLTEgOiAxO1xyXG4gICAgICAgIH1cclxuICAgICAgICByZXR1cm4gY29tcGFyZUFicyhhLCBiKSAqICh0aGlzLnNpZ24gPyAtMSA6IDEpO1xyXG4gICAgfTtcclxuICAgIEJpZ0ludGVnZXIucHJvdG90eXBlLmNvbXBhcmVUbyA9IEJpZ0ludGVnZXIucHJvdG90eXBlLmNvbXBhcmU7XHJcblxyXG4gICAgU21hbGxJbnRlZ2VyLnByb3RvdHlwZS5jb21wYXJlID0gZnVuY3Rpb24gKHYpIHtcclxuICAgICAgICBpZiAodiA9PT0gSW5maW5pdHkpIHtcclxuICAgICAgICAgICAgcmV0dXJuIC0xO1xyXG4gICAgICAgIH1cclxuICAgICAgICBpZiAodiA9PT0gLUluZmluaXR5KSB7XHJcbiAgICAgICAgICAgIHJldHVybiAxO1xyXG4gICAgICAgIH1cclxuXHJcbiAgICAgICAgdmFyIG4gPSBwYXJzZVZhbHVlKHYpLFxyXG4gICAgICAgICAgICBhID0gdGhpcy52YWx1ZSxcclxuICAgICAgICAgICAgYiA9IG4udmFsdWU7XHJcbiAgICAgICAgaWYgKG4uaXNTbWFsbCkge1xyXG4gICAgICAgICAgICByZXR1cm4gYSA9PSBiID8gMCA6IGEgPiBiID8gMSA6IC0xO1xyXG4gICAgICAgIH1cclxuICAgICAgICBpZiAoYSA8IDAgIT09IG4uc2lnbikge1xyXG4gICAgICAgICAgICByZXR1cm4gYSA8IDAgPyAtMSA6IDE7XHJcbiAgICAgICAgfVxyXG4gICAgICAgIHJldHVybiBhIDwgMCA/IDEgOiAtMTtcclxuICAgIH07XHJcbiAgICBTbWFsbEludGVnZXIucHJvdG90eXBlLmNvbXBhcmVUbyA9IFNtYWxsSW50ZWdlci5wcm90b3R5cGUuY29tcGFyZTtcclxuXHJcbiAgICBOYXRpdmVCaWdJbnQucHJvdG90eXBlLmNvbXBhcmUgPSBmdW5jdGlvbiAodikge1xyXG4gICAgICAgIGlmICh2ID09PSBJbmZpbml0eSkge1xyXG4gICAgICAgICAgICByZXR1cm4gLTE7XHJcbiAgICAgICAg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sgaSA8IGEubGVuZ3RoOyBpKyspIHtcclxuICAgICAgICAgICAgaWYgKG4ubGVzc2VyKGFbaV0pKSBjb250aW51ZTtcclxuICAgICAgICAgICAgeCA9IGJpZ0ludChhW2ldKS5tb2RQb3coYiwgbik7XHJcbiAgICAgICAgICAgIGlmICh4LmlzVW5pdCgpIHx8IHguZXF1YWxzKG5QcmV2KSkgY29udGludWU7XHJcbiAgICAgICAgICAgIGZvciAoZCA9IHIgLSAxOyBkICE9IDA7IGQtLSkge1xyXG4gICAgICAgICAgICAgICAgeCA9IHguc3F1YXJlKCkubW9kKG4pO1xyXG4gICAgICAgICAgICAgICAgaWYgKHguaXNVbml0KCkpIHJldHVybiBmYWxzZTtcclxuICAgICAgICAgICAgICAgIGlmICh4LmVxdWFscyhuUHJldikpIGNvbnRpbnVlIG5leHQ7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xyXG4gICAgICAgIH1cclxuICAgICAgICByZXR1cm4gdHJ1ZTtcclxuICAgIH1cclxuXHJcbiAgICAvLyBTZXQgXCJzdHJpY3RcIiB0byB0cnVlIHRvIGZvcmNlIEdSSC1zdXBwb3J0ZWQgbG93ZXIgYm91bmQgb2YgMipsb2coTileMlxyXG4gICAgQmlnSW50ZWdlci5wcm90b3R5cGUuaXNQcmltZSA9IGZ1bmN0aW9uIChzdHJpY3QpIHtcclxuICAgICAgICB2YXIgaXNQcmltZSA9IGlzQmFzaWNQcmltZSh0aGlzKTtcclxuICAgICAgICBpZiAoaXNQcmltZSAhPT0gdW5kZWZpbmVkKSByZXR1cm4gaXNQcmltZTtcclxuICAgICAgICB2YXIgbiA9IHRoaXMuYWJzKCk7XHJcbiAgICAgICAgdmFyIGJpdHMgPSBuLmJpdExlbmd0aCgpO1xyXG4gICAgICAgIGlmIChiaXRzIDw9IDY0KVxyXG4gICAgICAgICAgICByZXR1cm4gbWlsbGVyUmFiaW5UZXN0KG4sIFsyLCAzLCA1LCA3LCAxM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AgeCA9IHR5cGVvZiB2ID09PSBcIm51bWJlclwiID8gdiB8IExPQk1BU0tfSSA6XHJcbiAgICAgICAgICAgICAgICB0eXBlb2YgdiA9PT0gXCJiaWdpbnRcIiA/IHYgfCBCaWdJbnQoTE9CTUFTS19JKSA6XHJcbiAgICAgICAgICAgICAgICAgICAgdlswXSArIHZbMV0gKiBCQVNFIHwgTE9CTUFTS19CSTtcclxuICAgICAgICByZXR1cm4geCAmIC14O1xyXG4gICAgfVxyXG5cclxuICAgIGZ1bmN0aW9uIGludGVnZXJMb2dhcml0aG0odmFsdWUsIGJhc2UpIHtcclxuICAgICAgICBpZiAoYmFzZS5jb21wYXJlVG8odmFsdWUpIDw9IDApIHtcclxuICAgICAgICAgICAgdmFyIHRtcCA9IGludGVnZXJMb2dhcml0aG0odmFsdWUsIGJhc2Uuc3F1YXJlKGJhc2UpKTtcclxuICAgICAgICAgICAgdmFyIHAgPSB0bXAucDtcclxuICAgICAgICAgICAgdmFyIGUgPSB0bXAuZTtcclxuICAgICAgICAgICAgdmFyIHQgPSBwLm11bHRpcGx5KGJhc2UpO1xyXG4gICAgICAgICAgICByZXR1cm4gdC5jb21wYXJlVG8odmFsdWUpIDw9IDAgPyB7IHA6IHQsIGU6IGUgKiAyICsgMSB9IDogeyBwOiBwLCBlOiBlICogMiB9O1xyXG4gICAgICAgIH1cclxuICAgICAgICByZXR1cm4geyBwOiBiaWdJbnQoMSksIGU6IDAgfTtcclxuICAgIH1cclxuXHJcbiAgICBCaWdJbnRlZ2VyLnByb3RvdHlwZS5iaXRMZW5ndGggPSBmdW5jdGlvbiAoKSB7XHJcbiAgICAgICAgdmFyIG4gPSB0aGlzO1xyXG4gICAgICAgIGlmIChuLmNvbXBhcmVUbyhiaWdJbnQoMCkpIDwgMCkge1xyXG4gICAgICAgICAgICBuID0gbi5uZWdhdGUoKS5zdWJ0cmFjdChiaWdJbnQoMSkpO1xyXG4gICAgICAgIH1cclxuICAgICAgICBpZiAobi5jb21wYXJlVG8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ICAgZCA9IG1pbihyb3VnaExPQihhKSwgcm91Z2hMT0IoYikpO1xyXG4gICAgICAgICAgICBhID0gYS5kaXZpZGUoZCk7XHJcbiAgICAgICAgICAgIGIgPSBiLmRpdmlkZShkKTtcclxuICAgICAgICAgICAgYyA9IGMubXVsdGlwbHkoZCk7XHJcbiAgICAgICAgfVxyXG4gICAgICAgIHdoaWxlIChhLmlzRXZlbigpKSB7XHJcbiAgICAgICAgICAgIGEgPSBhLmRpdmlkZShyb3VnaExPQihhKSk7XHJcbiAgICAgICAgfVxyXG4gICAgICAgIGRvIHtcclxuICAgICAgICAgICAgd2hpbGUgKGIuaXNFdmVuKCkpIHtcclxuICAgICAgICAgICAgICAgIGIgPSBiLmRpdmlkZShyb3VnaExPQihiKSk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKGEuZ3JlYXRlcihiKSkge1xyXG4gICAgICAgICAgICAgICAgdCA9IGI7IGIgPSBhOyBhID0gdDtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBiID0gYi5zdWJ0cmFjdChhKTtcclxuICAgICAgICB9IHdoaWxlICghYi5pc1plcm8oKSk7XHJcbiAgICAgICAgcmV0dXJuIGMuaXNVbml0KCkgPyBhIDogYS5tdWx0aXBseShjKTtcclxuICAgIH1cclxuICAgIGZ1bmN0aW9uIGxjbShhLCBiKSB7XHJcbiAgICAgICAgYSA9IHBhcnNlVmFsdWUoYSkuYWJzKCk7XHJcbiAgICAgICAgYiA9IHBhcnNlVmFsdWUoYikuYWJzKCk7XHJcbiAgICAgICAgcmV0dXJuIGEuZGl2aWRlKGdjZChhLCBiKSkubXVsdGlwbHkoYik7XHJcbiAgICB9XHJcbiAgICBmdW5jdGlvbiByYW5kQmV0d2VlbihhLCBiLCBybmcpIHtcclxuICAgICAgICBhID0gcGFyc2VWYWx1ZShhKTtcclxuICAgICAgICBiID0gcGFyc2VWYWx1ZShiKTtcclxuICAgICAgICB2YXIgdXNlZFJORyA9IHJuZy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0ZXh0ID0gU3RyaW5nKHRleHQpO1xyXG4gICAgICAgIGlmICghY2FzZVNlbnNpdGl2ZSkge1xyXG4gICAgICAgICAgICB0ZXh0ID0gdGV4dC50b0xvd2VyQ2FzZSgpO1xyXG4gICAgICAgICAgICBhbHBoYWJldCA9IGFscGhhYmV0LnRvTG93ZXJDYXNlKCk7XHJcbiAgICAgICAgfVxyXG4gICAgICAgIHZhciBsZW5ndGggPSB0ZXh0Lmxlbmd0aDtcclxuICAgICAgICB2YXIgaTtcclxuICAgICAgICB2YXIgYWJzQmFzZSA9IE1hdGguYWJzKGJhc2UpO1xyXG4gICAgICAgIHZhciBhbHBoYWJldFZhbHVlcyA9IHt9O1xyXG4gICAgICAgIGZvciAoaSA9IDA7IGkgPCBhbHBoYWJldC5sZW5ndGg7IGkrKykge1xyXG4gICAgICAgICAgICBhbHBoYWJldFZhbHVlc1thbHBoYWJldFtpXV0gPSBpO1xyXG4gICAgICAgIH1cclxuICAgICAgICBmb3IgKGkgPSAwOyBpIDwgbGVuZ3RoOyBpKyspIHtcclxuICAgICAgICAgICAgdmFyIGMgPSB0ZXh0W2ldO1xyXG4gICAgICAgICAgICBpZiAoYyA9PT0gXCItXCIpIGNvbnRpbnVlO1xyXG4gICAgICAgICAgICBpZiAoYyBpbiBhbHBoYWJldFZhbHVlcykge1xyXG4gICAgICAgICAgICAgICAgaWYgKGFscGhhYmV0VmFsdWVzW2NdID49IGFic0Jhc2UpIHtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoYyA9PT0gXCIxXCIgJiYgYWJzQmFzZSA9PT0gMSkgY29udGludWU7XHJcbiAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKGMgKyBcIiBpcyBub3QgYSB2YWxpZCBkaWdpdCBpbiBiYXNlIFwiICsgYmFzZSArIFwiLlwiKTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH1cclxuICAgICAgICBiYXNlID0gcGFyc2VW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gICAgICAgcmV0dXJuIHtcclxuICAgICAgICAgICAgICAgICAgICB2YWx1ZTogW10uY29uY2F0LmFwcGx5KFtdLCBBcnJheS5hcHBseShudWxsLCBBcnJheSgtbi50b0pTTnVtYmVyKCkpKVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAubWFwKEFycmF5LnByb3RvdHlwZS52YWx1ZU9mLCBbMSwgMF0pXHJcbiAgICAgICAgICAgICAgICAgICAgKSxcclxuICAgICAgICAgICAgICAgICAgICBpc05lZ2F0aXZlOiBmYWxzZVxyXG4gICAgICAgICAgICAgICAgfTtcclxuXHJcbiAgICAgICAgICAgIHZhciBhcnIgPSBBcnJheS5hcHBseShudWxsLCBBcnJheShuLnRvSlNOdW1iZXIoKSAtIDEpKVxyXG4gICAgICAgICAgICAgICAgLm1hcChBcnJheS5wcm90b3R5cGUudmFsdWVPZiwgWzAsIDFdKTtcclxuICAgICAgICAgICAgYXJyLnVuc2hpZnQoWzFdKTtcclxuICAgICAgICAgICAgcmV0dXJuIHtcclxuICAgICAgICAgICAgICAgIHZhbHVlOiBbXS5jb25jYXQuYXBwbHkoW10sIGFyciksXHJcbiAgICAgICAgICAgICAgICBpc05lZ2F0aXZlOiBmYWxzZVxyXG4gICAgICAgICAgICB9O1xyXG4gICAgICAgIH1cclxuXHJcbiAgICAgICAgdmFyIG5lZyA9IGZhbHNlO1xyXG4gICAgICAgIGlmIChuLmlzTmVnYXRpdmUoKSAmJiBiYXNlLmlzUG9zaXRpdmUoKSkge1xyXG4gICAgICAgICAgICBuZWcgPSB0cnVlO1xyXG4gICAgICAgICAgICBuID0gbi5hYnMoKTtcclxuICAgICAgICB9XHJcbiAgICAgICAgaWYgKGJhc2UuaXNVbml0KCkpIHtcclxuICAgICAgICAgICAgaWYgKG4uaXNaZXJvKCkpIHJldHVybiB7IHZhbHVlOiBbMF0sIGlzTmVnYXRpdmU6IGZhbHNlIH07XHJcblxyXG4gICAgICAgICAgICByZXR1cm4ge1xyXG4gICAgICAgICAgICAgICAgdmFsdWU6IEFycmF5LmFwcGx5KG51bGwsIEFycmF5KG4udG9KU051bWJlcigpKSlcclxuICAgICAgICAgICAgICAgICAgICAubWFwKE51bWJlci5wcm90b3R5cGUudmFsdWVPZiwgMSksXHJcbiAgICAgICAgICAgICAgICBpc05lZ2F0aXZlOiBuZWdcclxuICAgICAgICAgICAgfTtcclxuICAgICAgICB9XHJcbiAgICAgICAgdmFyIG91dCA9IFtdO1xyXG4gICAgICAgIHZhciBsZWZ0ID0gbiwgZGl2bW9kO1xyXG4gICAgICAgIHdoaWxlIChsZWZ0LmlzTmVnYXRpdmUoKSB8fCBsZWZ0LmNvbXBhcmVBYnMoYmFzZSkgPj0gMCkge1xyXG4gICAgICAgICAgICBkaXZtb2QgPSBsZWZ0LmRpdm1vZChiYXNlKTtcclxuICAgICAgICAgICAgbGVmdCA9IGRpdm1vZC5xdW90aWVudDtcclxuICAgICAgICAgICAgdmFyIGRpZ2l0ID0gZGl2bW9kLnJlbWFpbmRlcjtcclxuICAgICAgICAgICAgaWYgKGRpZ2l0LmlzTmVnYXRpdmUoKSkge1xyXG4gICAgICAgICAgICAgICAgZGlnaXQgPSBiYXNlLm1pbnVzKGRpZ2l0KS5hYnMoKTtcclxuICAgICAgICAgICAgICAgIGxlZnQgPSBsZWZ0Lm5leHQoKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBvdXQucHVzaChkaWdpdC50b0pTTnVtYmVyKCkpO1xyXG4gICAgICAgIH1cclxuICAgICAgICBvdXQucHVzaChsZWZ0LnRvSlNOdW1iZXIoKSk7XHJcbiAgICAgICAgcmV0dXJuIHsgdmFsdWU6IG91dC5yZXZlcnNlKCksIGlzTmVnYXRpdmU6IG5lZyB9O1xyXG4gICAgfVxyXG5cclxuICAgIGZ1bmN0aW9uIHRvQmFzZVN0cmluZyhuLCBiYXNlLCBhbHBoYWJldCkge1xyXG4gICAgICAgIHZhciBhcnIgPSB0b0Jhc2UobiwgYmFzZSk7XHJcbiAgICA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gICAgaWYgKHNwbGl0Lmxlbmd0aCA9PT0gMikge1xyXG4gICAgICAgICAgICB2YXIgZXhwID0gc3BsaXRbMV07XHJcbiAgICAgICAgICAgIGlmIChleHBbMF0gPT09IFwiK1wiKSBleHAgPSBleHAuc2xpY2UoMSk7XHJcbiAgICAgICAgICAgIGV4cCA9ICtleHA7XHJcbiAgICAgICAgICAgIGlmIChleHAgIT09IHRydW5jYXRlKGV4cCkgfHwgIWlzUHJlY2lzZShleHApKSB0aHJvdyBuZXcgRXJyb3IoXCJJbnZhbGlkIGludGVnZXI6IFwiICsgZXhwICsgXCIgaXMgbm90IGEgdmFsaWQgZXhwb25lbnQuXCIpO1xyXG4gICAgICAgICAgICB2YXIgdGV4dCA9IHNwbGl0WzBdO1xyXG4gICAgICAgICAgICB2YXIgZGVjaW1hbFBsYWNlID0gdGV4dC5pbmRleE9mKFwiLlwiKTtcclxuICAgICAgICAgICAgaWYgKGRlY2ltYWxQbGFjZSA+PSAwKSB7XHJcbiAgICAgICAgICAgICAgICBleHAgLT0gdGV4dC5sZW5ndGggLSBkZWNpbWFsUGxhY2UgLSAxO1xyXG4gICAgICAgICAgICAgICAgdGV4dCA9IHRleHQuc2xpY2UoMCwgZGVjaW1hbFBsYWNlKSArIHRleHQuc2xpY2UoZGVjaW1hbFBsYWNlICsgMSk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKGV4cCA8IDApIHRocm93IG5ldyBFcnJvcihcIkNhbm5vdCBpbmNsdWRlIG5lZ2F0aXZlIGV4cG9uZW50IHBhcnQgZm9yIGludGVnZXJzXCIpO1xyXG4gICAgICAgICAgICB0ZXh0ICs9IChuZXcgQXJyYXkoZXhwICsgMSkpLmpvaW4oXCIwXCIpO1xyXG4gICAgICAgICAgICB2ID0gdGV4dDtcclxuICAgICAgICB9XHJcbiAgICAgICAgdmFyIGlzVmFsaWQgPSAvXihbMC05XVswLTldKikkLy50ZXN0KHYpO1xyXG4gICAgICAgIGlmICghaXNWYWxpZCkgdGhyb3cgbmV3IEVycm9yKFwiSW52YWxpZCBpbnRlZ2VyOiBcIiArIHYpO1xyXG4gICAgICAgIGlmIChzdXBwb3J0c05hdGl2ZUJpZ0ludCkge1xyXG4gICAgICAgICAgICByZXR1cm4gbmV3IE5hdGl2ZUJpZ0ludChCaWdJbnQoc2lnbiA/IFwiLVwiICsgdiA6IHYpKTtcclxuICAgICAgICB9XHJcbiAgICAgICAgdmFyIHIgPSBbXSwgbWF4ID0gdi5sZW5ndGgsIGwgPSBMT0dfQkFTRSwgbWluID0gbWF4IC0gbDtcclxuICAgICAgICB3aGlsZSAobWF4ID4gMCkge1xyXG4gICAgICAgICAgICByLnB1c2goK3Yuc2xpY2UobWluLCBtYXgpKTtcclxuICAgICAgICAgICAgbWluIC09IGw7XHJcbiAgICAgICAgICAgIGlmIChtaW4gPCAwKSBtaW4gPSAwO1xyXG4gICAgICAgICAgICBtYXggLT0gbDtcclxuICAgICAgICB9XHJcbiAgICAgICAgdHJpbShyKTtcclxuICAgICAgICByZXR1cm4gbmV3IEJpZ0ludGVnZXIociwgc2lnbik7XHJcbiAgICB9XHJcblxyXG4gICAgZnVuY3Rpb24gcGFyc2VOdW1iZXJWYWx1ZSh2KSB7XHJcbiAgICAgICAgaWYgKHN1cHBvcnRzTmF0aXZlQmlnSW50KSB7XHJcbiAgICAgICAgICAgIHJldHVybiBuZXcgTmF0aXZlQmlnSW50KEJpZ0ludCh2KSk7XHJcbiAgICAgICAgfVxyXG4gICAgICAgIGlmIChpc1ByZWNpc2UodikpIHtcclxuICAgICAgICAgICAgaWYgKHYgIT09IHRydW5jYXRlKHYpKSB0aHJvdyBuZXcgRXJyb3IodiArIFwiIGlzIG5vdCBhbiBpbnRlZ2VyLlwiKTtcclxuICAgICAgICAgICAgcmV0dXJuIG5ldyBTbWFsbEludGVnZXIodik7XHJcbiAgICAgICAgfVxyXG4gICAgICAgIHJldHVybiBwYXJzZVN0cmluZ1ZhbHVlKHYudG9TdHJpbmcoK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gaSA8IGxlbmd0aDsgKytpKSB7XG4gICAgY29kZVBvaW50ID0gc3RyaW5nLmNoYXJDb2RlQXQoaSlcblxuICAgIC8vIGlzIHN1cnJvZ2F0ZSBjb21wb25lbnRcbiAgICBpZiAoY29kZVBvaW50ID4gMHhEN0ZGICYmIGNvZGVQb2ludCA8IDB4RTAwMCkge1xuICAgICAgLy8gbGFzdCBjaGFyIHdhcyBhIGxlYWRcbiAgICAgIGlmICghbGVhZFN1cnJvZ2F0ZSkge1xuICAgICAgICAvLyBubyBsZWFkIHlldFxuICAgICAgICBpZiAoY29kZVBvaW50ID4gMHhEQkZGKSB7XG4gICAgICAgICAgLy8gdW5leHBlY3RlZCB0cmFpbFxuICAgICAgICAgIGlmICgodW5pdHMgLT0gMykgPiAtMSkgYnl0ZXMucHVzaCgweEVGLCAweEJGLCAweEJEKVxuICAgICAgICAgIGNvbnRpbnVlXG4gICAgICAgIH0gZWxzZSBpZiAoaSArIDEgPT09IGxlbmd0aCkge1xuICAgICAgICAgIC8vIHVucGFpcmVkIGxlYWRcbiAgICAgICAgICBpZiAoKHVuaXRzIC09IDMpID4gLTEpIGJ5dGVzLnB1c2goMHhFRiwgMHhCRiwgMHhCRClcbiAgICAgICAgICBjb250aW51ZVxuICAgICAgICB9XG5cbiAgICAgICAgLy8gdmFsaWQgbGVhZFxuICAgICAgICBsZWFkU3Vycm9nYXRlID0gY29kZVBvaW50XG5cbiAgICAgICAgY29udGludWVcbiAgICAgIH1cblxuICAgICAgLy8gMiBsZWFkcyBpbiBhIHJvd1xuICAgICAgaWYgKGNvZGVQb2ludCA8IDB4REMwMCkge1xuICAgICAgICBpZiAoKHVuaXRzIC09IDMpID4gLTEpIGJ5dGVzLnB1c2goMHhFRiwgMHhCRiwgMHhCRClcbiAgICAgICAgbGVhZFN1cnJvZ2F0ZSA9IGNvZGVQb2ludFxuICAgICAgICBjb250aW51ZVxuICAgICAgfVxuXG4gICAgICAvLyB2YWxpZCBzdXJyb2dhdGUgcGFpclx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Agbm9Bc3NlcnQgPSAhIW5vQXNzZXJ0O1xyXG4gICAgICAgIH1cclxuXHJcbiAgICAgICAgLyoqXHJcbiAgICAgICAgICogQmFja2luZyBBcnJheUJ1ZmZlci5cclxuICAgICAgICAgKiBAdHlwZSB7IUFycmF5QnVmZmVyfVxyXG4gICAgICAgICAqIEBleHBvc2VcclxuICAgICAgICAgKi9cclxuICAgICAgICB0aGlzLmJ1ZmZlciA9IGNhcGFjaXR5ID09PSAwID8gRU1QVFlfQlVGRkVSIDogbmV3IEFycmF5QnVmZmVyKGNhcGFjaXR5KTtcclxuXHJcbiAgICAgICAgLyoqXHJcbiAgICAgICAgICogVWludDhBcnJheSB1dGlsaXplZCB0byBtYW5pcHVsYXRlIHRoZSBiYWNraW5nIGJ1ZmZlci4gQmVjb21lcyBgbnVsbGAgaWYgdGhlIGJhY2tpbmcgYnVmZmVyIGhhcyBhIGNhcGFjaXR5IG9mIGAwYC5cclxuICAgICAgICAgKiBAdHlwZSB7P1VpbnQ4QXJyYXl9XHJcbiAgICAgICAgICogQGV4cG9zZVxyXG4gICAgICAgICAqL1xyXG4gICAgICAgIHRoaXMudmlldyA9IGNhcGFjaXR5ID09PSAwID8gbnVsbCA6IG5ldyBVaW50OEFycmF5KHRoaXMuYnVmZmVyKTtcclxuXHJcbiAgICAgICAgLyoqXHJcbiAgICAgICAgICogQWJzb2x1dGUgcmVhZC93cml0ZSBvZmZzZXQuXHJcbiAgICAgICAgICogQHR5cGUge251bWJlcn1cclxuICAgICAgICAgKiBAZXhwb3NlXHJcbiAgICAgICAgICogQHNlZSBCeXRlQnVmZmVyI2ZsaXBcclxuICAgICAgICAgKiBAc2VlIEJ5dGVCdWZmZXIjY2xlYXJcclxuICAgICAgICAgKi9cclxuICAgICAgICB0aGlzLm9mZnNldCA9IDA7XHJcblxyXG4gICAgICAgIC8qKlxyXG4gICAgICAgICAqIE1hcmtlZCBvZmZzZXQuXHJcbiAgICAgICAgICogQHR5cGUge251bWJlcn1cclxuICAgICAgICAgKiBAZXhwb3NlXHJcbiAgICAgICAgICogQHNlZSBCeXRlQnVmZmVyI21hcmtcclxuICAgICAgICAgKiBAc2VlIEJ5dGVCdWZmZXIjcmVzZXRcclxuICAgICAgICAgKi9cclxuICAgICAgICB0aGlzLm1hcmtlZE9mZnNldCA9IC0xO1xyXG5cclxuICAgICAgICAvKipcclxuICAgICAgICAgKiBBYnNvbHV0ZSBsaW1pdCBvZiB0aGUgY29udGFpbmVkIGRhdGEuIFNldCB0byB0aGUgYmFja2luZyBidWZmZXIncyBjYXBhY2l0eSB1cG9uIGFsbG9jYXRpb24uXHJcbiAgICAgICAgICogQHR5cGUge251bWJlcn1cclxuICAgICAgICAgKiBAZXhwb3NlXHJcbiAgICAgICAgICogQHNlZSBCeXRlQnVmZmVyI2ZsaXBcclxuICAgICAgICAgKiBAc2VlIEJ5dGVCdWZmZXIjY2xlYXJcclxuICAgICAgICAgKi9cclxuICAgICAgICB0aGlzLmxpbWl0ID0gY2FwYWNpdHk7XHJcblxyXG4gICAgICAgIC8qKlxyXG4gICAgICAgICAqIFdoZXRoZXIgdG8gdXNlIGxpdHRsZSBlbmRpYW4gYnl0ZSBvcmRlciwgZGVmYXVsdHMgdG8gYGZhbHNlYCBmb3IgYmlnIGVuZGlhbi5cclxuICAgICAgICAgKiBAdHlwZSB7Ym9vbGVhbn1cclxuICAgICAgICAgKiBAZXhwb3NlXHJcbiAgICAgICAgICovXHJcbiAgICAgICAgdGhpcy5saXR0bGVFbmRpYW4gPSBsaXR0bGVFbmRpYW47XHJcblxyXG4gICAgICAgIC8qKlxyXG4gICAgICAgICAqIFdoZXRoZXIgdG8gc2tpcCBhc3NlcnRpb25zIG9mIG9mZnNldHMgYW5kIHZhbHVlcywgZGVmYXVsdHMgdG8gYGZhbHNlYC5cclxuICAgICAgICAgKiBAdHlwZSB7Ym9vbGVhbn1cclxuICAgICAgICAgKiBAZXhwb3NlXHJcbiAgICAgICAgICovXHJcbiAgICAgICAgdGhpcy5ub0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cclxuICAgICAgICAgICAgbGl0dGxlRW5kaWFuID0gZW5jb2Rpbmc7XHJcbiAgICAgICAgICAgIGVuY29kaW5nID0gdW5kZWZpbmVkO1xyXG4gICAgICAgIH1cclxuICAgICAgICBpZiAodHlwZW9mIGJ1ZmZlciA9PT0gJ3N0cmluZycpIHtcclxuICAgICAgICAgICAgaWYgKHR5cGVvZiBlbmNvZGluZyA9PT0gJ3VuZGVmaW5lZCcpXHJcbiAgICAgICAgICAgICAgICBlbmNvZGluZyA9IFwidXRmOFwiO1xyXG4gICAgICAgICAgICBzd2l0Y2ggKGVuY29kaW5nKSB7XHJcbiAgICAgICAgICAgICAgICBjYXNlIFwiYmFzZTY0XCI6XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEJ5dGVCdWZmZXIuZnJvbUJhc2U2NChidWZmZXIsIGxpdHRsZUVuZGlhbik7XHJcbiAgICAgICAgICAgICAgICBjYXNlIFwiaGV4XCI6XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEJ5dGVCdWZmZXIuZnJvbUhleChidWZmZXIsIGxpdHRsZUVuZGlhbik7XHJcbiAgICAgICAgICAgICAgICBjYXNlIFwiYmluYXJ5XCI6XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEJ5dGVCdWZmZXIuZnJvbUJpbmFyeShidWZmZXIsIGxpdHRsZUVuZGlhbik7XHJcbiAgICAgICAgICAgICAgICBjYXNlIFwidXRmOFwiOlxyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBCeXRlQnVmZmVyLmZyb21VVEY4KGJ1ZmZlciwgbGl0dGxlRW5kaWFuKTtcclxuICAgICAgICAgICAgICAgIGNhc2UgXCJkZWJ1Z1wiOlxyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBCeXRlQnVmZmVyLmZyb21EZWJ1ZyhidWZmZXIsIGxpdHRsZUVuZGlhbik7XHJcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxyXG4gICAgICAgICAgICAg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5dGVzID0gKGJpdHMgPj4gMyksXHJcbiAgICAgICAgICBiaXQgPSAwLFxyXG4gICAgICAgICAgdmFsdWUgPSBbXSxcclxuICAgICAgICAgIGs7XHJcblxyXG4gICAgICBvZmZzZXQgKz0gcmV0Lmxlbmd0aDtcclxuXHJcbiAgICAgIHdoaWxlKGJ5dGVzLS0pIHtcclxuICAgICAgICBrID0gdGhpcy5yZWFkQnl0ZShvZmZzZXQrKyk7XHJcbiAgICAgICAgdmFsdWVbYml0KytdID0gISEoayAmIDB4MDEpO1xyXG4gICAgICAgIHZhbHVlW2JpdCsrXSA9ICEhKGsgJiAweDAyKTtcclxuICAgICAgICB2YWx1ZVtiaXQrK10gPSAhIShrICYgMHgwNCk7XHJcbiAgICAgICAgdmFsdWVbYml0KytdID0gISEoayAmIDB4MDgpO1xyXG4gICAgICAgIHZhbHVlW2JpdCsrXSA9ICEhKGsgJiAweDEwKTtcclxuICAgICAgICB2YWx1ZVtiaXQrK10gPSAhIShrICYgMHgyMCk7XHJcbiAgICAgICAgdmFsdWVbYml0KytdID0gISEoayAmIDB4NDApO1xyXG4gICAgICAgIHZhbHVlW2JpdCsrXSA9ICEhKGsgJiAweDgwKTtcclxuICAgICAgfVxyXG5cclxuICAgICAgaWYoYml0IDwgYml0cykge1xyXG4gICAgICAgIHZhciBtID0gMDtcclxuICAgICAgICBrID0gdGhpcy5yZWFkQnl0ZShvZmZzZXQrKyk7XHJcbiAgICAgICAgd2hpbGUoYml0IDwgYml0cykgdmFsdWVbYml0KytdID0gISEoKGsgPj4gKG0rKykpICYgMSk7XHJcbiAgICAgIH1cclxuXHJcbiAgICAgIGlmIChyZWxhdGl2ZSkge1xyXG4gICAgICAgIHRoaXMub2Zmc2V0ID0gb2Zmc2V0O1xyXG4gICAgICB9XHJcbiAgICAgIHJldHVybiB2YWx1ZTtcclxuICAgIH1cclxuICAgIC8qKlxyXG4gICAgICogUmVhZHMgdGhlIHNwZWNpZmllZCBudW1iZXIgb2YgYnl0ZXMu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AgICAgICBpZiAocmVsYXRpdmUpIG9mZnNldCA9IHRoaXMub2Zmc2V0O1xuICAgICAgICAgICAgaWYgKCF0aGlzLm5vQXNzZXJ0KSB7XHJcbiAgICAgICAgICAgICAgICBpZiAodHlwZW9mIHZhbHVlID09PSAnbnVtYmVyJylcbiAgICAgICAgICAgICAgICAgICAgdmFsdWUgPSBMb25nLmZyb21OdW1iZXIodmFsdWUpO1xuICAgICAgICAgICAgICAgIGVsc2UgaWYgKHR5cGVvZiB2YWx1ZSA9PT0gJ3N0cmluZycpXG4gICAgICAgICAgICAgICAgICAgIHZhbHVlID0gTG9uZy5mcm9tU3RyaW5nKHZhbHVlKTtcbiAgICAgICAgICAgICAgICBlbHNlIGlmICghKHZhbHVlICYmIHZhbHVlIGluc3RhbmNlb2YgTG9uZykpXG4gICAgICAgICAgICAgICAgICAgIHRocm93IFR5cGVFcnJvcihcIklsbGVnYWwgdmFsdWU6IFwiK3ZhbHVlK1wiIChub3QgYW4gaW50ZWdlciBvciBMb25nKVwiKTtcbiAgICAgICAgICAgICAgICBpZiAodHlwZW9mIG9mZnNldCAhPT0gJ251bWJlcicgfHwgb2Zmc2V0ICUgMSAhPT0gMClcbiAgICAgICAgICAgICAgICAgICAgdGhyb3cgVHlwZUVycm9yKFwiSWxsZWdhbCBvZmZzZXQ6IFwiK29mZnNldCtcIiAobm90IGFuIGludGVnZXIpXCIpO1xuICAgICAgICAgICAgICAgIG9mZnNldCA+Pj49IDA7XG4gICAgICAgICAgICAgICAgaWYgKG9mZnNldCA8IDAgfHwgb2Zmc2V0ICsgMCA+IHRoaXMuYnVmZmVyLmJ5dGVMZW5ndGgpXG4gICAgICAgICAgICAgICAgICAgIHRocm93IFJhbmdlRXJyb3IoXCJJbGxlZ2FsIG9mZnNldDogMCA8PSBcIitvZmZzZXQrXCIgKCtcIiswK1wiKSA8PSBcIit0aGlzLmJ1ZmZlci5ieXRlTGVuZ3RoKTtcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKHR5cGVvZiB2YWx1ZSA9PT0gJ251bWJlcicpXG4gICAgICAgICAgICAgICAgdmFsdWUgPSBMb25nLmZyb21OdW1iZXIodmFsdWUpO1xuICAgICAgICAgICAgZWxzZSBpZiAodHlwZW9mIHZhbHVlID09PSAnc3RyaW5nJylcbiAgICAgICAgICAgICAgICB2YWx1ZSA9IExvbmcuZnJvbVN0cmluZyh2YWx1ZSk7XG4gICAgICAgICAgICBvZmZzZXQgKz0gODtcbiAgICAgICAgICAgIHZhciBjYXBhY2l0eTYgPSB0aGlzLmJ1ZmZlci5ieXRlTGVuZ3RoO1xuICAgICAgICAgICAgaWYgKG9mZnNldCA+IGNhcGFjaXR5NilcbiAgICAgICAgICAgICAgICB0aGlzLnJlc2l6ZSgoY2FwYWNpdHk2ICo9IDIpID4gb2Zmc2V0ID8gY2FwYWNpdHk2IDogb2Zmc2V0KTtcbiAgICAgICAgICAgIG9mZnNldCAtPSA4O1xuICAgICAgICAgICAgdmFyIGxvID0gdmFsdWUubG93LFxyXG4gICAgICAgICAgICAgICAgaGkgPSB2YWx1ZS5oaWdoO1xyXG4gICAgICAgICAgICBpZiAodGhpcy5saXR0bGVFbmRpYW4pIHtcclxuICAgICAgICAgICAgICAgIHRoaXMudmlld1tvZmZzZXQrM10gPSAobG8gPj4+IDI0KSAmIDB4RkY7XG4gICAgICAgICAgICAgICAgdGhpcy52aWV3W29mZnNldCsyXSA9IChsbyA+Pj4gMTYpICYgMHhGRjtcbiAgICAgICAgICAgICAgICB0aGlzLnZpZXdbb2Zmc2V0KzFdID0gKGxvID4+PiAgOCkgJiAweEZGO1xuICAgICAgICAgICAgICAgIHRoaXMudmlld1tvZmZzZXQgIF0gPSAgbG8gICAgICAgICAmIDB4RkY7XG4gICAgICAgICAgICAgICAgb2Zmc2V0ICs9IDQ7XHJcbiAgICAgICAgICAgICAgICB0aGlzLnZpZXdbb2Zmc2V0KzNdID0gKGhpID4+PiAyNCkgJiAweEZGO1xuICAgICAgICAgICAgICAgIHRoaXMudmlld1tvZmZzZXQrMl0gPSAoaGkgPj4+IDE2KSAmIDB4RkY7XG4gICAgICAgICAgICAgICAgdGhpcy52aWV3W29mZnNldCsxXSA9IChoaSA+Pj4gIDgpICYgMHhGRjtcbiAgICAgICAgICAgICAgICB0aGlzLnZpZXdbb2Zmc2V0ICBdID0gIGhpICAgICAgICAgJiAweEZGO1xuICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgIHRoaXMudmlld1tvZmZzZXQgIF0gPSAoaGkgPj4+IDI0KSAmIDB4RkY7XG4gICAgICAgICAgICAgICAgdGhpcy52aWV3W29mZnNldCsxXSA9IChoaSA+Pj4gMTYpICYgMHhGRjtcbiAgICAgICAgICAgICAgICB0aGlzLnZpZXdbb2Zmc2V0KzJdID0gKGhpID4+PiAgOCkgJiAweEZGO1xuICAgICAgICAgICAgICAgIHRoaXMudmlld1tvZmZzZXQrM10gPSAgaGkgICAgICAgICAmIDB4RkY7XG4gICAgICAgICAgICAgICAgb2Zmc2V0ICs9IDQ7XHJcbiAgICAgICAgICAgICAgICB0aGlzLnZpZXdbb2Zmc2V0ICBdID0gKGxvID4+PiAyNCkgJiAweEZGO1xuICAgICAgICAgICAgICAgIHRoaXMudmlld1tvZmZzZXQrMV0gPSAobG8gPj4+IDE2KSAmIDB4RkY7XG4gICAgICAgICAgICAgICAgdGhpcy52aWV3W29mZnNldCsyXSA9IChsbyA+Pj4gIDgpICYgMHhGRjtcbiAgICAgICAgICAgICAgICB0aGlzLnZpZXdbb2Zmc2V0KzNdID0gIGxvICAgICAgICAgJiAweEZGO1xuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBpZiAocmVsYXRpdmUpIHRoaXMub2Zmc2V0ICs9IDg7XG4gICAgICAgICAgICByZXR1cm4gdGhpcztcclxuICAgICAgICB9O1xyXG5cclxuICAgICAgICAvKipcclxuICAgICAgICAgKiBXcml0ZXMgYSA2NGJpdCBzaWduZWQgaW50ZWdlci4gVGhpcyBp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lmICghdGhpcy5ub0Fzc2VydCkge1xyXG4gICAgICAgICAgICAgICAgaWYgKHR5cGVvZiBvZmZzZXQgIT09ICdudW1iZXInIHx8IG9mZnNldCAlIDEgIT09IDApXG4gICAgICAgICAgICAgICAgICAgIHRocm93IFR5cGVFcnJvcihcIklsbGVnYWwgb2Zmc2V0OiBcIitvZmZzZXQrXCIgKG5vdCBhbiBpbnRlZ2VyKVwiKTtcbiAgICAgICAgICAgICAgICBvZmZzZXQgPj4+PSAwO1xuICAgICAgICAgICAgICAgIGlmIChvZmZzZXQgPCAwIHx8IG9mZnNldCArIDggPiB0aGlzLmJ1ZmZlci5ieXRlTGVuZ3RoKVxuICAgICAgICAgICAgICAgICAgICB0aHJvdyBSYW5nZUVycm9yKFwiSWxsZWdhbCBvZmZzZXQ6IDAgPD0gXCIrb2Zmc2V0K1wiICgrXCIrOCtcIikgPD0gXCIrdGhpcy5idWZmZXIuYnl0ZUxlbmd0aCk7XG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHZhciBsbyA9IDAsXHJcbiAgICAgICAgICAgICAgICBoaSA9IDA7XHJcbiAgICAgICAgICAgIGlmICh0aGlzLmxpdHRsZUVuZGlhbikge1xyXG4gICAgICAgICAgICAgICAgbG8gID0gdGhpcy52aWV3W29mZnNldCsyXSA8PCAxNjtcbiAgICAgICAgICAgICAgICBsbyB8PSB0aGlzLnZpZXdbb2Zmc2V0KzFdIDw8ICA4O1xuICAgICAgICAgICAgICAgIGxvIHw9IHRoaXMudmlld1tvZmZzZXQgIF07XG4gICAgICAgICAgICAgICAgbG8gKz0gdGhpcy52aWV3W29mZnNldCszXSA8PCAyNCA+Pj4gMDtcbiAgICAgICAgICAgICAgICBvZmZzZXQgKz0gNDtcclxuICAgICAgICAgICAgICAgIGhpICA9IHRoaXMudmlld1tvZmZzZXQrMl0gPDwgMTY7XG4gICAgICAgICAgICAgICAgaGkgfD0gdGhpcy52aWV3W29mZnNldCsxXSA8PCAgODtcbiAgICAgICAgICAgICAgICBoaSB8PSB0aGlzLnZpZXdbb2Zmc2V0ICBdO1xuICAgICAgICAgICAgICAgIGhpICs9IHRoaXMudmlld1tvZmZzZXQrM10gPDwgMjQgPj4+IDA7XG4gICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgaGkgID0gdGhpcy52aWV3W29mZnNldCsxXSA8PCAxNjtcbiAgICAgICAgICAgICAgICBoaSB8PSB0aGlzLnZpZXdbb2Zmc2V0KzJdIDw8ICA4O1xuICAgICAgICAgICAgICAgIGhpIHw9IHRoaXMudmlld1tvZmZzZXQrM107XG4gICAgICAgICAgICAgICAgaGkgKz0gdGhpcy52aWV3W29mZnNldCAgXSA8PCAyNCA+Pj4gMDtcbiAgICAgICAgICAgICAgICBvZmZzZXQgKz0gNDtcclxuICAgICAgICAgICAgICAgIGxvICA9IHRoaXMudmlld1tvZmZzZXQrMV0gPDwgMTY7XG4gICAgICAgICAgICAgICAgbG8gfD0gdGhpcy52aWV3W29mZnNldCsyXSA8PCAgODtcbiAgICAgICAgICAgICAgICBsbyB8PSB0aGlzLnZpZXdbb2Zmc2V0KzNdO1xuICAgICAgICAgICAgICAgIGxvICs9IHRoaXMudmlld1tvZmZzZXQgIF0gPDwgMjQgPj4+IDA7XG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIHZhciB2YWx1ZSA9IG5ldyBMb25nKGxvLCBoaSwgZmFsc2UpO1xyXG4gICAgICAgICAgICBpZiAocmVsYXRpdmUpIHRoaXMub2Zmc2V0ICs9IDg7XG4gICAgICAgICAgICByZXR1cm4gdmFsdWU7XHJcbiAgICAgICAgfTtcclxuXHJcbiAgICAgICAgLyoqXHJcbiAgICAgICAgICogUmVhZHMgYSA2NGJpdCBzaWduZWQgaW50ZWdlci4gVGhpcyBpcyBhbiBhbGlhcyBvZiB7QGxpbmsgQnl0ZUJ1ZmZlciNyZWFkSW50NjR9LlxyXG4gICAgICAgICAqIEBwYXJhbSB7bnVtYmVyPX0gb2Zmc2V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3N0cmluZycpXG4gICAgICAgICAgICAgICAgdmFsdWUgPSBMb25nLmZyb21TdHJpbmcodmFsdWUpO1xuICAgICAgICAgICAgb2Zmc2V0ICs9IDg7XG4gICAgICAgICAgICB2YXIgY2FwYWNpdHk3ID0gdGhpcy5idWZmZXIuYnl0ZUxlbmd0aDtcbiAgICAgICAgICAgIGlmIChvZmZzZXQgPiBjYXBhY2l0eTcpXG4gICAgICAgICAgICAgICAgdGhpcy5yZXNpemUoKGNhcGFjaXR5NyAqPSAyKSA+IG9mZnNldCA/IGNhcGFjaXR5NyA6IG9mZnNldCk7XG4gICAgICAgICAgICBvZmZzZXQgLT0gODtcbiAgICAgICAgICAgIHZhciBsbyA9IHZhbHVlLmxvdyxcclxuICAgICAgICAgICAgICAgIGhpID0gdmFsdWUuaGlnaDtcclxuICAgICAgICAgICAgaWYgKHRoaXMubGl0dGxlRW5kaWFuKSB7XHJcbiAgICAgICAgICAgICAgICB0aGlzLnZpZXdbb2Zmc2V0KzNdID0gKGxvID4+PiAyNCkgJiAweEZGO1xuICAgICAgICAgICAgICAgIHRoaXMudmlld1tvZmZzZXQrMl0gPSAobG8gPj4+IDE2KSAmIDB4RkY7XG4gICAgICAgICAgICAgICAgdGhpcy52aWV3W29mZnNldCsxXSA9IChsbyA+Pj4gIDgpICYgMHhGRjtcbiAgICAgICAgICAgICAgICB0aGlzLnZpZXdbb2Zmc2V0ICBdID0gIGxvICAgICAgICAgJiAweEZGO1xuICAgICAgICAgICAgICAgIG9mZnNldCArPSA0O1xyXG4gICAgICAgICAgICAgICAgdGhpcy52aWV3W29mZnNldCszXSA9IChoaSA+Pj4gMjQpICYgMHhGRjtcbiAgICAgICAgICAgICAgICB0aGlzLnZpZXdbb2Zmc2V0KzJdID0gKGhpID4+PiAxNikgJiAweEZGO1xuICAgICAgICAgICAgICAgIHRoaXMudmlld1tvZmZzZXQrMV0gPSAoaGkgPj4+ICA4KSAmIDB4RkY7XG4gICAgICAgICAgICAgICAgdGhpcy52aWV3W29mZnNldCAgXSA9ICBoaSAgICAgICAgICYgMHhGRjtcbiAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICB0aGlzLnZpZXdbb2Zmc2V0ICBdID0gKGhpID4+PiAyNCkgJiAweEZGO1xuICAgICAgICAgICAgICAgIHRoaXMudmlld1tvZmZzZXQrMV0gPSAoaGkgPj4+IDE2KSAmIDB4RkY7XG4gICAgICAgICAgICAgICAgdGhpcy52aWV3W29mZnNldCsyXSA9IChoaSA+Pj4gIDgpICYgMHhGRjtcbiAgICAgICAgICAgICAgICB0aGlzLnZpZXdbb2Zmc2V0KzNdID0gIGhpICAgICAgICAgJiAweEZGO1xuICAgICAgICAgICAgICAgIG9mZnNldCArPSA0O1xyXG4gICAgICAgICAgICAgICAgdGhpcy52aWV3W29mZnNldCAgXSA9IChsbyA+Pj4gMjQpICYgMHhGRjtcbiAgICAgICAgICAgICAgICB0aGlzLnZpZXdbb2Zmc2V0KzFdID0gKGxvID4+PiAxNikgJiAweEZGO1xuICAgICAgICAgICAgICAgIHRoaXMudmlld1tvZmZzZXQrMl0gPSAobG8gPj4+ICA4KSAmIDB4RkY7XG4gICAgICAgICAgICAgICAgdGhpcy52aWV3W29mZnNldCszXSA9ICBsbyAgICAgICAgICYgMHhGRjtcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKHJlbGF0aXZlKSB0aGlzLm9mZnNldCArPSA4O1xuICAgICAgICAgICAgcmV0dXJuIHRoaXM7XHJcbiAgICAgICAgfTtcclxuXHJcbiAgICAgICAgLyoqXHJcbiAgICAgICAgICogV3JpdGVzIGEgNjRiaXQgdW5zaWduZWQgaW50ZWdlci4gVGhpcyBpcyBhbiBhbGlhcyBvZiB7QGxpbmsgQnl0ZUJ1ZmZlciN3cml0ZVVpbnQ2NH0uXHJcbiAgICAgICAgICogQGZ1bmN0aW9uXHJcbiAgICAgICAgICogQHBhcmFtIHtudW1iZXJ8IUxvbmd9IHZhbHVlIFZhbHVl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zZXQgJSAxICE9PSAwKVxuICAgICAgICAgICAgICAgICAgICB0aHJvdyBUeXBlRXJyb3IoXCJJbGxlZ2FsIG9mZnNldDogXCIrb2Zmc2V0K1wiIChub3QgYW4gaW50ZWdlcilcIik7XG4gICAgICAgICAgICAgICAgb2Zmc2V0ID4+Pj0gMDtcbiAgICAgICAgICAgICAgICBpZiAob2Zmc2V0IDwgMCB8fCBvZmZzZXQgKyA4ID4gdGhpcy5idWZmZXIuYnl0ZUxlbmd0aClcbiAgICAgICAgICAgICAgICAgICAgdGhyb3cgUmFuZ2VFcnJvcihcIklsbGVnYWwgb2Zmc2V0OiAwIDw9IFwiK29mZnNldCtcIiAoK1wiKzgrXCIpIDw9IFwiK3RoaXMuYnVmZmVyLmJ5dGVMZW5ndGgpO1xuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB2YXIgbG8gPSAwLFxyXG4gICAgICAgICAgICAgICAgaGkgPSAwO1xyXG4gICAgICAgICAgICBpZiAodGhpcy5saXR0bGVFbmRpYW4pIHtcclxuICAgICAgICAgICAgICAgIGxvICA9IHRoaXMudmlld1tvZmZzZXQrMl0gPDwgMTY7XG4gICAgICAgICAgICAgICAgbG8gfD0gdGhpcy52aWV3W29mZnNldCsxXSA8PCAgODtcbiAgICAgICAgICAgICAgICBsbyB8PSB0aGlzLnZpZXdbb2Zmc2V0ICBdO1xuICAgICAgICAgICAgICAgIGxvICs9IHRoaXMudmlld1tvZmZzZXQrM10gPDwgMjQgPj4+IDA7XG4gICAgICAgICAgICAgICAgb2Zmc2V0ICs9IDQ7XHJcbiAgICAgICAgICAgICAgICBoaSAgPSB0aGlzLnZpZXdbb2Zmc2V0KzJdIDw8IDE2O1xuICAgICAgICAgICAgICAgIGhpIHw9IHRoaXMudmlld1tvZmZzZXQrMV0gPDwgIDg7XG4gICAgICAgICAgICAgICAgaGkgfD0gdGhpcy52aWV3W29mZnNldCAgXTtcbiAgICAgICAgICAgICAgICBoaSArPSB0aGlzLnZpZXdbb2Zmc2V0KzNdIDw8IDI0ID4+PiAwO1xuICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgIGhpICA9IHRoaXMudmlld1tvZmZzZXQrMV0gPDwgMTY7XG4gICAgICAgICAgICAgICAgaGkgfD0gdGhpcy52aWV3W29mZnNldCsyXSA8PCAgODtcbiAgICAgICAgICAgICAgICBoaSB8PSB0aGlzLnZpZXdbb2Zmc2V0KzNdO1xuICAgICAgICAgICAgICAgIGhpICs9IHRoaXMudmlld1tvZmZzZXQgIF0gPDwgMjQgPj4+IDA7XG4gICAgICAgICAgICAgICAgb2Zmc2V0ICs9IDQ7XHJcbiAgICAgICAgICAgICAgICBsbyAgPSB0aGlzLnZpZXdbb2Zmc2V0KzFdIDw8IDE2O1xuICAgICAgICAgICAgICAgIGxvIHw9IHRoaXMudmlld1tvZmZzZXQrMl0gPDwgIDg7XG4gICAgICAgICAgICAgICAgbG8gfD0gdGhpcy52aWV3W29mZnNldCszXTtcbiAgICAgICAgICAgICAgICBsbyArPSB0aGlzLnZpZXdbb2Zmc2V0ICBdIDw8IDI0ID4+PiAwO1xuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB2YXIgdmFsdWUgPSBuZXcgTG9uZyhsbywgaGksIHRydWUpO1xyXG4gICAgICAgICAgICBpZiAocmVsYXRpdmUpIHRoaXMub2Zmc2V0ICs9IDg7XG4gICAgICAgICAgICByZXR1cm4gdmFsdWU7XHJcbiAgICAgICAgfTtcclxuXHJcbiAgICAgICAgLyoqXHJcbiAgICAgICAgICogUmVhZHMgYSA2NGJpdCB1bnNpZ25lZCBpbnRlZ2VyLiBUaGlzIGlzIGFuIGFsaWFzIG9mIHtAbGluayBCeXRlQnVmZmVyI3JlYWRVaW50NjR9LlxyXG4gICAgICAgICAqIEBmdW5jdGlvblxyXG4gICAgICAgICAqIEBwYXJhbSB7bnVtYmVyPX0gb2Zmc2V0IE9mZnNldCB0byByZWFkIGZyb20uIFdpbGwgdXNlIGFuZCBpbmNy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Zyb20gYSBieXRlIGFycmF5LlxyXG4gICAgICogQHBhcmFtIHshQXJyYXl9IGJ1ZmZlclxyXG4gICAgICogQHBhcmFtIHtudW1iZXJ9IG9mZnNldFxyXG4gICAgICogQHBhcmFtIHtib29sZWFufSBpc0xFXHJcbiAgICAgKiBAcGFyYW0ge251bWJlcn0gbUxlblxyXG4gICAgICogQHBhcmFtIHtudW1iZXJ9IG5CeXRlc1xyXG4gICAgICogQHJldHVybnMge251bWJlcn1cclxuICAgICAqIEBpbm5lclxyXG4gICAgICovXHJcbiAgICBmdW5jdGlvbiBpZWVlNzU0X3JlYWQoYnVmZmVyLCBvZmZzZXQsIGlzTEUsIG1MZW4sIG5CeXRlcykge1xyXG4gICAgICAgIHZhciBlLCBtLFxyXG4gICAgICAgICAgICBlTGVuID0gbkJ5dGVzICogOCAtIG1MZW4gLSAxLFxyXG4gICAgICAgICAgICBlTWF4ID0gKDEgPDwgZUxlbikgLSAxLFxyXG4gICAgICAgICAgICBlQmlhcyA9IGVNYXggPj4gMSxcclxuICAgICAgICAgICAgbkJpdHMgPSAtNyxcclxuICAgICAgICAgICAgaSA9IGlzTEUgPyAobkJ5dGVzIC0gMSkgOiAwLFxyXG4gICAgICAgICAgICBkID0gaXNMRSA/IC0xIDogMSxcclxuICAgICAgICAgICAgcyA9IGJ1ZmZlcltvZmZzZXQgKyBpXTtcclxuXHJcbiAgICAgICAgaSArPSBkO1xyXG5cclxuICAgICAgICBlID0gcyAmICgoMSA8PCAoLW5CaXRzKSkgLSAxKTtcclxuICAgICAgICBzID4+PSAoLW5CaXRzKTtcclxuICAgICAgICBuQml0cyArPSBlTGVuO1xyXG4gICAgICAgIGZvciAoOyBuQml0cyA+IDA7IGUgPSBlICogMjU2ICsgYnVmZmVyW29mZnNldCArIGldLCBpICs9IGQsIG5CaXRzIC09IDgpIHt9XHJcblxyXG4gICAgICAgIG0gPSBlICYgKCgxIDw8ICgtbkJpdHMpKSAtIDEpO1xyXG4gICAgICAgIGUgPj49IC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xyXG4gICAgICAgICAgICBlTGVuID0gbkJ5dGVzICogOCAtIG1MZW4gLSAxLFxyXG4gICAgICAgICAgICBlTWF4ID0gKDEgPDwgZUxlbikgLSAxLFxyXG4gICAgICAgICAgICBlQmlhcyA9IGVNYXggPj4gMSxcclxuICAgICAgICAgICAgcnQgPSAobUxlbiA9PT0gMjMgPyBNYXRoLnBvdygyLCAtMjQpIC0gTWF0aC5wb3coMiwgLTc3KSA6IDApLFxyXG4gICAgICAgICAgICBpID0gaXNMRSA/IDAgOiAobkJ5dGVzIC0gMSksXHJcbiAgICAgICAgICAgIGQgPSBpc0xFID8gMSA6IC0xLFxyXG4gICAgICAgICAgICBzID0gdmFsdWUgPCAwIHx8ICh2YWx1ZSA9PT0gMCAmJiAxIC8gdmFsdWUgPCAwKSA/IDEgOiAwO1xyXG5cclxuICAgICAgICB2YWx1ZSA9IE1hdGguYWJzKHZhbHVlKTtcclxuXHJcbiAgICAgICAgaWYgKGlzTmFOKHZhbHVlKSB8fCB2YWx1ZSA9PT0gSW5maW5pdHkpIHtcclxuICAgICAgICAgICAgbSA9IGlzTmFOKHZhbHVlKSA/IDEgOiAwO1xyXG4gICAgICAgICAgICBlID0gZU1heDtcclxuICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICBlID0gTWF0aC5mbG9vcihNYXRoLmxvZyh2YWx1ZSkgLyBNYXRoLkxOMik7XHJcbiAgICAgICAgICAgIGlmICh2YWx1ZSAqIChjID0gTWF0aC5wb3coMiwgLWUpKSA8IDEpIHtcclxuICAgICAgICAgICAgICAgIGUtLTtcclxuICAgICAgICAgICAgICAgIGMgKj0gMjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBpZiAoZSArIGVCaWFzID49IDEpIHtcclxuICAgICAgICAgICAgICAgIHZhbHVlICs9IHJ0IC8gYztcclxuICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgIHZhbHVlICs9IHJ0ICogTWF0aC5wb3coMiwgMSAtIGVCaWFzKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBpZiAodmFsdWUgKiBjID49IDIpIHtcclxuICAgICAgICAgICAgICAgIGUrKztcclxuICAgICAgICAgICAgICAgIGMgLz0gMjtcclxuICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgaWYgKGUgKyBlQmlhcyA+PSBlTWF4KSB7XHJcbiAgICAgICAgICAgICAgICBtID0gMDtcclxuICAgICAgICAgICAgICAgIGUgPSBlTWF4O1xyXG4gICAgICAgICAgICB9IGVsc2UgaWYgKGUgKyBlQmlhcyA+PSAxKSB7XHJcbiAgICAgICAgICAgICAgICBtID0gKHZhbHVlICogYyAtIDEpICogTWF0aC5wb3coMiwgbUxlbik7XHJcbiAgICAgICAgICAgICAgICBlID0gZSArIGVCaWFzO1xyXG4gICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgbSA9IHZhbHVlICogTWF0aC5wb3coMiwgZUJpYXMgLSAxKSAqIE1hdGgucG93KDIsIG1MZW4pO1xyXG4gICAgICAgICAgICAgICAgZSA9IDA7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9XHJcblxyXG4gICAgICAgIGZvciAoOyBtTGVuID49IDg7IGJ1ZmZlcltvZmZzZXQgKyBpXSA9IG0gJiAweGZmLCBpICs9IGQsIG0gLz0gMjU2LCBtTGVuIC09IDgpIHt9XHJcblxyXG4gICAgICAgIGUgPSAoZSA8PCBtTGVuKSB8IG07XHJcbiAgICAgICAgZUxlbiArPSBtTGVuO1xyXG4gICAgICAgIGZvciAoOyBlTGVuID4gMDsgYnVmZmVyW29mZnNldCArIGldID0gZSAmIDB4ZmYsIGkgKz0gZCwgZSAvPSAyNTYsIGVMZW4gLT0gOCkge31cclxuXHJcbiAgICAgICAgYnVmZmVyW29mZnNldCArIGkgLSBkXSB8PSBzICogMTI4O1xyXG4gICAgfVxyXG5cclxuICAgIC8qKlxyXG4gICAgICogV3JpdGVzIGEgMzJiaX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lzLmJ1ZmZlci5ieXRlTGVuZ3RoKTtcbiAgICAgICAgfVxyXG4gICAgICAgIHZhciBjID0gMCxcclxuICAgICAgICAgICAgdmFsdWUgPSAwID4+PiAwLFxyXG4gICAgICAgICAgICBiO1xyXG4gICAgICAgIGRvIHtcclxuICAgICAgICAgICAgaWYgKCF0aGlzLm5vQXNzZXJ0ICYmIG9mZnNldCA+IHRoaXMubGltaXQpIHtcclxuICAgICAgICAgICAgICAgIHZhciBlcnIgPSBFcnJvcihcIlRydW5jYXRlZFwiKTtcclxuICAgICAgICAgICAgICAgIGVyclsndHJ1bmNhdGVkJ10gPSB0cnVlO1xyXG4gICAgICAgICAgICAgICAgdGhyb3cgZXJyO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGIgPSB0aGlzLnZpZXdbb2Zmc2V0KytdO1xyXG4gICAgICAgICAgICBpZiAoYyA8IDUpXHJcbiAgICAgICAgICAgICAgICB2YWx1ZSB8PSAoYiAmIDB4N2YpIDw8ICg3KmMpO1xyXG4gICAgICAgICAgICArK2M7XHJcbiAgICAgICAgfSB3aGlsZSAoKGIgJiAweDgwKSAhPT0gMCk7XHJcbiAgICAgICAgdmFsdWUgfD0gMDtcclxuICAgICAgICBpZiAocmVsYXRpdmUpIHtcclxuICAgICAgICAgICAgdGhpcy5vZmZzZXQgPSBvZmZzZXQ7XHJcbiAgICAgICAgICAgIHJldHVybiB2YWx1ZTtcclxuICAgICAgICB9XHJcbiAgICAgICAgcmV0dXJuIHtcclxuICAgICAgICAgICAgXCJ2YWx1ZVwiOiB2YWx1ZSxcclxuICAgICAgICAgICAgXCJsZW5ndGhcIjogY1xyXG4gICAgICAgIH07XHJcbiAgICB9O1xyXG5cclxuICAgIC8qKlxyXG4gICAgICogUmVhZHMgYSB6aWctemFnIGVuY29kZWQgKHNpZ25lZCkgMzJiaXQgYmFzZSAxMjggdmFyaWFibGUtbGVuZ3RoIGludGVnZXIuXHJcbiAgICAgKiBAcGFyYW0ge251bWJl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vL2NvZGVkX3N0cmVhbS5jY1xyXG4gICAgICAgICAgICB2YXIgcGFydDAgPSB2YWx1ZS50b0ludCgpID4+PiAwLFxyXG4gICAgICAgICAgICAgICAgcGFydDEgPSB2YWx1ZS5zaGlmdFJpZ2h0VW5zaWduZWQoMjgpLnRvSW50KCkgPj4+IDAsXHJcbiAgICAgICAgICAgICAgICBwYXJ0MiA9IHZhbHVlLnNoaWZ0UmlnaHRVbnNpZ25lZCg1NikudG9JbnQoKSA+Pj4gMDtcclxuICAgICAgICAgICAgaWYgKHBhcnQyID09IDApIHtcclxuICAgICAgICAgICAgICAgIGlmIChwYXJ0MSA9PSAwKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKHBhcnQwIDwgMSA8PCAxNClcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHBhcnQwIDwgMSA8PCA3ID8gMSA6IDI7XHJcbiAgICAgICAgICAgICAgICAgICAgZWxzZVxyXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcGFydDAgPCAxIDw8IDIxID8gMyA6IDQ7XHJcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgIGlmIChwYXJ0MSA8IDEgPDwgMTQpXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBwYXJ0MSA8IDEgPDwgNyA/IDUgOiA2O1xyXG4gICAgICAgICAgICAgICAgICAgIGVsc2VcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHBhcnQxIDwgMSA8PCAyMSA/IDcgOiA4O1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9IGVsc2VcclxuICAgICAgICAgICAgICAgIHJldHVybiBwYXJ0MiA8IDEgPDwgNyA/IDkgOiAxMDtcclxuICAgICAgICB9O1xyXG5cclxuICAgICAgICAvKipcclxuICAgICAgICAgKiBaaWd6YWcgZW5jb2RlcyBhIHNpZ25lZCA2NGJpdCBpbnRlZ2Vy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nQxID4+PiAgNykgfCAweDgwIDogKHBhcnQxID4+PiAgNykgJiAweDdGO1xyXG4gICAgICAgICAgICAgICAgY2FzZSA1IDogdGhpcy52aWV3W29mZnNldCs0XSA9IHNpemUgIT09IDUgPyAocGFydDEgICAgICAgKSB8IDB4ODAgOiAocGFydDEgICAgICAgKSAmIDB4N0Y7XHJcbiAgICAgICAgICAgICAgICBjYXNlIDQgOiB0aGlzLnZpZXdbb2Zmc2V0KzNdID0gc2l6ZSAhPT0gNCA/IChwYXJ0MCA+Pj4gMjEpIHwgMHg4MCA6IChwYXJ0MCA+Pj4gMjEpICYgMHg3RjtcclxuICAgICAgICAgICAgICAgIGNhc2UgMyA6IHRoaXMudmlld1tvZmZzZXQrMl0gPSBzaXplICE9PSAzID8gKHBhcnQwID4+PiAxNCkgfCAweDgwIDogKHBhcnQwID4+PiAxNCkgJiAweDdGO1xyXG4gICAgICAgICAgICAgICAgY2FzZSAyIDogdGhpcy52aWV3W29mZnNldCsxXSA9IHNpemUgIT09IDIgPyAocGFydDAgPj4+ICA3KSB8IDB4ODAgOiAocGFydDAgPj4+ICA3KSAmIDB4N0Y7XHJcbiAgICAgICAgICAgICAgICBjYXNlIDEgOiB0aGlzLnZpZXdbb2Zmc2V0ICBdID0gc2l6ZSAhPT0gMSA/IChwYXJ0MCAgICAgICApIHwgMHg4MCA6IChwYXJ0MCAgICAgICApICYgMHg3RjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBpZiAocmVsYXRpdmUpIHtcclxuICAgICAgICAgICAgICAgIHRoaXMub2Zmc2V0ICs9IHNpemU7XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gdGhpcztcclxuICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgIHJldHVybiBzaXplO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgfTtcclxuXHJcbiAgICAgICAgLyoqXHJcbiAgICAgICAgICogV3JpdGVzIGEgemlnLXphZyBlbmNvZGVkIDY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rb2Zmc2V0K1wiICgrXCIrMStcIikgPD0gXCIrdGhpcy5idWZmZXIuYnl0ZUxlbmd0aCk7XG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIC8vIHJlZjogc3JjL2dvb2dsZS9wcm90b2J1Zi9pby9jb2RlZF9zdHJlYW0uY2NcclxuICAgICAgICAgICAgdmFyIHN0YXJ0ID0gb2Zmc2V0LFxyXG4gICAgICAgICAgICAgICAgcGFydDAgPSAwLFxyXG4gICAgICAgICAgICAgICAgcGFydDEgPSAwLFxyXG4gICAgICAgICAgICAgICAgcGFydDIgPSAwLFxyXG4gICAgICAgICAgICAgICAgYiAgPSAwO1xyXG4gICAgICAgICAgICBiID0gdGhpcy52aWV3W29mZnNldCsrXTsgcGFydDAgID0gKGIgJiAweDdGKSAgICAgIDsgaWYgKCBiICYgMHg4MCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICkge1xyXG4gICAgICAgICAgICBiID0gdGhpcy52aWV3W29mZnNldCsrXTsgcGFydDAgfD0gKGIgJiAweDdGKSA8PCAgNzsgaWYgKChiICYgMHg4MCkgfHwgKHRoaXMubm9Bc3NlcnQgJiYgdHlwZW9mIGIgPT09ICd1bmRlZmluZWQnKSkge1xyXG4gICAgICAgICAgICBiID0gdGhpcy52aWV3W29mZnNldCsrXTsgcGFydDAgfD0gKGIgJiAweDdGKSA8PCAxNDsgaWYgKChiICYgMHg4MCkgfHwgKHRoaXMubm9Bc3NlcnQgJiYgdHlwZW9mIGIgPT09ICd1bmRlZmluZWQnKSkge1xyXG4gICAgICAgICAgICBiID0gdGhpcy52aWV3W29mZnNldCsrXTsgcGFydDAgfD0gKGIgJiAweDdGKSA8PCAyMTsgaWYgKChiICYgMHg4MCkgfHwgKHRoaXMubm9Bc3NlcnQgJiYgdHlwZW9mIGIgPT09ICd1bmRlZmluZWQnKSkge1xyXG4gICAgICAgICAgICBiID0gdGhpcy52aWV3W29mZnNldCsrXTsgcGFydDEgID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JpdHMocGFydDAgfCAocGFydDEgPDwgMjgpLCAocGFydDEgPj4+IDQpIHwgKHBhcnQyKSA8PCAyNCwgZmFsc2UpO1xyXG4gICAgICAgICAgICBpZiAocmVsYXRpdmUpIHtcclxuICAgICAgICAgICAgICAgIHRoaXMub2Zmc2V0ID0gb2Zmc2V0O1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuIHZhbHVlO1xyXG4gICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuIHtcclxuICAgICAgICAgICAgICAgICAgICAndmFsdWUnOiB2YWx1ZSxcclxuICAgICAgICAgICAgICAgICAgICAnbGVuZ3RoJzogb2Zmc2V0LXN0YXJ0XHJcbiAgICAgICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgfTtcclxuXHJcbiAgICAgICAgLyoqXHJcbiAgICAgICAgICogUmVhZHMgYSB6aWctemFnIGVuY29kZWQgNjRiaXQgYmFzZSAxMjggdmFyaWFibGUtbGVuZ3RoIGludGVnZXIuIFJlcXVpcmVzIExvbmcuanMuXHJcbiAgICAgICAgICogQHBhcmFtIHtudW1iZXI9fSBvZmZzZXQgT2Zmc2V0IHRvIHJlYWQgZnJvbS4gV2lsbCB1c2UgYW5kIGluY3JlYXNlIHtAbGluayBCeXRlQnVmZmVyI29mZnNldH0gYnkgdGhlIG51bWJlciBvZiBieXRlc1xyXG4gICAgICAgICAqICByZWFkIGlmIG9taXR0ZWQuXHJcbiAgICAgICAgICogQHJldHVybnMgeyFMb25nfCF7dmFsdWU6IExvbmcsIGxlbmd0aDogbnVtYmVyfX0gVGhlIHZhbHVlIHJlYWQgaWYgb2Zmc2V0IGlzIG9taXR0ZWQsIGVsc2UgdGhlIHZhbHVlIHJlYWQgYW5kXHJcbiAgICAgICAgICogIHRoZSBhY3R1YWwgbnVtYmVyIG9mIGJ5dGVzIHJlYWQuXHJcbiAgICAgICAgICogQHRocm93cyB7RXJyb3J9IElmIGl0J3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ydClbMV07XHJcbiAgICAgICAgb2Zmc2V0ICs9IDQraztcbiAgICAgICAgdmFyIGNhcGFjaXR5MTMgPSB0aGlzLmJ1ZmZlci5ieXRlTGVuZ3RoO1xuICAgICAgICBpZiAob2Zmc2V0ID4gY2FwYWNpdHkxMylcbiAgICAgICAgICAgIHRoaXMucmVzaXplKChjYXBhY2l0eTEzICo9IDIpID4gb2Zmc2V0ID8gY2FwYWNpdHkxMyA6IG9mZnNldCk7XG4gICAgICAgIG9mZnNldCAtPSA0K2s7XG4gICAgICAgIGlmICh0aGlzLmxpdHRsZUVuZGlhbikge1xuICAgICAgICAgICAgdGhpcy52aWV3W29mZnNldCszXSA9IChrID4+PiAyNCkgJiAweEZGO1xuICAgICAgICAgICAgdGhpcy52aWV3W29mZnNldCsyXSA9IChrID4+PiAxNikgJiAweEZGO1xuICAgICAgICAgICAgdGhpcy52aWV3W29mZnNldCsxXSA9IChrID4+PiAgOCkgJiAweEZGO1xuICAgICAgICAgICAgdGhpcy52aWV3W29mZnNldCAgXSA9ICBrICAgICAgICAgJiAweEZGO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgdGhpcy52aWV3W29mZnNldCAgXSA9IChrID4+PiAyNCkgJiAweEZGO1xuICAgICAgICAgICAgdGhpcy52aWV3W29mZnNldCsxXSA9IChrID4+PiAxNikgJiAweEZGO1xuICAgICAgICAgICAgdGhpcy52aWV3W29mZnNldCsyXSA9IChrID4+PiAgOCkgJiAweEZGO1xuICAgICAgICAgICAgdGhpcy52aWV3W29mZnNldCszXSA9ICBrICAgICAgICAgJiAweEZGO1xuICAgICAgICB9XG4gICAgICAgIG9mZnNldCArPSA0O1xyXG4gICAgICAgIHV0ZnguZW5jb2RlVVRGMTZ0b1VURjgoc3RyaW5nU291cmNlKHN0ciksIGZ1bmN0aW9uKGIpIHtcclxuICAgICAgICAgICAgdGhpcy52aWV3W29mZnNldCsrXSA9IGI7XHJcbiAgICAgICAgfS5iaW5kKHRoaXMpKTtcclxu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AgICAgfS5iaW5kKHRoaXMpLCBmdW5jdGlvbihjcCkge1xyXG4gICAgICAgICAgICAgICAgKytpOyB1dGZ4LlVURjh0b1VURjE2KGNwLCBzZCk7XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICBpZiAoaSAhPT0gbGVuZ3RoKVxyXG4gICAgICAgICAgICAgICAgdGhyb3cgUmFuZ2VFcnJvcihcIklsbGVnYWwgcmFuZ2U6IFRydW5jYXRlZCBkYXRhLCBcIitpK1wiID09IFwiK2xlbmd0aCk7XHJcbiAgICAgICAgICAgIGlmIChyZWxhdGl2ZSkge1xyXG4gICAgICAgICAgICAgICAgdGhpcy5vZmZzZXQgPSBvZmZzZXQ7XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gc2QoKTtcclxuICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgIHJldHVybiB7XHJcbiAgICAgICAgICAgICAgICAgICAgXCJzdHJpbmdcIjogc2QoKSxcclxuICAgICAgICAgICAgICAgICAgICBcImxlbmd0aFwiOiBvZmZzZXQgLSBzdGFydFxyXG4gICAgICAgICAgICAgICAgfTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH0gZWxzZSBpZiAobWV0cmljcyA9PT0gQnl0ZUJ1ZmZlci5NRVRSSUNTX0JZVEVTKSB7XHJcbiAgICAgICAgICAgIGlmICghdGhpcy5ub0Fzc2VydCkge1xyXG4gICAgICAgICAgICAgICAgaWYgKHR5cGVvZiBvZmZzZXQgIT09ICdudW1iZXInIHx8IG9mZnNldCAlIDEgIT09IDApXG4gICAgICAgICAgICAgICAgICAgIHRocm93IFR5cGVFcnJvcihcIklsbGVnYWwgb2Zmc2V0OiBcIitvZmZzZXQrXCIgKG5vdCBhbiBpbnRlZ2VyKVwiKTtcbiAgICAgICAgICAgICAgICBvZmZzZXQgPj4+PSAwO1xuICAgICAgICAgICAgICAgIGlmIChvZmZzZXQgPCAwIHx8IG9mZnNldCArIGxlbmd0aCA+IHRoaXMuYnVmZmVyLmJ5dGVMZW5ndGgpXG4gICAgICAgICAgICAgICAgICAgIHRocm93IFJhbmdlRXJyb3IoXCJJbGxlZ2FsIG9mZnNldDogMCA8PSBcIitvZmZzZXQrXCIgKCtcIitsZW5ndGgrXCIpIDw9IFwiK3RoaXMuYnVmZmVyLmJ5dGVMZW5ndGgpO1xuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB2YXIgayA9IG9mZnNldCArIGxlbmd0aDtcclxuICAgICAgICAgICAgdXRmeC5kZWNvZGVVVEY4dG9VVEYxNihmdW5jdGlvbigpIHtcclxuICAgICAgICAgICAgICAgIHJldHVybiBvZmZzZXQgPCBrID8gdGhpcy52aWV3W29mZnNldCsrXSA6IG51bGw7XHJcbiAgICAgICAgICAgIH0uYmluZCh0aGlzKSwgc2QgPSBzdHJpbmdEZXN0aW5hdGlvbigpLCB0aGlzLm5vQXNzZXJ0KTtcclxuICAgICAgICAgICAgaWYgKG9mZnNldCAhPT0gaylcclxuICAgICAgICAgICAgICAgIHRocm93IFJhbmdlRXJyb3IoXCJJbGxlZ2FsIHJhbmdlOiBUcnVuY2F0ZWQgZGF0YSwgXCIrb2Zmc2V0K1wiID09IFwiK2spO1xyXG4gICAgICAgICAgICBpZiAocmVsYXRpdmUpIHtcclxuICAgICAgICAgICAgICAgIHRoaXMub2Zmc2V0ID0gb2Zmc2V0O1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuIHNkKCk7XHJcbiAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm4ge1xyXG4gICAgICAgICAgICAgICAgICAgICdzdHJpbmcnOiBzZCgpLFxyXG4gICAgICAgICAgICAgICAgICAgICdsZW5ndGgnOiBvZmZzZXQgLSBzdGFydFxyXG4gICAgICAgICAgICAgICAgfTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH0gZWxzZVxyXG4gICAgICAgICAgICB0aHJvdyBUeXBlRXJyb3IoXCJVbnN1cHBv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bHRzIHRvIHtAbGluayBCeXRlQnVmZmVyI2xpbWl0fVxyXG4gICAgICogQHJldHVybnMge3N0cmluZ30gU3RyaW5nIHJlcHJlc2VudGF0aW9uXHJcbiAgICAgKiBAdGhyb3dzIHtFcnJvcn0gSWYgYGVuY29kaW5nYCBpcyBpbnZhbGlkXHJcbiAgICAgKiBAZXhwb3NlXHJcbiAgICAgKi9cclxuICAgIEJ5dGVCdWZmZXJQcm90b3R5cGUudG9TdHJpbmcgPSBmdW5jdGlvbihlbmNvZGluZywgYmVnaW4sIGVuZCkge1xyXG4gICAgICAgIGlmICh0eXBlb2YgZW5jb2RpbmcgPT09ICd1bmRlZmluZWQnKVxyXG4gICAgICAgICAgICByZXR1cm4gXCJCeXRlQnVmZmVyQUIob2Zmc2V0PVwiK3RoaXMub2Zmc2V0K1wiLG1hcmtlZE9mZnNldD1cIit0aGlzLm1hcmtlZE9mZnNldCtcIixsaW1pdD1cIit0aGlzLmxpbWl0K1wiLGNhcGFjaXR5PVwiK3RoaXMuY2FwYWNpdHkoKStcIilcIjtcclxuICAgICAgICBpZiAodHlwZW9mIGVuY29kaW5nID09PSAnbnVtYmVyJylcclxuICAgICAgICAgICAgZW5jb2RpbmcgPSBcInV0ZjhcIixcclxuICAgICAgICAgICAgYmVnaW4gPSBlbmNvZGluZyxcclxuICAgICAgICAgICAgZW5kID0gYmVnaW47XHJcbiAgICAgICAgc3dpdGNoIChlbmNvZGluZykge1xyXG4gICAgICAgICAgICBjYXNlIFwidXRmOFwiOlxyXG4gICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMudG9VVEY4KGJlZ2luLCBlbmQpO1xyXG4gICAgICAgICAgICBjYXNlIFwiYmFzZTY0XCI6XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy50b0Jhc2U2NChiZWdpbiwgZW5kKTtcclxuICAgICAgICAgICAgY2FzZSBcImhleFwiOlxyXG4gICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMudG9IZXgoYmVnaW4sIGVuZCk7XHJcbiAgICAgICAgICAgIGNhc2UgXCJiaW5hcnlcIjpcclxuICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnRvQmluYXJ5KGJlZ2luLCBlbmQpO1xyXG4gICAgICAgICAgICBjYXNlIFwiZGVidWdcIjpcclxuICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnRvRGVidWcoKTtcclxuICAgICAgICAgICAgY2FzZSBcImNvbHVtbnNcIjpcclxuICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnRvQ29sdW1ucygpO1xyXG4gICAgICAgICAgICBkZWZhdWx0OlxyXG4gICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoXCJVbnN1cHBvcnRlZCBlbmNvZGluZzogXCIrZW5jb2RpbmcpO1xyXG4gICAgICAgIH1cclxuICAgIH07XHJcblxyXG4gICAgLy8gbHhpdi1lbWJlZGRhYmxlXHJcblxyXG4gICAgLyoqXHJcbiAgICAgKiBseGl2LWVtYmVkZGFibGUgKGMpIDIwMTQgRGFuaWVsIFdpcnR6IDxkY29kZUBkY29kZS5pbz5cclxuICAgICAqIFJlbGVhc2VkIHVuZGVyIHRoZSBBcGFjaGUgTGljZW5zZSwgVmVyc2lvbiAyLjBcclxuICAgICAqIHNlZTogaHR0cHM6Ly9naXRodWIuY29tL2Rjb2RlSU8vbHhpdiBmb3IgZGV0YWlsc1xyXG4gICAgICovXHJcbiAgICB2YXIgbHhpdiA9IGZ1bmN0aW9uKCkge1xyXG4gICAgICAgIFwidXNlIHN0cmljdFwiO1xyXG5cclxuICAgICAgICAvKipcclxuICAgICAgICAgKiBseGl2IG5hbWVzcGFjZS5cclxuICAgICAgICAgKiBAdHlwZSB7IU9iamVjdC48c3RyaW5nLCo+fVxyXG4gICAgICAgICAqIEBleHBvcnRzIGx4aXZcclxuICAgICAgICAgKi9cclxuICAgICAgICB2YXIgbHhpdiA9IHt9O1xyXG5cclxuICAgICAgICAvKipcclxuICAgICAgICAgKiBDaGFyYWN0ZXIgY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UgYXMgYSBmdW5jdGlvbiByZXR1cm5pbmcgdGhlIG5leHQgYnl0ZSByZXNwZWN0aXZlbHkgYG51bGxgIGlmXHJcbiAgICAgICAgICogIHRoZXJlIGFyZSBubyBtb3JlIGJ5dGVzIGxlZnQuXHJcbiAgICAgICAgICogQHBhcmFtIHshZnVuY3Rpb24obnVtYmVyKX0gZHN0IENoYXJhY3RlcnMgZGVzdGluYXRpb24gYXMgYSBmdW5jdGlvbiBzdWNjZXNzaXZlbHkgY2FsbGVkIHdpdGggZWFjaCBlbmNvZGVkIGNoYXJcclxuICAgICAgICAgKiAgY29kZS5cclxuICAgICAgICAgKi9cclxuICAgICAgICBseGl2LmVuY29kZSA9IGZ1bmN0aW9uKHNyYywgZHN0KSB7XHJcbiAgICAgICAgICAgIHZhciBiLCB0O1xyXG4gICAgICAgICAgICB3aGlsZSAoKGIgPSBzcmMoKSkgIT09IG51bGwpIHtcclxuICAgICAgICAgICAgICAgIGRzdChhb3V0WyhiPj4yKSYweDNmXSk7XHJcbiAgICAgICAgICAgICAgICB0ID0gKGImMHgzKTw8NDtcclxuICAgICAgICAgICAgICAgIGlmICgoYiA9IHNyYygpKSAhPT0gbnVsbCkge1xyXG4gICAgICAgICAgICAgICAgICAgIHQgfD0gKGI+PjQpJjB4ZjtcclxuICAgICAgICAgICAgICAgICAgICBkc3QoYW91dFsodHwoKGI+PjQpJjB4ZikpJjB4M2ZdKTtcclxuICAgICAgICAgICAgICAgICAgICB0ID0gKGImMHhmKTw8MjtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoKGIgPSBzcmMoKSkgIT09IG51bGwpXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGRzdChhb3V0Wyh0fCgoYj4+NikmMHgzKSkmMHgzZl0pLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBkc3QoYW91dFtiJjB4M2ZdKTtcclxuICAgICAgICAgICAgICAgICAgICBlbHNlXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGRzdChhb3V0W3QmMHgzZl0pLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBkc3QoNjEpO1xyXG4gICAgICAgICAgICAgICAgfSBlbHNlXHJcbiAgICAgICAgICAgICAgICAgICAgZHN0KGFvdXRbdCYweDNmXSksXHJcbiAgICAgICAgICAgICAgICAgICAgZHN0KDYxKSxcclxuICAgICAgICAgICAgICAgICAgICBkc3QoNjEpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgfTtcclxuXHJcbiAgICAgICAgLyoqXHJcbiAgICAgICAgICogRGVjb2RlcyBiYXNlNjQgY2hhciBjb2RlcyB0byBieXRlcy5cclxuICAgICAgICAgKiBAcGFyYW0geyFmdW5jdGlvbigpOm51bWJlcnxudWxsfSBzcmMgQ2hhcmFjdGVycyBzb3VyY2UgYXMgYSBmdW5jdGlvbiByZXR1cm5pbmcgdGhlIG5leHQgY2hhciBjb2RlIHJlc3BlY3RpdmVseVxyXG4gICAgICAgICAqICBgbnVsbGAgaWYgdGhlcmUgYXJlIG5vIG1vcmUgY2hhcmFjdGVycyBsZWZ0LlxyXG4gICAgICAgICAqIEBwYXJhbSB7IWZ1bmN0aW9uKG51bWJlcil9IGRzdCBCeXRlcyBkZXN0aW5hdGlvbiBhcyBhIGZ1bmN0aW9uIHN1Y2Nlc3NpdmVseSBjYWxsZWQgd2l0aCB0aGUgbmV4dCBieXRlLlxyXG4gICAgICAgICAqIEB0aHJvd3Mge0Vycm9yfSBJZiBhIGNoYXJhY3RlciBjb2RlIGlzIGludmFsaWRcclxuICAgICAgICAgKi9cclxuICAgICAgICBseGl2LmRlY29kZSA9IGZ1bmN0aW9uKHNyYywgZHN0KSB7XHJcbiAgICAgICAgICAgIHZhciBjLCB0MSwgdDI7XHJcbiAgICAgICAgICAgIGZ1bmN0aW9uIGZhaWwoYykge1xyXG4gICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoXCJJbGxlZ2FsIGNoYXJhY3RlciBjb2RlOiBcIitjKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB3aGlsZSAoKGMgPSBzcmMoKSkgIT09IG51bGwpIHtcclxuICAgICAgICAgICAgICAgIHQxID0gYWluW2NdO1xyXG4gICAgICAgICAgICAgICAgaWYgKHR5cGVvZiB0MSA9PT0gJ3VuZGVmaW5lZCcpIGZhaWwoYyk7XHJcbiAgICAgICAgICAgICAgICBpZiAoKGMgPSBzcmMoKSkgIT09IG51bGwpIHtcclxuICAgICAgICAgICAgICAgICAgICB0MiA9IGFpbltjXTtcclxuICAgICAgICAgICAgICAgICAgICBpZiAodHlwZW9mIHQyID09PSAndW5kZWZpbmVkJykgZmFpbChjKTtcclxuICAgICAgICAgICAgICAgICAgICBkc3QoKHQxPDwyKT4+PjB8KHQyJjB4MzApPj40KTtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoKGMgPSBzcmMoKSkgIT09IG51bGwpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgdDEgPSBhaW5bY107XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0eXBlb2YgdDEgPT09ICd1bmRlZmluZWQnKVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGMgPT09IDYxKSBicmVhazsgZWxzZSBmYWlsKGMpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBkc3QoKCh0MiYweGYpPDw0KT4+PjB8KHQxJjB4M2MpPj4yKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKChjID0gc3JjKCkpICE9PSBudWxsKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0MiA9IGFpbltjXTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0eXBlb2YgdDIgPT09ICd1bmRlZmluZWQnKVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjID09PSA2MSkgYnJlYWs7IGVsc2UgZmFpbChjKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRzdCgoKHQxJjB4Myk8PDYpPj4+MHx0Mik7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9O1xyXG5cclxuICAgICAgICAvKipcclxuICAgICAgICAgKiBUZXN0cyBpZiBhIHN0cmluZyBpcyB2YWxpZCBiYXNlNjQuXHJcbiAgICAgICAgICogQHBhcmFtIHtzdHJpbmd9IHN0ciBTdHJpbmcgdG8gdGVzdFxyXG4gICAgICAgICAqIEByZXR1cm5zIHtib29sZWFufSBgdHJ1ZWAgaWYgdmFsaWQsIG90aGVyd2lzZSBgZmFsc2VgXHJcbiAgICAgICAgICovXHJcbiAgICAgICAgbHhpdi50ZXN0ID0gZnVuY3Rpb24oc3RyKSB7XHJcbiAgICAgICAgICAgIHJldHVybiAvXig/OltBLVphLXowLTkrL117NH0pKig/OltBLVphLXowLTkrL117Mn09PXxbQS1aYS16MC05Ky9dezN9PSk/JC8udGVzdChzdHIpO1xyXG4gICAgICAgIH07XHJcblxyXG4gICAgICAgIHJldHVybiBseGl2O1xyXG4gICAgfSgpO1xyXG5cclxuICAgIC8vIGVuY29kaW5ncy9iYXNlNjRcclxuXHJcbiAgICAvKipcclxuICAgICAqIEVuY29kZXMgdGhpcyBCeXRlQnVmZmVyJ3MgY29udGVudHMgdG8gYSBiYXNlNjQgZW5jb2RlZCBzdHJpbmcuXHJcbiAgICAgKiBAcGFyYW0ge251bWJlcj19IGJlZ2luIE9mZnNldCB0byBiZWdpbiBhdCwgZGVmYXVsdHMgdG8ge0BsaW5rIEJ5dGVCdWZmZXIjb2Zmc2V0fS5cclxuICAgICAqIEBwYXJhbSB7bnVtYmVyPX0gZW5kIE9mZnNldCB0byBlbmQgYXQsIGRlZmF1bHRzIHRvIHtAbGluayBCeXRlQnVmZmVyI2xpbWl0fS5cclxuICAgICAqIEByZXR1cm5zIHtzdHJpbmd9IEJhc2U2NCBlbmNvZGVkIH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NikudG9VcHBlckNhc2UoKTtcclxuICAgICAgICAgICAgICAgIGVsc2UgaGV4ICs9IGIudG9TdHJpbmcoMTYpLnRvVXBwZXJDYXNlKCk7XHJcbiAgICAgICAgICAgICAgICBpZiAoY29sdW1ucylcclxuICAgICAgICAgICAgICAgICAgICBhc2MgKz0gYiA+IDMyICYmIGIgPCAxMjcgPyBTdHJpbmcuZnJvbUNoYXJDb2RlKGIpIDogJy4nO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICsraTtcclxuICAgICAgICAgICAgaWYgKGNvbHVtbnMpIHtcclxuICAgICAgICAgICAgICAgIGlmIChpID4gMCAmJiBpICUgMTYgPT09IDAgJiYgaSAhPT0gaykge1xyXG4gICAgICAgICAgICAgICAgICAgIHdoaWxlIChoZXgubGVuZ3RoIDwgMyoxNiszKSBoZXggKz0gXCIgXCI7XHJcbiAgICAgICAgICAgICAgICAgICAgb3V0ICs9IGhleCthc2MrXCJcXG5cIjtcclxuICAgICAgICAgICAgICAgICAgICBoZXggPSBhc2MgPSBcIlwiO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIGlmIChpID09PSB0aGlzLm9mZnNldCAmJiBpID09PSB0aGlzLmxpbWl0KVxyXG4gICAgICAgICAgICAgICAgaGV4ICs9IGkgPT09IHRoaXMubWFya2VkT2Zmc2V0ID8gXCIhXCIgOiBcInxcIjtcclxuICAgICAgICAgICAgZWxzZSBpZiAoaSA9PT0gdGhpcy5vZmZzZXQpXHJcbiAgICAgICAgICAgICAgICBoZXggKz0gaSA9PT0gdGhpcy5tYXJrZWRPZmZzZXQgPyBcIltcIiA6IFwiPFwiO1xyXG4gICAgICAgICAgICBlbHNlIGlmIChpID09PSB0aGlzLmxpbWl0KVxyXG4gICAgICAgICAgICAgICAgaGV4ICs9IGkgPT09IHRoaXMubWFya2VkT2Zmc2V0ID8gXCJdXCIgOiBcIj5cIjtcclxuICAgICAgICAgICAgZWxz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cclxuICAgICAqIEByZXR1cm5zIHshQnl0ZUJ1ZmZlcn0gQnl0ZUJ1ZmZlclxyXG4gICAgICogQGV4cG9zZVxyXG4gICAgICogQHNlZSBCeXRlQnVmZmVyI3RvRGVidWdcclxuICAgICAqL1xyXG4gICAgQnl0ZUJ1ZmZlci5mcm9tRGVidWcgPSBmdW5jdGlvbihzdHIsIGxpdHRsZUVuZGlhbiwgbm9Bc3NlcnQpIHtcclxuICAgICAgICB2YXIgayA9IHN0ci5sZW5ndGgsXHJcbiAgICAgICAgICAgIGJiID0gbmV3IEJ5dGVCdWZmZXIoKChrKzEpLzMpfDAsIGxpdHRsZUVuZGlhbiwgbm9Bc3NlcnQpO1xyXG4gICAgICAgIHZhciBpID0gMCwgaiA9IDAsIGNoLCBiLFxyXG4gICAgICAgICAgICBycyA9IGZhbHNlLCAvLyBSZXF1aXJlIHN5bWJvbCBuZXh0XHJcbiAgICAgICAgICAgIGhvID0gZmFsc2UsIGhtID0gZmFsc2UsIGhsID0gZmFsc2UsIC8vIEFscmVhZHkgaGFzIG9mZnNldCAoaG8pLCBtYXJrZWRPZmZzZXQgKGhtKSwgbGltaXQgKGhsKT9cclxuICAgICAgICAgICAgZmFpbCA9IGZhbHNlO1xyXG4gICAgICAgIHdoaWxlIChpPGspIHtcclxuICAgICAgICAgICAgc3dpdGNoIChjaCA9IHN0ci5jaGFyQXQoaSsrKSkge1xyXG4gICAgICAgICAgICAgICAgY2FzZSAnISc6XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKCFub0Fzc2VydCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoaG8gfHwgaG0gfHwgaGwpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZhaWwgPSB0cnVlO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgaG8gPSBobSA9IGhsID0gdHJ1ZTtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgYmIub2Zmc2V0ID0gYmIubWFya2VkT2Zmc2V0ID0gYmIubGltaXQgPSBqO1xyXG4gICAgICAgICAgICAgICAgICAgIHJzID0gZmFsc2U7XHJcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XHJcbiAgICAgICAgICAgICAgICBjYXNlICd8JzpcclxuICAgICAgICAgICAgICAgICAgICBpZiAoIW5vQXNzZXJ0KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChobyB8fCBobCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZmFpbCA9IHRydWU7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICBobyA9IGhsID0gdHJ1ZTtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgYmIub2Zmc2V0ID0gYmIubGltaXQgPSBqO1xyXG4gICAgICAgICAgICAgICAgICAgIHJzID0gZmFsc2U7XHJcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XHJcbiAgICAgICAgICAgICAgICBjYXNlICdbJzpcclxuICAgICAgICAgICAgICAgICAgICBpZiAoIW5vQXNzZXJ0KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChobyB8fCBobSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZmFpbCA9IHRydWU7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICBobyA9IGhtID0gdHJ1ZTtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgYmIub2Zmc2V0ID0gYmIubWFya2VkT2Zmc2V0ID0gajtcclxuICAgICAgICAgICAgICAgICAgICBycyA9IGZhbHNlO1xyXG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xyXG4gICAgICAgICAgICAgICAgY2FzZSAnPCc6XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKCFub0Fzc2VydCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoaG8pIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZhaWwgPSB0cnVlO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgaG8gPSB0cnVlO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICBiYi5vZmZzZXQgPSBqO1xyXG4gICAgICAgICAgICAgICAgICAgIHJzID0gZmFsc2U7XHJcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XHJcbiAgICAgICAgICAgICAgICBjYXNlICddJzpcclxuICAgICAgICAgICAgICAgICAgICBpZiAoIW5vQXNzZXJ0KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChobCB8fCBobSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZmFpbCA9IHRydWU7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICBobCA9IGhtID0gdHJ1ZTtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgYmIubGltaXQgPSBiYi5tYXJrZWRPZmZzZXQgPSBqO1xyXG4gICAgICAgICAgICAgICAgICAgIHJzID0gZmFsc2U7XHJcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XHJcbiAgICAgICAgICAgICAgICBjYXNlICc+JzpcclxuICAgICAgICAgICAgICAgICAgICBpZiAoIW5vQXNzZXJ0KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChobCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZmFpbCA9IHRydWU7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICBobCA9IHRydWU7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIGJiLmxpbWl0ID0gajtcclxuICAgICAgICAgICAgICAgICAgICBycyA9IGZhbHNlO1xyXG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xyXG4gICAgICAgICAgICAgICAgY2FzZSBcIidcIjpcclxuICAgICAgICAgICAgICAgICAgICBpZiAoIW5vQXNzZXJ0KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChobSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZmFpbCA9IHRydWU7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICBobSA9IHRydWU7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIGJiLm1hcmtlZE9mZnNldCA9IGo7XHJcbiAgICAgICAgICAgICAgICAgICAgcnMgPSBmYWxzZTtcclxuICAgICAgICAgICAgICAgICAgICBicmVhaztcclxuICAgICAgICAgICAgICAgIGNhc2UgJyAnOlxyXG4gICAgICAgICAgICAgICAgICAgIHJzID0gZmFsc2U7XHJcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XHJcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxyXG4gICAgICAgICAgICAgICAgICAgIGlmICghbm9Bc3NlcnQpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHJzKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmYWlsID0gdHJ1ZTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIGIgPSBwYXJzZUludChjaCtzdHIuY2hhckF0KGkrKyksIDE2KTtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoIW5vQXNzZXJ0KSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpc05hTihiKSB8fCBiIDwgMCB8fCBiID4gMjU1KVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgVHlwZUVycm9yKFwiSWxsZWdhbCBzdHI6IE5vdCBhIGRlYnVnIGVuY29kZWQgc3RyaW5nXCIpO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICBiYi52aWV3W2orK10gPSBiO1xyXG4gICAgICAgICAgICAgICAgICAgIHJzID0gdHJ1ZTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBpZiAoZmFpbClcclxuICAgICAgICAgICAgICAgIHRocm93IFR5cGVFcnJvcihcIklsbGVnYWwgc3RyOiBJbnZhbGlkIHN5bWJvbCBhdCBcIitpKTtcclxuICAgICAgICB9XHJcbiAgICAgICAgaWYgKCFub0Fzc2VydCkge1xyXG4gICAgICAgICAgICBpZiAoIWhvIHx8ICFobClcclxuICAgICAgICAgICAgICAgIHRocm93IFR5cGVFcnJvcihcIklsbGVnYWwgc3RyOiBNaXNzaW5nIG9mZnNldCBvciBsaW1pdFwiKTtcclxuICAgICAgICAgICAgaWYgKGo8YmIuYnVmZmVyLmJ5dGVMZW5ndGgpXHJcbiAgICAgICAgICAgICAgICB0aHJvdyBUeXBlRXJyb3IoXCJJbGxlZ2FsIHN0cjogTm90IGEgZGVidWcgZW5jb2RlZCBzdHJpbmcgKGlzIGl0IGhleD8pIFwiK2orXCIgPC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oaSwgaSsyKSwgMTYpO1xyXG4gICAgICAgICAgICBpZiAoIW5vQXNzZXJ0KVxyXG4gICAgICAgICAgICAgICAgaWYgKCFpc0Zpbml0ZShiKSB8fCBiIDwgMCB8fCBiID4gMjU1KVxyXG4gICAgICAgICAgICAgICAgICAgIHRocm93IFR5cGVFcnJvcihcIklsbGVnYWwgc3RyOiBDb250YWlucyBub24taGV4IGNoYXJhY3RlcnNcIik7XHJcbiAgICAgICAgICAgIGJiLnZpZXdbaisrXSA9IGI7XHJcbiAgICAgICAgfVxyXG4gICAgICAgIGJiLmxpbWl0ID0gajtcclxuICAgICAgICByZXR1cm4gYmI7XHJcbiAgICB9O1xyXG5cclxuICAgIC8vIHV0ZngtZW1iZWRkYWJsZVxyXG5cclxuICAgIC8qKlxyXG4gICAgICogdXRmeC1lbWJlZGRhYmxlIChjKSAyMDE0IERhbmllbCBXaXJ0eiA8ZGNvZGVAZGNvZGUuaW8+XHJcbiAgICAgKiBSZWxlYXNlZCB1bmRlciB0aGUgQXBhY2hlIExpY2Vuc2UsIFZlcnNpb24gMi4wXHJcbiAgICAgKiBzZWU6IGh0dHBzOi8vZ2l0aHViLmNvbS9kY29kZUlPL3V0ZnggZm9yIGRldGFpbHNcclxuICAgICAqL1xyXG4gICAgdmFyIHV0ZnggPSBmdW5jdGlvbigpIHtcclxuICAgICAgICBcInVzZSBzdHJpY3RcIjtcclxuXHJcbiAgICAgICAgLyoqXHJcbiAgICAgICAgICogdXRmeCBuYW1lc3BhY2UuXHJcbiAgICAgICAgICogQGlubmVyXHJcbiAgICAgICAgICogQHR5cGUgeyFPYmplY3QuPHN0cmluZywqPn1cclxuICAgICAgICAgKi9cclxuICAgICAgICB2YXIgdXRmeCA9IHt9O1xyXG5cclxuICAgICAgICAvKipcclxuICAgICAgICAgKiBNYXhpbXVtIHZhbGlkIGNvZGUgcG9pbnQuXHJcbiAgICAgICAgICogQHR5cGUge251bWJlcn1cclxuICAgICAgICAgKiBAY29uc3RcclxuICAgICA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4gICAgICAgICAgICAgICAgZWxzZSBpZiAoY3AgPCAweDgwMClcclxuICAgICAgICAgICAgICAgICAgICBkc3QoKChjcD4+NikmMHgxRil8MHhDMCksXHJcbiAgICAgICAgICAgICAgICAgICAgZHN0KChjcCYweDNGKXwweDgwKTtcclxuICAgICAgICAgICAgICAgIGVsc2UgaWYgKGNwIDwgMHgxMDAwMClcclxuICAgICAgICAgICAgICAgICAgICBkc3QoKChjcD4+MTIpJjB4MEYpfDB4RTApLFxyXG4gICAgICAgICAgICAgICAgICAgIGRzdCgoKGNwPj42KSYweDNGKXwweDgwKSxcclxuICAgICAgICAgICAgICAgICAgICBkc3QoKGNwJjB4M0YpfDB4ODApO1xyXG4gICAgICAgICAgICAgICAgZWxzZVxyXG4gICAgICAgICAgICAgICAgICAgIGRzdCgoKGNwPj4xOCkmMHgwNyl8MHhGMCksXHJcbiAgICAgICAgICAgICAgICAgICAgZHN0KCgoY3A+PjEyKSYweDNGKXwweDgwKSxcclxuICAgICAgICAgICAgICAgICAgICBkc3QoKChjcD4+NikmMHgzRil8MHg4MCksXHJcbiAgICAgICAgICAgICAgICAgICAgZHN0KChjcCYweDNGKXwweDgwKTtcclxuICAgICAgICAgICAgICAgIGNwID0gbnVsbDtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH07XHJcblxyXG4gICAgICAgIC8qKlxyXG4gICAgICAgICAqIERlY29kZXMgVVRGOCBieXRlcyB0byBVVEY4IGNvZGUgcG9pbnRzLlxyXG4gICAgICAgICAqIEBwYXJhbSB7IWZ1bmN0aW9uKCk6bnVtYmVyfG51bGx9IHNyYyBCeXRlcyBzb3VyY2UgYXMgYSBmdW5jdGlvbiByZXR1cm5pbmcgdGhlIG5leHQgYnl0ZSByZXNwZWN0aXZlbHkgYG51bGxgIGlmIHRoZXJlXHJcbiAgICAgICAgICogIGFyZSBubyBtb3JlIGJ5dGVzIGxlZnQuXHJcbiAgICAgICAgICogQHBhcmFtIHshZnVuY3Rpb24obnVtYmVyKX0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ICgoYiA9IHNyYygpKSA9PT0gbnVsbCkgJiYgZmFpbChbYSwgYl0pLFxyXG4gICAgICAgICAgICAgICAgICAgIGRzdCgoKGEmMHgxRik8PDYpIHwgKGImMHgzRikpO1xyXG4gICAgICAgICAgICAgICAgZWxzZSBpZiAoKGEmMHhGMCkgPT09IDB4RTApXHJcbiAgICAgICAgICAgICAgICAgICAgKChiPXNyYygpKSA9PT0gbnVsbCB8fCAoYz1zcmMoKSkgPT09IG51bGwpICYmIGZhaWwoW2EsIGIsIGNdKSxcclxuICAgICAgICAgICAgICAgICAgICBkc3QoKChhJjB4MEYpPDwxMikgfCAoKGImMHgzRik8PDYpIHwgKGMmMHgzRikpO1xyXG4gICAgICAgICAgICAgICAgZWxzZSBpZiAoKGEmMHhGOCkgPT09IDB4RjApXHJcbiAgICAgICAgICAgICAgICAgICAgKChiPXNyYygpKSA9PT0gbnVsbCB8fCAoYz1zcmMoKSkgPT09IG51bGwgfHwgKGQ9c3JjKCkpID09PSBudWxsKSAmJiBmYWlsKFthLCBiLCBjICxkXSksXHJcbiAgICAgICAgICAgICAgICAgICAgZHN0KCgoYSYweDA3KTw8MTgpIHwgKChiJjB4M0YpPDwxMikgfCAoKGMmMHgzRik8PDYpIHwgKGQmMHgzRikpO1xyXG4gICAgICAgICAgICAgICAgZWxzZSB0aHJvdyBSYW5nZUVycm9yKFwiSWxsZWdhbCBzdGFydGluZyBieXRlOiBcIithKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH07XHJcblxyXG4gICAgICAgIC8qKlxyXG4gICAgICAgICAqIENvbnZlcnRzIFVURjE2IGNoYXJhY3RlcnMgdG8gVVRGOCBjb2RlIHBvaW50cy5cclxuICAgICAgICAgKiBAcGFyYW0geyFmdW5jdGlvbigpOm51bWJlcnxudWxsfSBzcmMgQ2hhcmFjdGVycyBzb3VyY2UgYXMgYSBmdW5jdGlvbiByZXR1cm5pbmcgdGhlIG5leHQgY2hhciBjb2RlIHJlc3BlY3RpdmVseVxyXG4gICAgICAgICAqICBgbnVsbGAgaWYgdGhlcmUgYXJlIG5vIG1vcmUgY2hhcmFjdGVycyBsZWZ0LlxyXG4gICAgICAgICAqIEBwYXJhbSB7IWZ1bmN0aW9uKG51bWJlcil9IGRzdCBDb2RlIHBvaW50cyBkZXN0aW5hdGlvbiBhcyBhIGZ1bmN0aW9uIHN1Y2Nlc3NpdmVseSBjYWxsZWQgd2l0aCBlYWNoIGNvbnZlcnRlZCBjb2RlXHJcbiAgICAgICAgICogIHBvaW50LlxyXG4gICAgICAgICAqL1xyXG4gICAgICAgIHV0ZnguVVRGMTZ0b1VURjggPSBmdW5jdGlvbihzcmMsIGRzdCkge1xyXG4gICAgICAgICAgICB2YXIgYzEsIGMyID0gbnVsbDtcclxuICAgICAgICAgICAgd2hpbGUgKHRydWUpIHtcclxuICAgICAgICAgICAgICAgIGlmICgoYzEgPSBjMiAhPT0gbnVsbCA/IGMyIDogc3JjKCkpID09PSBudWxsKVxyXG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xyXG4gICAgICAgICAgICAgICAgaWYgKGMxID49IDB4RDgwMCAmJiBjMSA8PSAweERGRkYpIHtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoKGMyID0gc3JjKCkpICE9PSBudWxsKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjMiA+PSAweERDMDAgJiYgYzIgPD0gMHhERkZGKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkc3QoKGMxLTB4RDgwMCkqMHg0MDArYzItMHhEQzAwKzB4MTAwMDApO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgYzIgPSBudWxsOyBjb250aW51ZTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIGRzdChjMSk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgaWYgKGMyICE9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wIDw9IDB4RkZGRilcclxuICAgICAgICAgICAgICAgICAgICBkc3QoY3ApO1xyXG4gICAgICAgICAgICAgICAgZWxzZVxyXG4gICAgICAgICAgICAgICAgICAgIGNwIC09IDB4MTAwMDAsXHJcbiAgICAgICAgICAgICAgICAgICAgZHN0KChjcD4+MTApKzB4RDgwMCksXHJcbiAgICAgICAgICAgICAgICAgICAgZHN0KChjcCUweDQwMCkrMHhEQzAwKTtcclxuICAgICAgICAgICAgICAgIGNwID0gbnVsbDtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH07XHJcblxyXG4gICAgICAgIC8qKlxyXG4gICAgICAgICAqIENvbnZlcnRzIGFuZCBlbmNvZGVzIFVURjE2IGNoYXJhY3RlcnMgdG8gVVRGOCBieXRlcy5cclxuICAgICAgICAgKiBAcGFyYW0geyFmdW5jdGlvbigpOm51bWJlcnxudWxsfSBzcmMgQ2hhcmFjdGVycyBzb3VyY2UgYXMgYSBmdW5jdGlvbiByZXR1cm5pbmcgdGhlIG5leHQgY2hhciBjb2RlIHJlc3BlY3RpdmVseSBgbnVsbGBcclxuICAgICAgICAgKiAgaWYgdGhlcmUgYXJlIG5vIG1vcmUgY2hhcmFjdGVycyBsZWZ0LlxyXG4gICAgICAgICAqIEBwYXJhbSB7IWZ1bmN0aW9uKG51bWJlcil9IGRzdCBCeXRlcyBkZXN0aW5hdGlvbiBhcyBhIGZ1bmN0aW9uIHN1Y2Nlc3NpdmVseSBjYWxsZWQgd2l0aCB0aGUgbmV4dCBieXRlLlxyXG4gICAgICAgICAqL1xyXG4gICAgICAgIHV0ZnguZW5jb2RlVVRGMTZ0b1VURjggPSBmdW5jdGlvbihzcmMsIGRzdCkge1xyXG4gICAgICAgICAgICB1dGZ4LlVURjE2dG9VVEY4KHNyYywgZnVuY3Rpb24oY3ApIHtcclxuICAgICAgICAgICAgICAgIHV0ZnguZW5jb2RlVVRGOChjcCwgZHN0KTtcclxuICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgfTt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xJDEgPSB0aGlzO1xuXG4gICAgICB2YXIgaXRlcmF0aW9ucyA9IDA7XG4gICAgICBjb2xsZWN0aW9uLl9faXRlcmF0ZShmdW5jdGlvbiAodiwgaywgYykge1xuICAgICAgICBpZiAocHJlZGljYXRlLmNhbGwoY29udGV4dCwgdiwgaywgYykpIHtcbiAgICAgICAgICBpdGVyYXRpb25zKys7XG4gICAgICAgICAgcmV0dXJuIGZuKHYsIHVzZUtleXMgPyBrIDogaXRlcmF0aW9ucyAtIDEsIHRoaXMkMSQxKTtcbiAgICAgICAgfVxuICAgICAgfSwgcmV2ZXJzZSk7XG4gICAgICByZXR1cm4gaXRlcmF0aW9ucztcbiAgICB9O1xuICAgIGZpbHRlclNlcXVlbmNlLl9faXRlcmF0b3JVbmNhY2hlZCA9IGZ1bmN0aW9uICh0eXBlLCByZXZlcnNlKSB7XG4gICAgICB2YXIgaXRlcmF0b3IgPSBjb2xsZWN0aW9uLl9faXRlcmF0b3IoSVRFUkFURV9FTlRSSUVTLCByZXZlcnNlKTtcbiAgICAgIHZhciBpdGVyYXRpb25zID0gMDtcbiAgICAgIHJldHVybiBuZXcgSXRlcmF0b3IoZnVuY3Rpb24gKCkge1xuICAgICAgICB3aGlsZSAodHJ1ZSkge1xuICAgICAgICAgIHZhciBzdGVwID0gaXRlcmF0b3IubmV4dCgpO1xuICAgICAgICAgIGlmIChzdGVwLmRvbmUpIHtcbiAgICAgICAgICAgIHJldHVybiBzdGVwO1xuICAgICAgICAgIH1cbiAgICAgICAgICB2YXIgZW50cnkgPSBzdGVwLnZhbHVlO1xuICAgICAgICAgIHZhciBrZXkgPSBlbnRyeVswXTtcbiAgICAgICAgICB2YXIgdmFsdWUgPSBlbnRyeVsxXTtcbiAgICAgICAgICBpZiAocHJlZGljYXRlLmNhbGwoY29udGV4dCwgdmFsdWUsIGtleSwgY29sbGVjdGlvbikpIHtcbiAgICAgICAgICAgIHJldHVybiBpdGVyYXRvclZhbHVlKHR5cGUsIHVzZUtleXMgPy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b3JWYWx1ZSh0eXBlLCBrLCB2LCBzdGVwKTtcbiAgICAgIH0pO1xuICAgIH07XG4gICAgcmV0dXJuIHNraXBTZXF1ZW5jZTtcbiAgfVxuXG4gIGZ1bmN0aW9uIGNvbmNhdEZhY3RvcnkoY29sbGVjdGlvbiwgdmFsdWVzKSB7XG4gICAgdmFyIGlzS2V5ZWRDb2xsZWN0aW9uID0gaXNLZXllZChjb2xsZWN0aW9uKTtcbiAgICB2YXIgaXRlcnMgPSBbY29sbGVjdGlvbl1cbiAgICAgIC5jb25jYXQodmFsdWVzKVxuICAgICAgLm1hcChmdW5jdGlvbiAodikge1xuICAgICAgICBpZiAoIWlzQ29sbGVjdGlvbih2KSkge1xuICAgICAgICAgIHYgPSBpc0tleWVkQ29sbGVjdGlvblxuICAgICAgICAgICAgPyBrZXllZFNlcUZyb21WYWx1ZSh2KVxuICAgICAgICAgICAgOiBpbmRleGVkU2VxRnJvbVZhbHVlKEFycmF5LmlzQXJyYXkodikgPyB2IDogW3ZdKTtcbiAgICAgICAgfSBlbHNlIGlmIChpc0tleWVkQ29sbGVjdGlvbikge1xuICAgICAgICAgIHYgPSBLZXllZENvbGxlY3Rpb24odik7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHY7XG4gICAgICB9KVxuICAgICAgLmZpbHRlcihmdW5jdGlvbiAodikgeyByZXR1cm4gdi5zaXplICE9PSAwOyB9KTtcblxuICAgIGlmIChpdGVycy5sZW5ndGggPT09IDApIHtcbiAgICAgIHJldHVybiBjb2xsZWN0aW9uO1xuICAgIH1cblxuICAgIGlmIChpdGVycy5sZW5ndGggPT09IDEpIHtcbiAgICAgIHZhciBzaW5nbGV0b24gPSBpdGVyc1swXTtcbiAgICAgIGlmIChcbiAgICAgICAgc2luZ2xldG9uID09PSBjb2xsZWN0aW9uIHx8XG4gICAgICAgIChpc0tleWVkQ29sbGVjdGlvbiAmJiBpc0tleWVkKHNpbmdsZXRvbikpIHx8XG4gICAgICAgIChpc0luZGV4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ICAgICAgICBpZiAobm9kZS5lbnRyeSkge1xuICAgICAgICAgIGlmIChpbmRleCA9PT0gMCkge1xuICAgICAgICAgICAgcmV0dXJuIG1hcEl0ZXJhdG9yVmFsdWUodHlwZSwgbm9kZS5lbnRyeSk7XG4gICAgICAgICAgfVxuICAgICAgICB9IGVsc2UgaWYgKG5vZGUuZW50cmllcykge1xuICAgICAgICAgIG1heEluZGV4ID0gbm9kZS5lbnRyaWVzLmxlbmd0aCAtIDE7XG4gICAgICAgICAgaWYgKGluZGV4IDw9IG1heEluZGV4KSB7XG4gICAgICAgICAgICByZXR1cm4gbWFwSXRlcmF0b3JWYWx1ZShcbiAgICAgICAgICAgICAgdHlwZSxcbiAgICAgICAgICAgICAgbm9kZS5lbnRyaWVzW3RoaXMuX3JldmVyc2UgPyBtYXhJbmRleCAtIGluZGV4IDogaW5kZXhdXG4gICAgICAgICAgICApO1xuICAgICAgICAgIH1cbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICBtYXhJbmRleCA9IG5vZGUubm9kZXMubGVuZ3RoIC0gMTtcbiAgICAgICAgICBpZiAoaW5kZXggPD0gbWF4SW5kZXgpIHtcbiAgICAgICAgICAgIHZhciBzdWJOb2RlID0gbm9kZS5ub2Rlc1t0aGlzLl9yZXZlcnNlID8gbWF4SW5kZXggLSBpbmRleCA6IGluZGV4XTtcbiAgICAgICAgICAgIGlmIChzdWJOb2RlKSB7XG4gICAgICAgICAgICAgIGlmIChzdWJOb2RlLmVudHJ5KSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIG1hcEl0ZXJhdG9yVmFsdWUodHlwZSwgc3ViTm9kZS5lbnRyeSk7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgc3RhY2sgPSB0aGlzLl9zdGFjayA9IG1hcEl0ZXJhdG9yRnJhbWUoc3ViTm9kZSwgc3RhY2spO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgY29udGludWU7XG4gICAgICAgICAgfVxuICAgICAgICB9X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0gZnVuY3Rpb24gZ2V0IChpbmRleCwgbm90U2V0VmFsdWUpIHtcbiAgICAgIHZhciBoZWFkID0gdGhpcy5faGVhZDtcbiAgICAgIGluZGV4ID0gd3JhcEluZGV4KHRoaXMsIGluZGV4KTtcbiAgICAgIHdoaWxlIChoZWFkICYmIGluZGV4LS0pIHtcbiAgICAgICAgaGVhZCA9IGhlYWQubmV4dDtcbiAgICAgIH1cbiAgICAgIHJldHVybiBoZWFkID8gaGVhZC52YWx1ZSA6IG5vdFNldFZhbHVlO1xuICAgIH07XG5cbiAgICBTdGFjay5wcm90b3R5cGUucGVlayA9IGZ1bmN0aW9uIHBlZWsgKCkge1xuICAgICAgcmV0dXJuIHRoaXMuX2hlYWQgJiYgdGhpcy5faGVhZC52YWx1ZTtcbiAgICB9O1xuXG4gICAgLy8gQHByYWdtYSBNb2RpZmljYXRpb25cblxuICAgIFN0YWNrLnByb3RvdHlwZS5wdXNoID0gZnVuY3Rpb24gcHVzaCAoLyouLi52YWx1ZXMqLykge1xuICAgICAgdmFyIGFyZ3VtZW50cyQxID0gYXJndW1lbnRzO1xuXG4gICAgICBpZiAoYXJndW1lbnRzLmxlbmd0aCA9PT0gMCkge1xuICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgIH1cbiAgICAgIHZhciBuZXdTaXplID0gdGhpcy5zaXplICsgYXJndW1lbnRzLmxlbmd0aDtcbiAgICAgIHZhciBoZWFkID0gdGhpcy5faGVhZDtcbiAgICAgIGZvciAodmFyIGlpID0gYXJndW1lbnRzLmxlbmd0aCAtIDE7IGlpID49IDA7IGlpLS0pIHtcbiAgICAgICAgaGVhZCA9IHtcbiAgICAgICAgICB2YWx1ZTogYXJndW1lbnRzJDFbaWldLFxuICAgICAgICAgIG5leHQ6IGhlYWQsXG4gICAgICAgIH07XG4gICAgICB9XG4gICAgICBpZiAodGhpcy5fX293bmVySUQpIHtcbiAgICAgICAgdGhpcy5zaXplID0gbmV3U2l6ZTtcbiAgICAgICAgdGhpcy5faG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ucHJvdG90eXBlLnNsaWNlLmNhbGwodGhpcywgYmVnaW4sIGVuZCk7XG4gICAgICB9XG4gICAgICB2YXIgbmV3U2l6ZSA9IHRoaXMuc2l6ZSAtIHJlc29sdmVkQmVnaW47XG4gICAgICB2YXIgaGVhZCA9IHRoaXMuX2hlYWQ7XG4gICAgICB3aGlsZSAocmVzb2x2ZWRCZWdpbi0tKSB7XG4gICAgICAgIGhlYWQgPSBoZWFkLm5leHQ7XG4gICAgICB9XG4gICAgICBpZiAodGhpcy5fX293bmVySUQpIHtcbiAgICAgICAgdGhpcy5zaXplID0gbmV3U2l6ZTtcbiAgICAgICAgdGhpcy5faGVhZCA9IGhlYWQ7XG4gICAgICAgIHRoaXMuX19oYXNoID0gdW5kZWZpbmVkO1xuICAgICAgICB0aGlzLl9fYWx0ZXJlZCA9IHRydWU7XG4gICAgICAgIHJldHVybiB0aGlzO1xuICAgICAgfVxuICAgICAgcmV0dXJuIG1ha2VTdGFjayhuZXdTaXplLCBoZWFkKTtcbiAgICB9O1xuXG4gICAgLy8gQHByYWdtYSBNdXRhYmlsaXR5XG5cbiAgICBTdGFjay5wcm90b3R5cGUuX19lbnN1cmVPd25lciA9IGZ1bmN0aW9uIF9fZW5zdXJlT3duZXIgKG93bmVySUQpIHtcbiAgICAgIGlmIChvd25lcklEID09PSB0aGlzLl9fb3duZXJJRCkge1xuICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgIH1cbiAgICAgIGlmICghb3duZXJJRCkge1xuICAgICAgICBpZiAodGhpcy5zaXplID09PSAwKSB7XG4gICAgICAgICAgcmV0dXJuIGVtcHR5U3RhY2soKTtcbiAgICAgICAgfVxuICAgICAgICB0aGlzLl9fb3duZXJJRCA9IG93bmVySUQ7XG4gICAgICAgIHRoaXMuX19hbHRlcmVkID0gZmFsc2U7XG4gICAgICAgIHJldHVybiB0aGlzO1xuICAgICAgfVxuICAgICAgcmV0dXJuIG1ha2VTdGFjayh0aGlzLnNpemUsIHRoaXMuX2hlYWQ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ICAgICAgaWYgKG93bmVySUQgPT09IHRoaXMuX19vd25lcklEKSB7XG4gICAgICAgIHJldHVybiB0aGlzO1xuICAgICAgfVxuICAgICAgdmFyIG5ld01hcCA9IHRoaXMuX21hcC5fX2Vuc3VyZU93bmVyKG93bmVySUQpO1xuICAgICAgaWYgKCFvd25lcklEKSB7XG4gICAgICAgIGlmICh0aGlzLnNpemUgPT09IDApIHtcbiAgICAgICAgICByZXR1cm4gdGhpcy5fX2VtcHR5KCk7XG4gICAgICAgIH1cbiAgICAgICAgdGhpcy5fX293bmVySUQgPSBvd25lcklEO1xuICAgICAgICB0aGlzLl9tYXAgPSBuZXdNYXA7XG4gICAgICAgIHJldHVybiB0aGlzO1xuICAgICAgfVxuICAgICAgcmV0dXJuIHRoaXMuX19tYWtlKG5ld01hcCwgb3duZXJJRCk7XG4gICAgfTtcblxuICAgIHJldHVybiBTZXQ7XG4gIH0oU2V0Q29sbGVjdGlvbikpO1xuXG4gIFNldC5pc1NldCA9IGlzU2V0O1xuXG4gIHZhciBTZXRQcm90b3R5cGUgPSBTZXQucHJvdG90eXBlO1xuICBTZXRQcm90b3R5cGVbSVNfU0VUX1NZTUJPTF0gPSB0cnVlO1xuICBTZXRQcm90b3R5cGVbREVMRVRFXSA9IFNldFByb3RvdHlwZS5yZW1vdmU7XG4gIFNldFByb3RvdHlwZS5tZXJnZSA9IFNldFByb3RvdHlwZS5jb25jYXQgPSBTZXRQcm90b3R5cGUudW5pb247XG4gIFNldFByb3RvdHlwZS53aXRoTXV0YXRpb25zID0gd2l0aE11dGF0aW9ucztcbiAgU2V0UHJvdG90eXBlLmFzSW1tdXRhYmxlID0gYXNJbW11dGFibGU7XG4gIFNldFByb3RvdHlwZVsnQEB0cmFuc2R1Y2VyL2luaXQnXSA9IFNldFByb3RvdHlwZS5hc011dGFibGUgPSBhc011dGFibGU7XG4gIFNldFByb3RvdHlwZVsnQEB0cmFuc2R1Y2VyL3N0ZXAnXSA9IGZ1bmN0aW9uIChyZXN1b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Gk7XG4gICAgICAgICAgaWYgKFJlY29yZFR5cGVQcm90b3R5cGVbcHJvcE5hbWVdKSB7XG4gICAgICAgICAgICAvKiBlc2xpbnQtZGlzYWJsZSBuby1jb25zb2xlICovXG4gICAgICAgICAgICB0eXBlb2YgY29uc29sZSA9PT0gJ29iamVjdCcgJiZcbiAgICAgICAgICAgICAgY29uc29sZS53YXJuICYmXG4gICAgICAgICAgICAgIGNvbnNvbGUud2FybihcbiAgICAgICAgICAgICAgICAnQ2Fubm90IGRlZmluZSAnICtcbiAgICAgICAgICAgICAgICAgIHJlY29yZE5hbWUodGhpcykgK1xuICAgICAgICAgICAgICAgICAgJyB3aXRoIHByb3BlcnR5IFwiJyArXG4gICAgICAgICAgICAgICAgICBwcm9wTmFtZSArXG4gICAgICAgICAgICAgICAgICAnXCIgc2luY2UgdGhhdCBwcm9wZXJ0eSBuYW1lIGlzIHBhcnQgb2YgdGhlIFJlY29yZCBBUEkuJ1xuICAgICAgICAgICAgICApO1xuICAgICAgICAgICAgLyogZXNsaW50LWVuYWJsZSBuby1jb25zb2xlICovXG4gICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHNldFByb3AoUmVjb3JkVHlwZVByb3RvdHlwZSwgcHJvcE5hbWUpO1xuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgfVxuICAgICAgdGhpcy5fX293bmVySUQgPSB1bmRlZmluZWQ7XG4gICAgICB0aGlzLl92YWx1ZXMgPSBMaXN0KCkud2l0aE11dGF0aW9ucyhmdW5jdGlvbiAobCkge1xuICAgICAgICBsLnNldFNpemUodGhpcyQxJDEuX2tleXMubGVuZ3RoKTtcbiAgICAgICAgS2V5ZWRDb2xsZWN0aW9uKHZhbHVlcykuZm9yRWFjaChmdW5jdGlvbiAodiwgaykge1xuICAgICAgICAgIGwuc2V0KHRoaXMkMSQxLl9pbmRpY2VzW2tdLCB2ID09PSB0aGlzJDEkMS5fZGVmYXVsdFZhbHVlc1trXSA/IHVuZGVmaW5lZ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IDA6XG4gICAgICAgICAgICBzaXplID0gX3JlZi5zaXplO1xuICAgICAgICAgICAgaSA9IDA7XG4gICAgICAgICAgICBfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uID0gdHJ1ZTtcbiAgICAgICAgICAgIF9kaWRJdGVyYXRvckVycm9yID0gZmFsc2U7XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gNDtcbiAgICAgICAgICAgIF9pdGVyYXRvciA9IF9hc3luY0l0ZXJhdG9yKHNvdXJjZSk7XG5cbiAgICAgICAgICBjYXNlIDY6XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gODtcbiAgICAgICAgICAgIHJldHVybiBfYXdhaXRBc3luY0dlbmVyYXRvcihfaXRlcmF0b3IubmV4dCgpKTtcblxuICAgICAgICAgIGNhc2UgODpcbiAgICAgICAgICAgIF9zdGVwID0gX2NvbnRleHQuc2VudDtcbiAgICAgICAgICAgIF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gPSBfc3RlcC5kb25lO1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDEyO1xuICAgICAgICAgICAgcmV0dXJuIF9hd2FpdEFzeW5jR2VuZXJhdG9yKF9zdGVwLnZhbHVlKTtcblxuICAgICAgICAgIGNhc2UgMTI6XG4gICAgICAgICAgICBfdmFsdWUgPSBfY29udGV4dC5zZW50O1xuXG4gICAgICAgICAgICBpZiAoX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbikge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMjU7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB2YWx1ZSA9IF92YWx1ZTtcblxuICAgICAgICAgICAgaWYgKCEoaSA9PT0gc2l6ZSkpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDE5O1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDE4O1xuICAgICAgICAgICAgcmV0dXJuIHNwbGl0O1xuXG4gICAgICAgICAgY2FzZSAxODpcbiAgICAgICAgICAgIGkgPSAwO1xuXG4gICAgICAgICAgY2FzZSAxOTpcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyMTtcbiAgICAgICAgICAgIHJldHVybiB2YWx1ZTtcblxuICAgICAgICAgIGNhc2UgMjE6XG4gICAgICAgICAgICBpKys7XG5cbiAgICAgICAgICBjYXNlIDIyOlxuICAgICAgICAgICAgX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiA9IHRydWU7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gNjtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSAyNTpcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAzMTtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSAyNzpcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAyNztcbiAgICAgICAgICAgIF9jb250ZXh0LnQwID0gX2NvbnRleHRbXCJjYXRjaFwiXSg0KTtcbiAgICAgICAgICAgIF9kaWRJdGVyYXRvckVycm9yID0gdHJ1ZTtcbiAgICAgICAgICAgIF9pdGVyYXRvckVycm9yID0gX2NvbnRleHQudDA7XG5cbiAgICAgICAgICBjYXNlIDMxOlxuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDMxO1xuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDMyO1xuXG4gICAgICAgICAgICBpZiAoISghX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiAmJiBfaXRlcmF0b3JbXCJyZXR1cm5cIl0gIT0gbnVsbCkpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDM2O1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9ID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GlsZSAoMSkge1xuICAgICAgc3dpdGNoIChfY29udGV4dC5wcmV2ID0gX2NvbnRleHQubmV4dCkge1xuICAgICAgICBjYXNlIDA6XG4gICAgICAgICAgc2l6ZSA9IF9yZWYuc2l6ZTtcbiAgICAgICAgICBpID0gMDtcbiAgICAgICAgICBfaXRlcmF0b3IgPSBfY3JlYXRlRm9yT2ZJdGVyYXRvckhlbHBlcihzb3VyY2UpO1xuICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAzO1xuXG4gICAgICAgICAgX2l0ZXJhdG9yLnMoKTtcblxuICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgaWYgKChfc3RlcCA9IF9pdGVyYXRvci5uKCkpLmRvbmUpIHtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxNjtcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIHZhbHVlID0gX3N0ZXAudmFsdWU7XG5cbiAgICAgICAgICBpZiAoIShpID09PSBzaXplKSkge1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDExO1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgX2NvbnRleHQubmV4dCA9IDEwO1xuICAgICAgICAgIHJldHVybiBzcGxpdDtcblxuICAgICAgICBjYXNlIDEwOlxuICAgICAgICAgIGkgPSAwO1xuXG4gICAgICAgIGNhc2UgMTE6XG4gICAgICAgICAgX2NvbnRleHQubmV4dCA9IDEzO1xuICAgICAgICAgIHJldHVybiB2YWx1ZTtcblxuICAgICAgICBjYXNlIDEzOlxuICAgICAgICAgIGkrKztcblxuICAgICAgICBjYXNlIDE0OlxuICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA1O1xuICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgIGNhc2UgMTY6XG4gICAgICAgICAgX2NvbnRleHQubmV4dCA9IDIxO1xuICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgIGNhc2UgMT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XJjZTtcblxuICAgICAgICAgIGNhc2UgODpcbiAgICAgICAgICAgIF9zb3VyY2UgPSBfY29udGV4dC50MDtcbiAgICAgICAgICAgIGlkeCA9IGF0IDwgMCA/IF9zb3VyY2UubGVuZ3RoICsgYXQgOiBhdDtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxMjtcbiAgICAgICAgICAgIHJldHVybiBfYXdhaXRBc3luY0dlbmVyYXRvcihfX2FzeW5jUGVla2VyYXRlKF9zb3VyY2UpKTtcblxuICAgICAgICAgIGNhc2UgMTI6XG4gICAgICAgICAgICBwZWVrciA9IF9jb250ZXh0LnNlbnQ7XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMTM7XG5cbiAgICAgICAgICBjYXNlIDE0OlxuICAgICAgICAgICAgaWYgKHBlZWtyLmRvbmUpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDI0O1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgaWYgKCEocGVla3IuaW5kZXggPT09IGlkeCkpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDE4O1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDE4O1xuICAgICAgICAgICAgcmV0dXJuIHNwbGl0O1xuXG4gICAgICAgICAgY2FzZSAxODpcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyMDtcbiAgICAgICAgICAgIHJldHVybiBwZWVrci52YWx1ZTtcblxuICAgICAgICAgIGNhc2UgMjA6XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMjI7XG4gICAgICAgICAgICByZXR1cm4gX2F3YWl0QXN5bmNHZW5lcmF0b3IocGVla3IuYWR2YW5jZSgpKTtcblxuICAgICAgICAgIGNhc2UgMjI6XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTQ7XG4gICA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5cbiAgICByZXR1cm4gX3JlZ2VuZXJhdG9yUnVudGltZS53cmFwKGZ1bmN0aW9uIF9jYWxsZWUyJChfY29udGV4dDIpIHtcbiAgICAgIHdoaWxlICgxKSB7XG4gICAgICAgIHN3aXRjaCAoX2NvbnRleHQyLnByZXYgPSBfY29udGV4dDIubmV4dCkge1xuICAgICAgICAgIGNhc2UgMDpcbiAgICAgICAgICAgIHByZWRpY2F0ZSA9IF9yZWYyLmF0O1xuICAgICAgICAgICAgaSA9IDA7XG4gICAgICAgICAgICBzcGxhdCA9IGZhbHNlO1xuICAgICAgICAgICAgX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiA9IHRydWU7XG4gICAgICAgICAgICBfZGlkSXRlcmF0b3JFcnJvciA9IGZhbHNlO1xuICAgICAgICAgICAgX2NvbnRleHQyLnByZXYgPSA1O1xuICAgICAgICAgICAgX2l0ZXJhdG9yID0gX2FzeW5jSXRlcmF0b3Ioc291cmNlKTtcblxuICAgICAgICAgIGNhc2UgNzpcbiAgICAgICAgICAgIF9jb250ZXh0Mi5uZXh0ID0gOTtcbiAgICAgICAgICAgIHJldHVybiBfYXdhaXRBc3luY0dlbmVyYXRvcihfaXRlcmF0b3IubmV4dCgpKTtcblxuICAgICAgICAgIGNhc2UgOTpcbiAgICAgICAgICAgIF9zdGVwID0gX2NvbnRleHQyLnNlbnQ7XG4gICAgICAgICAgICBfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uID0gX3N0ZXAuZG9uZTtcbiAgICAgICAgICAgIF9jb250ZXh0Mi5uZXh0ID0gMTM7XG4gICAgICAgICAgICByZXR1cm4gX2F3YWl0QXN5bmNHZW5lcmF0b3IoX3N0ZXAudmFsdWUpO1xuXG4gICAgICAgICAgY2FzZSAxMzpcbiAgICAgICAgICAgIF92YWx1ZSA9IF9jb250ZXh0Mi5zZW50O1xuXG4gICAgICAgICAgICBpZiAoX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbikge1xuICAgICAgICAgICAgICBfY29udGV4dDIubmV4dCA9IDMwO1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdmFsdWUgPSBfdmFsdWU7XG4gICAgICAgICAgICBfY29udGV4dDIudDAgPSAhc3BsYXQ7XG5cbiAgICAgICAgICAgIGlmICghX2NvbnRleHQyLnQwKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Mi5uZXh0ID0gMjE7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBfY29udGV4dDIubmV4dCA9IDIwO1xuICAgICAgICAgICAgcmV0dXJuIF9hd2FpdEFzeW5jR2VuZXJhdG9yKHByZWRpY2F0ZSh2YWx1ZSwgaSsrKSk7XG5cbiAgICAgICAgICBjYXNlIDIwOlxuICAgICAgICAgICAgX2NvbnRleHQyLnQwID0gX2NvbnRleHQyLnNlbnQ7XG5cbiAgICAgICAgICBjYXNlIDIxOlxuICAgICAgICAgICAgaWYgKCFfY29udGV4dDIudDApIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQyLm5leHQgPSAyNTtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIF9jb250ZXh0Mi5uZXh0ID0gMjQ7XG4gICAgICAgICAgICByZXR1cm4gc3BsaXQ7XG5cbiAgICAgICAgICBjYXNlIDI0OlxuICAgICAgICAgICAgc3BsYXQgPSB0cnVlO1xuXG4gICAgICAgICAgY2FzZSAyNTpcbiAgICAgICAgICAgIF9jb250ZXh0Mi5uZXh0ID0gMjc7XG4gICAgICAgICAgICByZXR1cm4gdmFsdWU7XG5cbiAgICAgICAgICBjYXNlIDI3OlxuICAgICAgICAgICAgX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiA9IHRydWU7XG4gICAgICAgICAgICBfY29udGV4dDIubmV4dCA9IDc7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgIGNhc2UgMzA6XG4gICAgICAgICAgICBfY29udGV4dDIubmV4dCA9IDM2O1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICBjYXNlIDMyOlxuICAgICAgICAgICAgX2NvbnRleHQyLnByZXYgPSAzMjtcbiAgICAgICAgICAgIF9jb250ZXh0Mi50MSA9IF9jb250ZXh0MltcImNhdGNoXCJdKDUpO1xuICAgICAgICAgICAgX2RpZEl0ZXJhdG9yRXJyb3IgPSB0cnVlO1xuICAgICAgICAgICAgX2l0ZXJhdG9yRXJyb3IgPSBfY29udGV4dDIudDE7XG5cbiAgICAgICAgICBjYXNlIDM2OlxuICAgICAgICAgICAgX2NvbnRleHQyLnByZXYgPSAzNjtcbiAgICAgICAgICAgIF9jb250ZXh0Mi5wcmV2ID0gMzc7XG5cbiAgICAgICAgICAgIGlmICghKCFfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uICYmIF9pdGVyYXRvcltcInJldHVyblwiXSAhPSBudWxsKSkge1xuICAgICAgICAgICAgICBfY29udGV4dDIubmV4dCA9IDQxO1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgX2NvbnRleHQyLm5leHQgPSA0MTtcbiAgICAgICAgICAgIHJldHVybiBfYXdhaXRBc3luY0dlbmVyYXRvcihfaXRlcmF0b3JbXCJyZXR1cm5cIl0oKSk7XG5cbiAgICAgICAgICBjYXNlIDQxOlxuICAgICAgICAgICAgX2NvbnRleHQyLnByZXYgPSA0MTtcblxuICAgICAgICAgICAgaWYgKCFfZGlkSXRlcmF0b3JFcnJvcikge1xuICAgICAgICAgICAgICBfY29udGV4dDIubmV4dCA9IDQ0O1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdGhyb3cgX2l0ZXJhdG9yRXJyb3I7XG5cbiAgICAgICAgICBjYXNlIDQ0OlxuICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0Mi5maW5pc2goNDEpO1xu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A8IDAgPyBfc291cmNlLmxlbmd0aCArIGF0IDogYXQ7XG4gICAgICAgICAgcGVla3IgPSBfX3BlZWtlcmF0ZShfc291cmNlKTtcbiAgICAgICAgICBfY29udGV4dC5wcmV2ID0gNDtcblxuICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgaWYgKHBlZWtyLmRvbmUpIHtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxNDtcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIGlmICghKHBlZWtyLmluZGV4ID09PSBpZHgpKSB7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gOTtcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA5O1xuICAgICAgICAgIHJldHVybiBzcGxpdDtcblxuICAgICAgICBjYXNlIDk6XG4gICAgICAgICAgX2NvbnRleHQubmV4dCA9IDExO1xuICAgICAgICAgIHJldHVybiBwZWVrci52YWx1ZTtcblxuICAgICAgICBjYXNlIDExOlxuICAgICAgICAgIHBlZWtyLmFkdmFuY2UoKTtcbiAgICAgICAgICBfY29udGV4dC5uZXh0ID0gNTtcbiAgICAgICAgICBicmVhaztcblxuICAgICAgICBjYXNlIDE0OlxuICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAxNDtcbiAgICAgICAgICBwZWVrcltcInJldHVyblwiXSgpO1xuICAgICAgICAgIHJldHVybiBfY29udGV4dC5maW5pc2goMTQpO1xuXG4gICAgICAgIGNhc2UgMTc6XG4gICAgICAgIGNhc2UgXCJlbmRcIjpcbiAgICAgICAgICByZXR1cm4gX2NvbnRleHQuc3RvcCgpO1xuICAgICAgfVxuICAgIH1cbiAgfSwgX21hcmtlZCwgbnVsbCwgW1s0LCwgMTQsIDE3XV0pO1xufVxuXG5leHBvcnRzLmluZGV4U3RyYXRlZ3kgPSBpbmRleFN0cmF0ZWd5O1xuXG5mdW5jdGlvbiBjb25kaXRpb25TdHJhdGVneShzcGxpdCwgX3JlZjIsIHNvdXJjZSkge1xuICB2YXIgcHJlZGljYXRlLCBpLCBzcGxhdCwgX2l0ZXJhdG9yLCBfc3RlcCwgdmFsdWU7XG5cbiAgcmV0dXJuIF9yZWdlbmVyYXRvclJ1bnRpbWUud3JhcChmdW5jdGlvbiBjb25kaXRpb25TdHJhdGVneSQoX2NvbnRleHQyKSB7XG4gICAgd2hpbGUgKDEpIHtcbiAgICAgIHN3aXRjaCAoX2NvbnRleHQyLnByZXYgPSBfY29udGV4dDIubmV4dCkge1xuICAgICAgICBjYXNlIDA6XG4gICAgICAgICAgcHJlZGljYXRlID0gX3JlZjIuYXQ7XG4gICAgICAgICAgaSA9IDA7XG4gICAgICAgICAgc3BsYXQgPSBmYWxzZTtcbiAgICAgICAgICBfaXRlcmF0b3IgPSBfY3JlYXRlRm9yT2ZJdGVyYXRvckhlbHBlcihzb3VyY2UpO1xuICAgICAgICAgIF9jb250ZXh0Mi5wcmV2ID0gNDtcblxuICAgICAgICAgIF9pdGVyYXRvci5zKCk7XG5cbiAgICAgICAgY2FzZSA2OlxuICAgICAgICAgIGlmICgoX3N0ZXAgPSBfaXRlcmF0b3IubigpKS5kb25lKSB7XG4gICAgICAgICAgICBfY29udGV4dDIubmV4dCA9IDE2O1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgdmFsdWUgPSBfc3RlcC52YWx1ZTtcblxuICAgICAgICAgIGlmICghKCFzcGxhdCAmJiBwcmVkaWNhdGUodmFsdWUsIGkrKykpKSB7XG4gICAgICAgICAgICBfY29udGV4dDIubmV4dCA9IDEyO1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgX2NvbnRleHQyLm5leHQgPSAxMTtcbiAgICAgICAgICByZXR1cm4gc3BsaXQ7XG5cbiAgICAgICAgY2FzZSAxMTpcbiAgICAgICAgICBzcGxhdCA9IHRydWU7XG5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mVyYXRvciggLyojX19QVVJFX18qL19yZWdlbmVyYXRvclJ1bnRpbWUubWFyayhmdW5jdGlvbiBfY2FsbGVlKF9yZWYsIGFsbCkge1xuICAgIHZhciBjb21wYXJlLFxuICAgICAgICBjYW5kaWRhdGUsXG4gICAgICAgIF9sZW4sXG4gICAgICAgIHBlZWtycyxcbiAgICAgICAgX2tleSxcbiAgICAgICAgX2l0ZXJhdG9yLFxuICAgICAgICBfc3RlcCxcbiAgICAgICAgcGVla3IsXG4gICAgICAgIF9hcmdzID0gYXJndW1lbnRzO1xuXG4gICAgcmV0dXJuIF9yZWdlbmVyYXRvclJ1bnRpbWUud3JhcChmdW5jdGlvbiBfY2FsbGVlJChfY29udGV4dCkge1xuICAgICAgd2hpbGUgKDEpIHtcbiAgICAgICAgc3dpdGNoIChfY29udGV4dC5wcmV2ID0gX2NvbnRleHQubmV4dCkge1xuICAgICAgICAgIGNhc2UgMDpcbiAgICAgICAgICAgIGNvbXBhcmUgPSBfcmVmLmNvbXBhcmU7XG5cbiAgICAgICAgICAgIGZvciAoX2xlbiA9IF9hcmdzLmxlbmd0aCwgcGVla3JzID0gbmV3IEFycmF5KF9sZW4gPiAyID8gX2xlbiAtIDIgOiAwKSwgX2tleSA9IDI7IF9rZXkgPCBfbGVuOyBfa2V5KyspIHtcbiAgICAgICAgICAgICAgcGVla3JzW19rZXkgLSAyXSA9IF9hcmdzW19rZXldO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgaWYgKGFsbC5kb25lKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxMjtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGNhbmRpZGF0ZSA9IGFsbC52YWx1ZTtcbiAgICAgICAgICAgIF9pdGVyYXRvciA9IF9jcmVhdGVGb3JPZkl0ZXJhdG9ySGVscGVyKHBlZWtycyk7XG5cbiAgICAgICAgICAgIHRyeSB7XG4gICAgICAgICAgICAgIGZvciAoX2l0ZXJhdG9yLnMoKTsgIShfc3RlcCA9IF9pdGVyYXRvci5uKCkpLmRvbmU7KSB7XG4gICAgICAgICAgICAgICAgcGVla3IgPSBfc3RlcC52YWx1ZTtcblxuICAgICAgICAgICAgICAgIGlmICghcGVla3IuZG9uZSAmJiBjb21wYXJlKHBlZWtyLnZhbHVlLCBjYW5kaWRhdGUudmFsdWUpIDwgMCkge1xuICAgICAgICAgICAgICAgICAgY2FuZGlkYXRlID0gcGVla3I7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9IGNhdGNoIChlcnIpIHtcbiAgICAgICAgICAgICAgX2l0ZXJhdG9yLmUoZXJyKTtcbiAgICAgICAgICAgIH0gZmluYWxseSB7XG4gICAgICAgICAgICAgIF9pdGVyYXRvci5mKCk7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA4O1xuICAgICAgICAgICAgcmV0dXJuIGNhbmRpZGF0ZS52YWx1ZTtcblxuICAgICAgICAgIGNhc2UgODpcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxMDtcbiAgICAgICAgICAgIHJldHVybiBfYXdhaXRBc3luY0dlbmVyYXRvcihjYW5kaWRhdGUuYWR2YW5jZSgpKTtcblxuICAgICAgICAgIGNhc2UgMTA6XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMjtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSAxMjpcbiAgICAgICAgICBjYXNlIFwiZW5kXCI6XG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuc3RvcCgpO1xuICAgICAgICB9XG4gICAgICB9XG4gICAgfSwgX2NhbGxlZSk7XG4gIH0pKTtcbiAgcmV0dXJuIF9hc3luY0J5Q29tcGFyaXNvbi5hcHBseSh0aGlzLCBhcmd1bWVudHMpO1xufVxuXG5mdW5jd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gICAgICAgICAgY2FzZSAwOlxuICAgICAgICAgICAgZm9yIChfbGVuID0gX2FyZ3MubGVuZ3RoLCBzb3VyY2VzID0gbmV3IEFycmF5KF9sZW4pLCBfa2V5ID0gMDsgX2tleSA8IF9sZW47IF9rZXkrKykge1xuICAgICAgICAgICAgICBzb3VyY2VzW19rZXldID0gX2FyZ3NbX2tleV07XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIF9pID0gMCwgX3NvdXJjZXMgPSBzb3VyY2VzO1xuXG4gICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgaWYgKCEoX2kgPCBfc291cmNlcy5sZW5ndGgpKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA4O1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgaXRlcmFibGUgPSBfc291cmNlc1tfaV07XG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuZGVsZWdhdGVZaWVsZChfYXN5bmNHZW5lcmF0b3JEZWxlZ2F0ZShfYXN5bmNJdGVyYXRvcihhc3luY0Vuc3VyZUl0ZXJhYmxlKGl0ZXJhYmxlKSksIF9hd2FpdEFzeW5jR2VuZXJhdG9yKSwgXCJ0MFwiLCA1KTtcblxuICAgICAgICAgIGNhc2UgNTpcbiAgICAgICAgICAgIF9pKys7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMjtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSA4OlxuICAgICAgICAgIGNhc2UgXCJlbmRcIjpcbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dC5zdG9wKCk7XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICB9LCBfY2FsbGVlKTtcbiAgfSkpO1xuICByZXR1cm4gX2FzeW5jQ29uY2F0LmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7XG59XG5cbnZhciBhc3luY0NvbmNhdCA9IC8qI19fUFVSRV9fKi9h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m4gX2l0ZXJhdG9yLm5leHQoKTtcblxuICAgICAgICAgIGNhc2UgNjpcbiAgICAgICAgICAgIF9zdGVwID0gX2NvbnRleHQuc2VudDtcbiAgICAgICAgICAgIF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gPSBfc3RlcC5kb25lO1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDEwO1xuICAgICAgICAgICAgcmV0dXJuIF9zdGVwLnZhbHVlO1xuXG4gICAgICAgICAgY2FzZSAxMDpcbiAgICAgICAgICAgIF92YWx1ZSA9IF9jb250ZXh0LnNlbnQ7XG5cbiAgICAgICAgICAgIGlmIChfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxNjtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIF8gPSBfdmFsdWU7XG5cbiAgICAgICAgICBjYXNlIDEzOlxuICAgICAgICAgICAgX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiA9IHRydWU7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gNDtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSAxNjpcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyMjtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSAxODpcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAxODtcbiAgICAgICAgICAgIF9jb250ZXh0LnQwID0gX2NvbnRleHRbXCJjYXRjaFwiXSgyKTtcbiAgICAgICAgICAgIF9kaWRJdGVyYXRvckVycm9yID0gdHJ1ZTtcbiAgICAgICAgICAgIF9pdGVyYXRvckVycm9yID0gX2NvbnRleHQudDA7XG5cbiAgICAgICAgICBjYXNlIDIyOlxuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDIyO1xuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDIzO1xuXG4gICAgICAgICAgICBpZiAoISghX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiAmJiBfaXRlcmF0b3JbXCJyZXR1cm5cIl0gIT0gbnVsbCkpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDI3O1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDI3O1xuICAgICAgICAgICAgcmV0dXJuIF9pdGVyYXRvcltcInJldHVyblwiXSgpO1xuXG4gICAgICAgICAgY2FzZSAyNzpcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAyNztcblxuICAgICAgICAgICAgaWYgKCFfZGlkSXRlcmF0b3JFcnJvcikge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMzA7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB0aHJvdyBfaXRlcmF0b3JFcnJvcjtcblxuICAgICAgICAgIGNhc2UgMzA6XG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuZmluaXNoKDI3KTtcblxuICAgICAgICAgIGNhc2UgMzE6XG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuZmluaXNoKDIyKTtcblxuICAgICAgICAgIGNhc2UgMzI6XG4gICAgICAgICAgY2FzZSBcImVuZFwiOlxuICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0LnN0b3AoKTtcbiAgICAgICAgfVxuICAgICAgfVxuICAgIH0sIF9jYWxsZWUsIG51bGwsIFtbMiwgMTgsIDIyLCAzMl0sIFsyMywsIDI3LCAzMV1dKTtcbiAgfSkpO1xuICByZXR1cm4gX2FzeW5jQ29uc3VtZS5hcHBseSh0aGlzLCBhcmd1bWVudHMpO1xufVxuXG5leHBvcnRzLl9fYXN5bmNDb25zdW1lID0gX19hc3luY0NvbnN1bWU7XG52YXIgYXN5bmNDb25zdW1lID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VfXyovX3JlZ2VuZXJhdG9yUnVudGltZS5tYXJrKGZ1bmN0aW9uIF9jYWxsZWUoc291cmNlLCBuKSB7XG4gICAgcmV0dXJuIF9yZWdlbmVyYXRvclJ1bnRpbWUud3JhcChmdW5jdGlvbiBfY2FsbGVlJChfY29udGV4dCkge1xuICAgICAgd2hpbGUgKDEpIHtcbiAgICAgICAgc3dpdGNoIChfY29udGV4dC5wcmV2ID0gX2NvbnRleHQubmV4dCkge1xuICAgICAgICAgIGNhc2UgMDpcbiAgICAgICAgICAgIF9jb250ZXh0LnQwID0gX2FzeW5jR2VuZXJhdG9yRGVsZWdhdGU7XG4gICAgICAgICAgICBfY29udGV4dC50MSA9IF9hc3luY0l0ZXJhdG9yO1xuICAgICAgICAgICAgX2NvbnRleHQudDIgPSBfX2N5Y2xlVGltZXM7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gNTtcbiAgICAgICAgICAgIHJldHVybiBfYXdhaXRBc3luY0dlbmVyYXRvcihfX2FzeW5jVG9BcnJheShzb3VyY2UpKTtcblxuICAgICAgICAgIGNhc2UgNTpcbiAgICAgICAgICAgIF9jb250ZXh0LnQzID0gX2NvbnRleHQuc2VudDtcbiAgICAgICAgICAgIF9jb250ZXh0LnQ0ID0gbjtcbiAgICAgICAgICAgIF9jb250ZXh0LnQ1ID0gKDAsIF9jb250ZXh0LnQyKShfY29udGV4dC50MywgX2NvbnRleHQudDQpO1xuICAgICAgICAgICAgX2NvbnRleHQudDYgPSAoMCwgX2NvbnRleHQudDEpKF9jb250ZXh0LnQ1KTtcbiAgICAgICAgICAgIF9jb250ZXh0LnQ3ID0gX2F3YWl0QXN5bmNHZW5lcmF0b3I7XG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuZGVsZWdhdGVZaWVsZCgoMCwgX2NvbnRleHQudDApKF9jb250ZXh0LnQ2LCBfY29udGV4dC50NyksIFwidDhcIiwgMTEpO1xuXG4gICAgICAgICAgY2FzZSAxMTpcbiAgICAgICAgIC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ICAgICBfY29udGV4dDIubmV4dCA9IDQwO1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiA9IHRydWU7XG4gICAgICAgICAgICBfZGlkSXRlcmF0b3JFcnJvciA9IGZhbHNlO1xuICAgICAgICAgICAgX2NvbnRleHQyLnByZXYgPSA0O1xuICAgICAgICAgICAgX2l0ZXJhdG9yID0gX2FzeW5jSXRlcmF0b3IoX19hc3luY1ppcEFsbChfX21hcCh2YWx1ZXMsIGFzeW5jSXRlcmFibGVPckVtcHR5KSwgemlwQWxsQ29uZmlnKSk7XG5cbiAgICAgICAgICBjYXNlIDY6XG4gICAgICAgICAgICBfY29udGV4dDIubmV4dCA9IDg7XG4gICAgICAgICAgICByZXR1cm4gX2l0ZXJhdG9yLm5leHQoKTtcblxuICAgICAgICAgIGNhc2UgODpcbiAgICAgICAgICAgIF9zdGVwID0gX2NvbnRleHQyLnNlbnQ7XG4gICAgICAgICAgICBfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uID0gX3N0ZXAuZG9uZTtcbiAgICAgICAgICAgIF9jb250ZXh0Mi5uZXh0ID0gMTI7XG4gICAgICAgICAgICByZXR1cm4gX3N0ZXAudmFsdWU7XG5cbiAgICAgICAgICBjYXNlIDEyOlxuICAgICAgICAgICAgX3ZhbHVlID0gX2NvbnRleHQyLnNlbnQ7XG5cbiAgICAgICAgICAgIGlmIChfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Mi5uZXh0ID0gMjI7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBzdGVwVmFsdWVzID0gX3ZhbHVlO1xuICAgICAgICAgICAgX2NvbnRleHQyLm5leHQgPSAxNztcbiAgICAgICAgICAgIHJldHVybiBfYXN5bmNEZWVwRXF1YWwoc3RlcFZhbHVlcywgc2FtZSwgaXNJdGVyYWJsZSwgZGVwdGggKyAxKTtcblxuICAgICAgICAgIGNhc2UgMTc6XG4gICAgICAgICAgICBpZiAoX2NvbnRleHQyLnNlbnQpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQyLm5leHQgPSAxOTtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dDIuYWJydXB0KFwicmV0dXJuXCIsIGZhbHNlKTtcblxuICAgICAgICAgIGNhc2UgMTk6XG4gICAgICAgICAgICBfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uID0gdHJ1ZTtcbiAgICAgICAgICAgIF9jb250ZXh0Mi5uZXh0ID0gNjtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSAyMjpcbiAgICAgICAgICAgIF9jb250ZXh0Mi5uZXh0ID0gMjg7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgIGNhc2UgMjQ6XG4gICAgICAgICAgICBfY29udGV4dDIucHJldiA9IDI0O1xuICAgICAgICAgICAgX2NvbnRleHQyLnQwID0gX2NvbnRleHQyW1wiY2F0Y2hcIl0oNCk7XG4gICAgICAgICAgICBfZGlkSXRlcmF0b3JFcnJvciA9IHRydWU7XG4gICAgICAgICAgICBfaXRlcmF0b3JFcnJvciA9IF9jb250ZXh0Mi50MDtcblxuICAgICAgICAgIGNhc2UgMjg6XG4gICAgICAgICAgICBfY29udGV4dDIucHJldiA9IDI4O1xuICAgICAgICAgICAgX2NvbnRleHQyLnByZXYgPSAyOTtcblxuICAgICAgICAgICAgaWYgKCEoIV9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gJiYgX2l0ZXJhdG9yW1wicmV0dXJuXCJdICE9IG51bGwpKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Mi5uZXh0ID0gMzM7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBfY29udGV4dDIubmV4dCA9IDMzO1xuICAgICAgICAgICAgcmV0dXJuIF9pdGVyYXRvcltcInJldHVyblwiXSgpO1xuXG4gICAgICAgICAgY2FzZSAzMzpcbiAgICAgICAgICAgIF9jb250ZXh0Mi5wcmV2ID0gMzM7XG5cbiAgICAgICAgICAgIGlmICghX2RpZEl0ZXJhdG9yRXJyb3IpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQyLm5leHQgPSAzNjtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHRocm93IF9pdGVyYXRvckVycm9yO1xuXG4gICAgICAgICAgY2FzZSAzNjpcbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dDIuZmluaXNoKDMzKTtcblxuICAgICAgICAgIGNhc2UgMzc6XG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQyLmZpbmlzaCgyOCk7XG5cbiAgICAgICAgICBjYXNlIDM4OlxuICAgICAgICAgICAgX2NvbnRleHQyLm5leHQgPSA1ODtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSA0MDpcbiAgICAgICAgICAgIGZpcnN0VmFsdWUgPSB2YWx1ZXNbMF07XG4gICAgICAgICAgICBfaXRlcmF0b3IyID0gX2NyZWF0ZUZvck9mSXRlcmF0b3JIZWxwZXIoX19zbGljZUZyb21TdGFydCh2YWx1ZXMsIDEpKTtcbiAgICAgICAgICAgIF9jb250ZXh0Mi5wcmV2ID0gNDI7XG5cbiAgICAgICAgICAgIF9pdGVyYXRvcjIucygpO1xuXG4gICAgICAgICAgY2FzZSA0NDpcbiAgICAgICAgICAgIGlmICgoX3N0ZXAyID0gX2l0ZXJhdG9yMi5uKCkpLmRvbmUpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQyLm5leHQgPSA1MDtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHZhbHVlID0gX3N0ZXAyLnZhbHVlO1xuXG4gICAgICAgICAgICBpZiAoc2FtZSh2YWx1ZSwgZmlyc3RWYWx1ZSwgZGVwdGgpKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Mi5uZXh0ID0gNDg7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQyLmFicnVwdChcInJldHVyblwiLCBmYWxzZSk7XG5cbiAgICAgICAgICBjYXNlIDQ4OlxuICAgICAgICAgICAgX2NvbnRleHQyLm5leHQgPSA0NDtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSA1MDpcbiAgICAgICAgICAgIF9jb250ZXh0Mi5uZXh0ID0gNTU7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgIGNhc2UgNTI6XG4gICAgICAgICAgICBfY29udGV4dDIucHJldiA9IDUyO1xuICAgICAgICAgICAgX2NvbnRleHQyLnQxID0gX2NvbnRleHQyW1wiY2F0Y2hcIl0oNDIpO1xuXG4gICAgICAgICAgICBfaXRlcmF0b3IyLmUoX2NvbnRleHQyLnQxKTtcblxuICAgICAgICAgIGNhc2UgNTU6XG4gICAgICAgICAgICBfY29udGV4dDIucHJldiA9IDU1O1xuXG4gICAgICAgICAgICBfaXRlcmF0b3IyLmYoKTtcblxuICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0Mi5maW5pc2goNTUpO1xuXG4gICAgICAgICAgY2FzZSA1ODpcbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dDIuYWJydXB0KFwicmV0dXJuXCIsIHRydWUpO1xuXG4gICAgICAgICAgY2FzZSA1OTpcbiAgICAgICAgICBjYXNlIFwiZW5kXCI6XG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQyLnN0b3AoKTtcbiAgICAgICAgfVxuICAgICAgfVxuICAgIH0sIF9jYWxsZWUyLCBudWxsLCBbWzQsIDI0LCAyOCwgMzhdL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VyYXRvcihfaXRlcmF0b3IubmV4dCgpKTtcblxuICAgICAgICAgIGNhc2UgNzpcbiAgICAgICAgICAgIF9zdGVwID0gX2NvbnRleHQuc2VudDtcbiAgICAgICAgICAgIF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gPSBfc3RlcC5kb25lO1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDExO1xuICAgICAgICAgICAgcmV0dXJuIF9hd2FpdEFzeW5jR2VuZXJhdG9yKF9zdGVwLnZhbHVlKTtcblxuICAgICAgICAgIGNhc2UgMTE6XG4gICAgICAgICAgICBfdmFsdWUgPSBfY29udGV4dC5zZW50O1xuXG4gICAgICAgICAgICBpZiAoX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbikge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMjM7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB2YWx1ZSA9IF92YWx1ZTtcbiAgICAgICAgICAgIGtleSA9IHNlbGVjdG9yID8gc2VsZWN0b3IodmFsdWUpIDogdmFsdWU7XG5cbiAgICAgICAgICAgIGlmICghc2V0LmhhcyhrZXkpKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxNztcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dC5hYnJ1cHQoXCJjb250aW51ZVwiLCAyMCk7XG5cbiAgICAgICAgICBjYXNlIDE3OlxuICAgICAgICAgICAgc2V0LmFkZChrZXkpO1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDIwO1xuICAgICAgICAgICAgcmV0dXJuIHZhbHVlO1xuXG4gICAgICAgICAgY2FzZSAyMDpcbiAgICAgICAgICAgIF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gPSB0cnVlO1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDU7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgIGNhc2UgMjM6XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMjk7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgIGNhc2UgMjU6XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMjU7XG4gICAgICAgICAgICBfY29udGV4dC50MCA9IF9jb250ZXh0W1wiY2F0Y2hcIl0oMyk7XG4gICAgICAgICAgICBfZGlkSXRlcmF0b3JFcnJvciA9IHRydWU7XG4gICAgICAgICAgICBfaXRlcmF0b3JFcnJvciA9IF9jb250ZXh0LnQwO1xuXG4gICAgICAgICAgY2FzZSAyOTpcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAyOTtcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAzMDtcblxuICAgICAgICAgICAgaWYgKCEoIV9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gJiYgX2l0ZXJhdG9yW1wicmV0dXJuXCJdICE9IG51bGwpKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAzNDtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAzNDtcbiAgICAgICAgICAgIHJldHVybiBfYXdhaXRBc3luY0dlbmVyYXRvcihfaXRlcmF0b3JbXCJyZXR1cm5cIl0oKSk7XG5cbiAgICAgICAgICBjYXNlIDM0OlxuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDM0O1xuXG4gICAgICAgICAgICBpZiAoIV9kaWRJdGVyYXRvckVycm9yKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAzNztcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHRocm93IF9pdGVyYXRvckVycm9yO1xuXG4gICAgICAgICAgY2FzZSAzNzpcbiAgICAgICAgICAgIHJldHVybiBfY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N0aW5jdCQoX2NvbnRleHQpIHtcbiAgICB3aGlsZSAoMSkge1xuICAgICAgc3dpdGNoIChfY29udGV4dC5wcmV2ID0gX2NvbnRleHQubmV4dCkge1xuICAgICAgICBjYXNlIDA6XG4gICAgICAgICAgc2V0ID0gbmV3IFNldCgpO1xuICAgICAgICAgIF9pdGVyYXRvciA9IF9jcmVhdGVGb3JPZkl0ZXJhdG9ySGVscGVyKHNvdXJjZSk7XG4gICAgICAgICAgX2NvbnRleHQucHJldiA9IDI7XG5cbiAgICAgICAgICBfaXRlcmF0b3IucygpO1xuXG4gICAgICAgIGNhc2UgNDpcbiAgICAgICAgICBpZiAoKF9zdGVwID0gX2l0ZXJhdG9yLm4oKSkuZG9uZSkge1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDE0O1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgdmFsdWUgPSBfc3RlcC52YWx1ZTtcbiAgICAgICAgICBrZXkgPSBzZWxlY3RvciA/IHNlbGVjdG9yKHZhbHVlKSA6IHZhbHVlO1xuXG4gICAgICAgICAgaWYgKCFzZXQuaGFzKGtleSkpIHtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA5O1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgcmV0dXJuIF9jb250ZXh0LmFicnVwdChcImNvbnRpbnVlXCIsIDEyKTtcblxuICAgICAgICBjYXNlIDk6XG4gICAgICAgICAgc2V0LmFkZChrZXkpO1xuICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxMjtcbiAgICAgICAgICByZXR1cm4gdmFsdWU7XG5cbiAgICAgICAgY2FzZSAxMjpcbiAgICAgICAgICBfY29udGV4dC5uZXh0ID0gNDtcbiAgICAgICAgICBicmVhaztcblxuICAgICAgICBjYXNlIDE0OlxuICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxOTtcbiAgICAgICAgICBicmVhaztcblxuIC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GVyYXRvckVycm9yID0gZmFsc2U7XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gNDtcbiAgICAgICAgICAgIF9pdGVyYXRvciA9IF9hc3luY0l0ZXJhdG9yKHNvdXJjZSk7XG5cbiAgICAgICAgICBjYXNlIDY6XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gODtcbiAgICAgICAgICAgIHJldHVybiBfYXdhaXRBc3luY0dlbmVyYXRvcihfaXRlcmF0b3IubmV4dCgpKTtcblxuICAgICAgICAgIGNhc2UgODpcbiAgICAgICAgICAgIF9zdGVwID0gX2NvbnRleHQuc2VudDtcbiAgICAgICAgICAgIF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gPSBfc3RlcC5kb25lO1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDEyO1xuICAgICAgICAgICAgcmV0dXJuIF9hd2FpdEFzeW5jR2VuZXJhdG9yKF9zdGVwLnZhbHVlKTtcblxuICAgICAgICAgIGNhc2UgMTI6XG4gICAgICAgICAgICBfdmFsdWUgPSBfY29udGV4dC5zZW50O1xuXG4gICAgICAgICAgICBpZiAoX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbikge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMjk7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB2YWx1ZSA9IF92YWx1ZTtcblxuICAgICAgICAgICAgaWYgKGRyb3ApIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDIwO1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDE4O1xuICAgICAgICAgICAgcmV0dXJuIHZhbHVlO1xuXG4gICAgICAgICAgY2FzZSAxODpcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyNjtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSAyMDpcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyMjtcbiAgICAgICAgICAgIHJldHVybiBfYXdhaXRBc3luY0dlbmVyYXRvcihwcmVkaWNhdGUodmFsdWUsIGMrKykpO1xuXG4gICAgICAgICAgY2FzZSAyMjpcbiAgICAgICAgICAgIGRyb3AgPSBfY29udGV4dC5zZW50O1xuXG4gICAgICAgICAgICBpZiAoZHJvcCkge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMjY7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMjY7XG4gICAgICAgICAgICByZXR1cm4gdmFsdWU7XG5cbiAgICAgICAgICBjYXNlIDI2OlxuICAgICAgICAgICAgX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiA9IHRydWU7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gNjtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSAyOTpcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAzNTtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSAzMTpcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAzMTtcbiAgICAgICAgICAgIF9jb250ZXh0LnQwID0gX2NvbnRleHRbXCJjYXRjaFwiXSg0KTtcbiAgICAgICAgICAgIF9kaWRJdGVyYXRvckVycm9yID0gdHJ1ZTtcbiAgICAgICAgICAgIF9pdGVyYXRvckVycm9yID0gX2NvbnRleHQudDA7XG5cbiAgICAgICAgICBjYXNlIDM1OlxuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDM1O1xuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDM2O1xuXG4gICAgICAgICAgICBpZiAoISghX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiAmJiBfaXRlcmF0b3JbXCJyZXR1cm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LnZhbHVlO1xuXG4gICAgICAgICAgaWYgKGRyb3ApIHtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxMjtcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxMDtcbiAgICAgICAgICByZXR1cm4gdmFsdWU7XG5cbiAgICAgICAgY2FzZSAxMDpcbiAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTY7XG4gICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgY2FzZSAxMjpcbiAgICAgICAgICBkcm9wID0gcHJlZGljYXRlKHZhbHVlLCBjKyspO1xuXG4gICAgICAgICAgaWYgKGRyb3ApIHtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxNjtcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxNjtcbiAgICAgICAgICByZXR1cm4gdmFsdWU7XG5cbiAgICAgICAgY2FzZSAxNjpcbiAgICAgICAgICBfY29udGV4dC5uZXh0ID0gNTtcbiAgICAgICAgICBicmVhaztcblxuICAgICAgICBjYXNlIDE4OlxuICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyMztcbiAgICAgICAgICBicmVhaztcblxuICAgICAgICBjYXNlIDIwOlxuICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAyMDtcbiAgICAgICAgICBfY29udGV4dC50MCA9IF9jb250ZXh0W1wiY2F0Y2hcIl0oMyk7XG5cbiAgICAgICAgICBfaXRlcmF0b3IuZShfY29udGV4dC50MCk7XG5cbiAgICAgICAgY2FzZSAyMzpcbiAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMjM7XG5cbiAgICAgICAgICBfaXRlcmF0b3IuZigpO1xuXG4gICAgICAgICAgcmV0dXJuIF9jb250ZXh0LmZpbmlzaCgyMyk7XG5cbiAgICAgICAgY2FzZSAyNjpcbiAgICAgICAgY2FzZ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AgICAgICAgICByZXR1cm4gX2F3YWl0QXN5bmNHZW5lcmF0b3IoX3N0ZXAudmFsdWUpO1xuXG4gICAgICAgICAgY2FzZSAxMTpcbiAgICAgICAgICAgIF92YWx1ZSA9IF9jb250ZXh0LnNlbnQ7XG5cbiAgICAgICAgICAgIGlmIChfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyMDtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHZhbHVlID0gX3ZhbHVlO1xuXG4gICAgICAgICAgICBpZiAoIShpKysgPj0gbikpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDE3O1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDE3O1xuICAgICAgICAgICAgcmV0dXJuIHZhbHVlO1xuXG4gICAgICAgICAgY2FzZSAxNzpcbiAgICAgICAgICAgIF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gPSB0cnVlO1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDU7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgIGNhc2UgMjA6XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMjY7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgIGNhc2UgMjI6XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMjI7XG4gICAgICAgICAgICBfY29udGV4dC50MCA9IF9jb250ZXh0W1wiY2F0Y2hcIl0oMyk7XG4gICAgICAgICAgICBfZGlkSXRlcmF0b3JFcnJvciA9IHRydWU7XG4gICAgICAgICAgICBfaXRlcmF0b3JFcnJvciA9IF9jb250ZXh0LnQwO1xuXG4gICAgICAgICAgY2FzZSAyNjpcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAyNjtcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAyNztcblxuICAgICAgICAgICAgaWYgKCEoIV9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gJiYgX2l0ZXJhdG9yW1wicmV0dXJuXCJdICE9IG51bGwpKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAzMTtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAzMTtcbiAgICAgICAgICAgIHJldHVybiBfYXdhaXRBc3luY0dlbmVyYXRvcihfaXRlcmF0b3JbXCJyZXR1cm5cIl0oKSk7XG5cbiAgICAgICAgICBjYXNlIDMxOlxuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDMxO1xuXG4gICAgICAgICAgICBpZiAoIV9kaWRJdGVyYXRvckVycm9yKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAzNDtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHRocm93IF9pdGVyYXRvckVycm9yO1xuXG4gICAgICAgICAgY2FzZSAzNDpcbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dC5maW5pc2goMzEpO1xuXG4gICAgICAgICAgY2FzZSAzNTpcbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dC5maW5pc2goMjYpO1xuXG4gICAgICAgICAgY2FzZSAzNjpcbiAgICAgICAgICBjYXNlIFwiZW5kXCI6XG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuc3RvcCgpO1xuICAgICAgICB9XG4gICAgICB9XG4gICAgfSwgX2NhbGxlZSwgbnVsbCwgW1szLCAyMiwgMjYsIDM2XSwgWzI3LCwgMzEsIDM1XV0pO1xuICB9KSk7XG4gIHJldHVybiBfYXN5bmNEcm9wLmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7XG59XG5cbnZhciBhc3luY0Ryb3AgPSAvKiNfX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gIHZhbHVlID0gX3N0ZXAudmFsdWU7XG5cbiAgICAgICAgICBpZiAoIShpKysgPj0gbikpIHtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA5O1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgX2NvbnRleHQubmV4dCA9IDk7XG4gICAgICAgICAgcmV0dXJuIHZhbHVlO1xuXG4gICAgICAgIGNhc2UgOTpcbiAgICAgICAgICBfY29udGV4dC5uZXh0ID0gNDtcbiAgICAgICAgICBicmVhaztcblxuICAgICAgICBjYXNlIDExOlxuICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxNjtcbiAgICAgICAgICBicmVhaztcblxuICAgICAgICBjYXNlIDEzOlxuICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAxMztcbiAgICAgICAgICBfY29udGV4dC50MCA9IF9jb250ZXh0W1wiY2F0Y2hcIl0oMik7XG5cbiAgICAgICAgICBfaXRlcmF0b3IuZShfY29udGV4dC50MCk7XG5cbiAgICAgICAgY2FzZSAxNjpcbiAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMTY7XG5cbiAgICAgICAgICBfaXRlcmF0b3IuZigpO1xuXG4gICAgICAgICAgcmV0dXJuIF9jb250ZXh0LmZpbmlzaCgxNik7XG5cbiAgICAgICAgY2FzZSAxOTpcbiAgICAgICAgY2FzZSBcImVuZFwiOlxuICAgICAgICAgIHJldHVybiBfY29udGV4dC5zdG9wKCk7XG4gICAgICB9XG4gICAgfVxuICB9LCBfbWFya2VkLCBudWxsLCBbWzIsIDEzLCAxNiwgMTldXSk7XG59XG5cbmV4cG9ydHMuX19kcm9wID0gX19kcm9wO1xudmFyIGRyb3AgPSAvKiNfX1BVUkVfXyovaXRlcmFibGVDdXJyeShfX2Ryb3ApO1xuZXhwb3J0cy5kcm9wID0gZHJvcDsiLCJ2YXIgX3JlcXVpcmUgPSByZXF1aXJlKCcuLi8uLi9pbnRlcm5hbC9hc3luYy1pdGV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SAmJiBfYXJnc1sxXSAhPT0gdW5kZWZpbmVkID8gX2FyZ3NbMV0gOiBPYmplY3QuaXM7XG5cbiAgICAgICAgICAgIGlmICghKGl0ZXJhYmxlcy5sZW5ndGggPD0gMSkpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDM7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuYWJydXB0KFwicmV0dXJuXCIsIHRydWUpO1xuXG4gICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiA9IHRydWU7XG4gICAgICAgICAgICBfZGlkSXRlcmF0b3JFcnJvciA9IGZhbHNlO1xuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDU7XG4gICAgICAgICAgICBfaXRlcmF0b3IgPSBfYXN5bmNJdGVyYXRvcihfX2FzeW5jWmlwQWxsKGl0ZXJhYmxlcywgemlwQWxsQ29uZmlnKSk7XG5cbiAgICAgICAgICBjYXNlIDc6XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gOTtcbiAgICAgICAgICAgIHJldHVybiBfaXRlcmF0b3IubmV4dCgpO1xuXG4gICAgICAgICAgY2FzZSA5OlxuICAgICAgICAgICAgX3N0ZXAgPSBfY29udGV4dC5zZW50O1xuICAgICAgICAgICAgX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiA9IF9zdGVwLmRvbmU7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTM7XG4gICAgICAgICAgICByZXR1cm4gX3N0ZXAudmFsdWU7XG5cbiAgICAgICAgICBjYXNlIDEzOlxuICAgICAgICAgICAgX3ZhbHVlID0gX2NvbnRleHQuc2VudDtcblxuICAgICAgICAgICAgaWYgKF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24pIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDM3O1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgc3RlcFZhbHVlcyA9IF92YWx1ZTtcbiAgICAgICAgICAgIGZpcnN0VmFsdWUgPSBzdGVwVmFsdWVzWzBdO1xuICAgICAgICAgICAgX2l0ZXJhdG9yMiA9IF9jcmVhdGVGb3JPZkl0ZXJhdG9ySGVscGVyKF9fc2xpY2VGcm9tU3RhcnQoc3RlcFZhbHVlcywgMSkpO1xuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDE4O1xuXG4gICAgICAgICAgICBfaXRlcmF0b3IyLnMoKTtcblxuICAgICAgICAgIGNhc2UgMjA6XG4gICAgICAgICAgICBpZiAoKF9zdGVwMiA9IF9pdGVyYXRvcjIubigpKS5kb25lKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyNjtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHZhbHVlID0gX3N0ZXAyLnZhbHVlO1xuXG4gICAgICAgICAgICBpZiAoc2FtZSh2YWx1ZSwgZmlyc3RWYWx1ZSkpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDI0O1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0LmFicnVwdChcInJldHVyblwiLCBmYWxzZSk7XG5cbiAgICAgICAgICBjYXNlIDI0OlxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDIwO1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICBjYXNlIDI2OlxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDMxO1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICBjYXNlIDI4OlxuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDI4O1xuICAgICAgICAgICAgX2NvbnRleHQudDAgPSBfY29udGV4dFtcImNhdGNoXCJdKDE4KTtcblxuICAgICAgICAgICAgX2l0ZXJhdG9yMi5lKF9jb250ZXh0LnQwKTtcblxuICAgICAgICAgIGNhc2UgMzE6XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMzE7XG5cbiAgICAgICAgICAgIF9pdGVyYXRvcjIuZigpO1xuXG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuZmluaXNoKDMxKTtcblxuICAgICAgICAgIGNhc2UgMzQ6XG4gICAgICAgICAgICBfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uID0gdHJ1ZTtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA3O1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICBjYXNlIDM3OlxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDQzO1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICBjYXNlIDM5OlxuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDM5O1xuICAgICAgICAgICAgX2NvbnRleHQudDEgPSBfY29udGV4dFtcImNhdGNoXCJdKDUpO1xuICAgICAgICAgICAgX2RpZEl0ZXJhdG9yRXJyb3IgPSB0cnVlO1xuICAgICAgICAgICAgX2l0ZXJhdG9yRXJyb3IgPSBfY29udGV4dC50MTtcblxuICAgICAgICAgIGNhc2UgNDM6XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gNDM7XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gNDQ7XG5cbiAgICAgICAgICAgIGlmICghKCFfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uICYmIF9pdGVyYXRvcltcInJldHVyblwiXSAhPSBudWxsKSkge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gNDg7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gNDg7XG4gICAgICAgICAgICByZXR1cm4gX2l0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aWRJdGVyYXRvckVycm9yID0gZmFsc2U7XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMztcbiAgICAgICAgICAgIF9pdGVyYXRvciA9IF9hc3luY0l0ZXJhdG9yKGl0ZXJhYmxlKTtcblxuICAgICAgICAgIGNhc2UgNTpcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA3O1xuICAgICAgICAgICAgcmV0dXJuIF9pdGVyYXRvci5uZXh0KCk7XG5cbiAgICAgICAgICBjYXNlIDc6XG4gICAgICAgICAgICBfc3RlcCA9IF9jb250ZXh0LnNlbnQ7XG4gICAgICAgICAgICBfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uID0gX3N0ZXAuZG9uZTtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxMTtcbiAgICAgICAgICAgIHJldHVybiBfc3RlcC52YWx1ZTtcblxuICAgICAgICAgIGNhc2UgMTE6XG4gICAgICAgICAgICBfdmFsdWUgPSBfY29udGV4dC5zZW50O1xuXG4gICAgICAgICAgICBpZiAoX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbikge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMjE7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB2YWx1ZSA9IF92YWx1ZTtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxNjtcbiAgICAgICAgICAgIHJldHVybiBwcmVkaWNhdGUodmFsdWUsIGMrKyk7XG5cbiAgICAgICAgICBjYXNlIDE2OlxuICAgICAgICAgICAgaWYgKF9jb250ZXh0LnNlbnQpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDE4O1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0LmFicnVwdChcInJldHVyblwiLCBmYWxzZSk7XG5cbiAgICAgICAgICBjYXNlIDE4OlxuICAgICAgICAgICAgX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiA9IHRydWU7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gNTtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSAyMTpcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyNztcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSAyMzpcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAyMztcbiAgICAgICAgICAgIF9jb250ZXh0LnQwID0gX2NvbnRleHRbXCJjYXRjaFwiXSgzKTtcbiAgICAgICAgICAgIF9kaWRJdGVyYXRvckVycm9yID0gdHJ1ZTtcbiAgICAgICAgICAgIF9pdGVyYXRvckVycm9yID0gX2NvbnRleHQudDA7XG5cbiAgICAgICAgICBjYXNlIDI3OlxuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDI3O1xuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDI4O1xuXG4gICAgICAgICAgICBpZiAoISghX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiAmJiBfaXRlcmF0b3JbXCJyZXR1cm5cIl0gIT0gbnVsbCkpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDMyO1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDMyO1xuICAgICAgICAgICAgcmV0dXJuIF9pdGVyYXRvcltcInJldHVyblwiXSgpO1xuXG4gICAgICAgICAgY2FzZSAzMjpcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAzMjtcblxuICAgICAgICAgICAgaWYgKCFfZGlkSXRlcmF0b3JFcnJvcikge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMzU7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgIC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NvbnRleHQubmV4dCA9IDc7XG4gICAgICAgICAgICByZXR1cm4gX2F3YWl0QXN5bmNHZW5lcmF0b3IoX2l0ZXJhdG9yLm5leHQoKSk7XG5cbiAgICAgICAgICBjYXNlIDc6XG4gICAgICAgICAgICBfc3RlcCA9IF9jb250ZXh0LnNlbnQ7XG4gICAgICAgICAgICBfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uID0gX3N0ZXAuZG9uZTtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxMTtcbiAgICAgICAgICAgIHJldHVybiBfYXdhaXRBc3luY0dlbmVyYXRvcihfc3RlcC52YWx1ZSk7XG5cbiAgICAgICAgICBjYXNlIDExOlxuICAgICAgICAgICAgX3ZhbHVlID0gX2NvbnRleHQuc2VudDtcblxuICAgICAgICAgICAgaWYgKF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24pIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDIyO1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdmFsdWUgPSBfdmFsdWU7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTY7XG4gICAgICAgICAgICByZXR1cm4gX2F3YWl0QXN5bmNHZW5lcmF0b3IocHJlZGljYXRlKHZhbHVlLCBjKyspKTtcblxuICAgICAgICAgIGNhc2UgMTY6XG4gICAgICAgICAgICBpZiAoIV9jb250ZXh0LnNlbnQpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDE5O1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDE5O1xuICAgICAgICAgICAgcmV0dXJuIHZhbHVlO1xuXG4gICAgICAgICAgY2FzZSAxOTpcbiAgICAgICAgICAgIF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gPSB0cnVlO1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDU7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgIGNhc2UgMjI6XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMjg7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgIGNhc2UgMjQ6XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMjQ7XG4gICAgICAgICAgICBfY29udGV4dC50MCA9IF9jb250ZXh0W1wiY2F0Y2hcIl0oMyk7XG4gICAgICAgICAgICBfZGlkSXRlcmF0b3JFcnJvciA9IHRydWU7XG4gICAgICAgICAgICBfaXRlcmF0b3JFcnJvciA9IF9jb250ZXh0LnQwO1xuXG4gICAgICAgICAgY2FzZSAyODpcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAyODtcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAyOTtcblxuICAgICAgICAgICAgaWYgKCEoIV9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gJiYgX2l0ZXJhdG9yW1wicmV0dXJuXCJdICE9IG51bGwpKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAzMztcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAzMztcbiAgICAgICAgICAgIHJldHVybiBfYXdhaXRBc3luY0dlbmVyYXRvcihfaXRlcmF0b3JbXCJyZXR1cm5cIl0oKSk7XG5cbiAgICAgICAgICBjYXNlIDMzOlxuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDMzO1xuXG4gICAgICAgICAgICBpZiAoIV9kaWRJdGVyYXRvckVycm9yKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAzNjtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHRocm93IF9pdGVyYXRvckVycm9yO1xuXG4gICAgICAgICAgY2FzZSAzNjpcbiAgICAgICAgIC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hpbGUgKDEpIHtcbiAgICAgIHN3aXRjaCAoX2NvbnRleHQucHJldiA9IF9jb250ZXh0Lm5leHQpIHtcbiAgICAgICAgY2FzZSAwOlxuICAgICAgICAgIGMgPSAwO1xuICAgICAgICAgIF9pdGVyYXRvciA9IF9jcmVhdGVGb3JPZkl0ZXJhdG9ySGVscGVyKHNvdXJjZSk7XG4gICAgICAgICAgX2NvbnRleHQucHJldiA9IDI7XG5cbiAgICAgICAgICBfaXRlcmF0b3IucygpO1xuXG4gICAgICAgIGNhc2UgNDpcbiAgICAgICAgICBpZiAoKF9zdGVwID0gX2l0ZXJhdG9yLm4oKSkuZG9uZSkge1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDExO1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgdmFsdWUgPSBfc3RlcC52YWx1ZTtcblxuICAgICAgICAgIGlmICghcHJlZGljYXRlKHZhbHVlLCBjKyspKSB7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gOTtcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA5O1xuICAgICAgICAgIHJldHVybiB2YWx1ZTtcblxuICAgICAgICBjYXNlIDk6XG4gICAgICAgICAgX2NvbnRleHQubmV4dCA9IDQ7XG4gICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgY2FzZSAxMTpcbiAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTY7XG4gICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgY2FzZSAxMzpcbiAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMTM7XG4gICAgICAgICAgX2NvbnRleHQudDAgPSBfY29udGV4dFtcImNhdGNoXCJdKDIpO1xuXG4gICAgICAgICAgX2l0ZXJhdG9yLmUoX2NvbnRleHQudDApO1xuXG4gICAgICAgIGNhc2UgMTY6XG4gICAgICAgICAgX2NvbnRleHQucHJldiA9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uXG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuYWJydXB0KFwicmV0dXJuXCIsIG5vdEZvdW5kVmFsdWUpO1xuXG4gICAgICAgICAgY2FzZSA4OlxuICAgICAgICAgICAgYmVzdCA9IHBlZWtyLnZhbHVlO1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDExO1xuICAgICAgICAgICAgcmV0dXJuIG1hcHBlcihiZXN0LCBwZWVrci5pbmRleCk7XG5cbiAgICAgICAgICBjYXNlIDExOlxuICAgICAgICAgICAgYmVzdFZhbHVlID0gX2NvbnRleHQuc2VudDtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxNDtcbiAgICAgICAgICAgIHJldHVybiBwZWVrci5hZHZhbmNlKCk7XG5cbiAgICAgICAgICBjYXNlIDE0OlxuICAgICAgICAgICAgaWYgKHBlZWtyLmRvbmUpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDI0O1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgY2FuZGlkYXRlID0gcGVla3IudmFsdWU7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTg7XG4gICAgICAgICAgICByZXR1cm4gbWFwcGVyKGNhbmRpZGF0ZSwgcGVla3IuaW5kZXgpO1xuXG4gICAgICAgICAgY2FzZSAxODpcbiAgICAgICAgICAgIGNhbmRpZGF0ZVZhbHVlID0gX2NvbnRleHQuc2VudDtcblxuICAgICAgICAgICAgaWYgKGNvbXBhcmVyKGJlc3RWYWx1ZSwgY2FuZGlkYXRlVmFsdWUpKSB7XG4gICAgICAgICAgICAgIGJlc3QgPSBjYW5kaWRhdGU7XG4gICAgICAgICAgICAgIGJlc3RWYWx1ZSA9IGNhbmRpZGF0ZVZhbHVlO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMjI7XG4gICAgICAgICAgICByZXR1cm4gcGVla3IuYWR2YW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A9IF9hc3luY0l0ZXJhdG9yKGl0ZXJhYmxlKTtcblxuICAgICAgICAgIGNhc2UgNTpcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA3O1xuICAgICAgICAgICAgcmV0dXJuIF9pdGVyYXRvci5uZXh0KCk7XG5cbiAgICAgICAgICBjYXNlIDc6XG4gICAgICAgICAgICBfc3RlcCA9IF9jb250ZXh0LnNlbnQ7XG4gICAgICAgICAgICBfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uID0gX3N0ZXAuZG9uZTtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxMTtcbiAgICAgICAgICAgIHJldHVybiBfc3RlcC52YWx1ZTtcblxuICAgICAgICAgIGNhc2UgMTE6XG4gICAgICAgICAgICBfdmFsdWUgPSBfY29udGV4dC5zZW50O1xuXG4gICAgICAgICAgICBpZiAoX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbikge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMjE7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB2YWx1ZSA9IF92YWx1ZTtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxNjtcbiAgICAgICAgICAgIHJldHVybiBmdW5jKHZhbHVlLCBjKyspO1xuXG4gICAgICAgICAgY2FzZSAxNjpcbiAgICAgICAgICAgIGlmICghX2NvbnRleHQuc2VudCkge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTg7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuYWJydXB0KFwicmV0dXJuXCIsIHZhbHVlKTtcblxuICAgICAgICAgIGNhc2UgMTg6XG4gICAgICAgICAgICBfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uID0gdHJ1ZTtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA1O1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICBjYXNlIDIxOlxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDI3O1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICBjYXNlIDIzOlxuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDIzO1xuICAgICAgICAgICAgX2NvbnRleHQudDAgPSBfY29udGV4dFtcImNhdGNoXCJdKDMpO1xuICAgICAgICAgICAgX2RpZEl0ZXJhdG9yRXJyb3IgPSB0cnVlO1xuICAgICAgICAgICAgX2l0ZXJhdG9yRXJyb3IgPSBfY29udGV4dC50MDtcblxuICAgICAgICAgIGNhc2UgMjc6XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMjc7XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMjg7XG5cbiAgICAgICAgICAgIGlmICghKCFfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uICYmIF9pdGVyYXRvcltcInJldHVyblwiXSAhPSBudWxsKSkge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMzI7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMzI7XG4gICAgICAgICAgICByZXR1cm4gX2l0ZXJhdG9yW1wicmV0dXJuXCJdKCk7XG5cbiAgICAgICAgICBjYXNlIDMyOlxuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDMyO1xuXG4gICAgICAgICAgICBpZiAoIV9kaWRJdGVyYXRvckVycm9yKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAzNTtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHRocm93IF9pdGVyYXRvckVycm9yO1xuXG4gICAgICAgICAgY2FzZSAzNTpcbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dC5maW5pc2goMzIpO1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ICBfZGlkSXRlcmF0b3JFcnJvciA9IGZhbHNlO1xuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDI7XG4gICAgICAgICAgICBfaXRlcmF0b3IgPSBfYXN5bmNJdGVyYXRvcihfX2FzeW5jTWFwKHNvdXJjZSwgZnVuYykpO1xuXG4gICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDY7XG4gICAgICAgICAgICByZXR1cm4gX2F3YWl0QXN5bmNHZW5lcmF0b3IoX2l0ZXJhdG9yLm5leHQoKSk7XG5cbiAgICAgICAgICBjYXNlIDY6XG4gICAgICAgICAgICBfc3RlcCA9IF9jb250ZXh0LnNlbnQ7XG4gICAgICAgICAgICBfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uID0gX3N0ZXAuZG9uZTtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxMDtcbiAgICAgICAgICAgIHJldHVybiBfYXdhaXRBc3luY0dlbmVyYXRvcihfc3RlcC52YWx1ZSk7XG5cbiAgICAgICAgICBjYXNlIDEwOlxuICAgICAgICAgICAgX3ZhbHVlID0gX2NvbnRleHQuc2VudDtcblxuICAgICAgICAgICAgaWYgKF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24pIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDE3O1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdmFsdWUgPSBfdmFsdWU7XG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuZGVsZWdhdGVZaWVsZChfYXN5bmNHZW5lcmF0b3JEZWxlZ2F0ZShfYXN5bmNJdGVyYXRvcih2YWx1ZSksIF9hd2FpdEFzeW5jR2VuZXJhdG9yKSwgXCJ0MFwiLCAxNCk7XG5cbiAgICAgICAgICBjYXNlIDE0OlxuICAgICAgICAgICAgX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiA9IHRydWU7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gNDtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSAxNzpcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyMztcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSAxOTpcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAxOTtcbiAgICAgICAgICAgIF9jb250ZXh0LnQxID0gX2NvbnRleHRbXCJjYXRjaFwiXSgyKTtcbiAgICAgICAgICAgIF9kaWRJdGVyYXRvckVycm9yID0gdHJ1ZTtcbiAgICAgICAgICAgIF9pdGVyYXRvckVycm9yID0gX2NvbnRleHQudDE7XG5cbiAgICAgICAgICBjYXNlIDIzOlxuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDIzO1xuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDI0O1xuXG4gICAgICAgICAgICBpZiAoISghX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiAmJiBfaXRlcmF0b3JbXCJyZXR1cm5cIl0gIT0gbnVsbCkpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDI4O1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDI4O1xuICAgICAgICAgICAgcmV0dXJuIF9hd2FpdEFzeW5jR2VuZXJhdG9yKF9pdGVyYXRvcltcInJldHVyblwiXSgpKTtcblxuICAgICAgICAgIGNhc2UgMjg6XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMjg7XG5cbiAgICAgICAgICAgIGlmICghX2RpZEl0ZXJhdG9yRXJyb3IpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDMxO1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdGhyb3cgX2l0ZXJhdG9yRXJyb3I7XG5cbi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sZSAoMSkge1xuICAgICAgICBzd2l0Y2ggKF9jb250ZXh0LnByZXYgPSBfY29udGV4dC5uZXh0KSB7XG4gICAgICAgICAgY2FzZSAwOlxuICAgICAgICAgICAgX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiA9IHRydWU7XG4gICAgICAgICAgICBfZGlkSXRlcmF0b3JFcnJvciA9IGZhbHNlO1xuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDI7XG4gICAgICAgICAgICBfaXRlcmF0b3IgPSBfYXN5bmNJdGVyYXRvcihzb3VyY2UpO1xuXG4gICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDY7XG4gICAgICAgICAgICByZXR1cm4gX2F3YWl0QXN5bmNHZW5lcmF0b3IoX2l0ZXJhdG9yLm5leHQoKSk7XG5cbiAgICAgICAgICBjYXNlIDY6XG4gICAgICAgICAgICBfc3RlcCA9IF9jb250ZXh0LnNlbnQ7XG4gICAgICAgICAgICBfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uID0gX3N0ZXAuZG9uZTtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxMDtcbiAgICAgICAgICAgIHJldHVybiBfYXdhaXRBc3luY0dlbmVyYXRvcihfc3RlcC52YWx1ZSk7XG5cbiAgICAgICAgICBjYXNlIDEwOlxuICAgICAgICAgICAgX3ZhbHVlID0gX2NvbnRleHQuc2VudDtcblxuICAgICAgICAgICAgaWYgKF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24pIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDI3O1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdmFsdWUgPSBfdmFsdWU7XG4gICAgICAgICAgICBfY29udGV4dC50MCA9IGN1cnJlbnREZXB0aCA8IGRlcHRoO1xuXG4gICAgICAgICAgICBpZiAoIV9jb250ZXh0LnQwKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxODtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxNztcbiAgICAgICAgICAgIHJldHVybiBfYXdhaXRBc3luY0dlbmVyYXRvcihzaG91bGRGbGF0KHZhbHVlKSk7XG5cbiAgICAgICAgICBjYXNlIDE3OlxuICAgICAgICAgICAgX2NvbnRleHQudDAgPSBfY29udGV4dC5zZW50O1xuXG4gICAgICAgICAgY2FzZSAxODpcbiAgICAgICAgICAgIGlmICghX2NvbnRleHQudDApIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDIyO1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0LmRlbGVnYXRlWWllbGQoX2FzeW5jR2VuZXJhdG9yRGVsZWdhdGUoX2FzeW5jSXRlcmF0b3IoYXN5bmNGbGF0SW50ZXJuYWwoc2hvdWxkRmxhdCwgZGVwdGgsIGN1cnJlbnREZXB0aCArIDEsIHZhbHVlKSksIF9hd2FpdEFzeW5jR2VuZXJhdG9yKSwgXCJ0MVwiLCAyMCk7XG5cbiAgICAgICAgICBjYXNlIDIwOlxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDI0O1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICBjYXNlIDIyOlxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDI0O1xuICAgICAgICAgICAgcmV0dXJuIHZhbHVlO1xuXG4gICAgICAgICAgY2FzZSAyNDpcbiAgICAgICAgICAgIF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gPSB0cnVlO1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDQ7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgIGNhc2UgMjc6XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMzM7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgIGNhc2UgMjk6XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMjk7XG4gICAgICAgICAgICBfY29udGV4dC50MiA9IF9jb250ZXh0W1wiY2F0Y2hcIl0oMik7XG4gICAgICAgICAgICBfZGlkSXRlcmF0b3JFcnJvciA9IHRydWU7XG4gICAgICAgICAgICBfaXRlcmF0b3JFcnJvciA9IF9jb250ZXh0LnQyO1xuXG4gICAgICAgICAgY2FzZSAzMzpcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAzMztcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAzNDtcblxuICAgICAgICAgICAgaWYgKCEoIV9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gJiYgX2l0ZXJhdG9yW1wicmV0dXJuXCJdICE9IG51bGwpKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAzODtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAzODtcbiAgICAgICAgICAgIHJldHVybiBfYXdhaXRBc3luY0dlbmVyYXRvcihfaXRlcmF0b3JbXCJyZXR1cm5cIl0oKSk7XG5cbiAgICAgICAgICBjYXNlIDM4OlxuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDM4O1xuXG4gICAgICAgICAgICBpZiAoIV9kaWRJdGVyYXRvckVycm9yKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA0MTtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHRocm93IF9pdGVyYXRvckVycm9yO1xuXG4gICAgICAgICAgY2FzZSA0MTpcbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dC5maW5pc2goMzgpO1xuXG4gICAgICAgICAgY2FzZSA0MjpcbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dC5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gICAgICAgIGNhc2UgMzpcbiAgICAgICAgICBpZiAoKF9zdGVwID0gX2l0ZXJhdG9yLm4oKSkuZG9uZSkge1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDEzO1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgdmFsdWUgPSBfc3RlcC52YWx1ZTtcblxuICAgICAgICAgIGlmICghKGN1cnJlbnREZXB0aCA8IGRlcHRoICYmIHNob3VsZEZsYXQodmFsdWUpKSkge1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDk7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgICB9XG5cbiAgICAgICAgICByZXR1cm4gX2NvbnRleHQuZGVsZWdhdGVZaWVsZChmbGF0SW50ZXJuYWwoc2hvdWxkRmxhdCwgZGVwdGgsIGN1cnJlbnREZXB0aCArIDEsIHZhbHVlKSwgXCJ0MFwiLCA3KTtcblxuICAgICAgICBjYXNlIDc6XG4gICAgICAgICAgX2NvbnRleHQubmV4dCA9IDExO1xuICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgIGNhc2UgOTpcbiAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTE7XG4gICAgICAgICAgcmV0dXJuIHZhbHVlO1xuXG4gICAgICAgIGNhc2UgMTE6XG4gICAgICAgICAgX2NvbnRleHQubmV4dCA9IDM7XG4gICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgY2FzZSAxMzpcbiAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTg7XG4gICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgY2FzZSAxNTpcbiAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMTU7XG4gICAgICAgICAgX2NvbnRleHQudDEgPSBfY29udGV4dFtcImNhdGNoXCJdKDEpO1xuXG4gICAgICAgICAgX2l0ZXJhdG9yLmUoX2NvbnRleHQudDEpO1xuXG4gICAgICAgIGNhc2UgMTg6XG4gICAgICAgICAgX2Nvb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gICAgICAgICAgIGlmIChfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxOTtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHZhbHVlID0gX3ZhbHVlO1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDE2O1xuICAgICAgICAgICAgcmV0dXJuIGNhbGxiYWNrKHZhbHVlLCBjKyspO1xuXG4gICAgICAgICAgY2FzZSAxNjpcbiAgICAgICAgICAgIF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gPSB0cnVlO1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDU7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgIGNhc2UgMTk6XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMjU7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgIGNhc2UgMjE6XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMjE7XG4gICAgICAgICAgICBfY29udGV4dC50MCA9IF9jb250ZXh0W1wiY2F0Y2hcIl0oMyk7XG4gICAgICAgICAgICBfZGlkSXRlcmF0b3JFcnJvciA9IHRydWU7XG4gICAgICAgICAgICBfaXRlcmF0b3JFcnJvciA9IF9jb250ZXh0LnQwO1xuXG4gICAgICAgICAgY2FzZSAyNTpcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAyNTtcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAyNjtcblxuICAgICAgICAgICAgaWYgKCEoIV9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gJiYgX2l0ZXJhdG9yW1wicmV0dXJuXCJdICE9IG51bGwpKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAzMDtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIF9jb250Z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ICAgICAgICBpLFxuICAgICAgICAgICAgX2FyZ3MyID0gYXJndW1lbnRzO1xuICAgICAgICByZXR1cm4gX3JlZ2VuZXJhdG9yUnVudGltZS53cmFwKGZ1bmN0aW9uIF9jYWxsZWUyJChfY29udGV4dDIpIHtcbiAgICAgICAgICB3aGlsZSAoMSkge1xuICAgICAgICAgICAgc3dpdGNoIChfY29udGV4dDIucHJldiA9IF9jb250ZXh0Mi5uZXh0KSB7XG4gICAgICAgICAgICAgIGNhc2UgMDpcbiAgICAgICAgICAgICAgICBuID0gX2FyZ3MyLmxlbmd0aCA+IDAgJiYgX2FyZ3MyWzBdICE9PSB1bmRlZmluZWQgPyBfYXJnczJbMF0gOiAxO1xuICAgICAgICAgICAgICAgIGkgPSAwO1xuXG4gICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICBpZiAoIShpIDwgbikpIHtcbiAgICAgICAgICAgICAgICAgIF9jb250ZXh0Mi5uZXh0ID0gOTtcbiAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIF9jb250ZXh0Mi5uZXh0ID0gNTtcbiAgICAgICAgICAgICAgICByZXR1cm4gX2dldChfZ2V0UHJvdG90eXBlT2YoQXN5bmNGb3JrZXJhdG9yLnByb3RvdHlwZSksIFwiYWR2YW5jZVwiLCB0aGlzKS5jYWxsKHRoaXMpO1xuXG4gICAgICAgICAgICAgIGNhc2UgNTpcbiAgICAgICAgICAgICAgICB0aGlzW19dLmV4Y2hhbmdlLmFkdmFuY2UoKTtcblxuICAgICAgICAgICAgICBjYXNlIDY6XG4gICAgICAgICAgICAgICAgaSsrO1xuICAgICAgICAgICAgICAgIF9jb250ZXh0Mi5uZXh0ID0gMjtcbiAgICAgICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgICAgICBjYXNlIDk6XG4gICAgICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0Mi5hYnJ1cHQoXCJyZXR1cm5cI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gIHNlcXNBcnIgPSBfY29udGV4dC5zZW50O1xuXG4gICAgICAgICAgICBpZiAoc2Vxc0Fyci5sZW5ndGgpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDY7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuYWJydXB0KFwicmV0dXJuXCIsIGZhbHNlKTtcblxuICAgICAgICAgIGNhc2UgNjpcbiAgICAgICAgICAgIGlmICghc2Vxc0Fyci5maW5kKGZ1bmN0aW9uIChzZXEpIHtcbiAgICAgICAgICAgICAgcmV0dXJuICFzZXEubGVuZ3RoO1xuICAgICAgICAgICAgfSkpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDg7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuYWJydXB0KFwicmV0dXJuXCIsIHRydWUpO1xuXG4gICAgICAgICAgY2FzZSA4OlxuICAgICAgICAgICAgbWF4TWF0Y2hMZW5ndGggPSBzZXFzQXJyLnJlZHVjZShmdW5jdGlvbiAobWF4LCBfcmVmKSB7XG4gICAgICAgICAgICAgIHZhciBsZW5ndGggPSBfcmVmLmxlbmd0aDtcbiAgICAgICAgICAgICAgcmV0dXJuIE1hdGgubWF4KG1heCwgbGVuZ3RoKTtcbiAgICAgICAgICAgIH0sIDEpO1xuICAgICAgICAgICAgX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiA9IHRydWU7XG4gICAgICAgICAgICBfZGlkSXRlcmF0b3JFcnJvciA9IGZhbHNlO1xuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDExO1xuICAgICAgICAgICAgX2l0ZXJhdG9yID0gX2FzeW5jSXRlcmF0b3IoX19hc3luY1dpbmRvd0FoZWFkKGl0ZXJhYmxlLCBtYXhNYXRjaExlbmd0aCkpO1xuXG4gICAgICAgICAgY2FzZSAxMzpcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxNTtcbiAgICAgICAgICAgIHJldHVybiBfaXRlcmF0b3IubmV4dCgpO1xuXG4gICAgICAgICAgY2FzZSAxNTpcbiAgICAgICAgICAgIF9zdGVwID0gX2NvbnRleHQuc2VudDtcbiAgICAgICAgICAgIF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gPSBfc3RlcC5kb25lO1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDE5O1xuICAgICAgICAgICAgcmV0dXJuIF9zdGVwLnZhbHVlO1xuXG4gICAgICAgICAgY2FzZSAxOTpcbiAgICAgICAgICAgIF92YWx1ZSA9IF9jb250ZXh0LnNlbnQ7XG5cbiAgICAgICAgICAgIGlmIChfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyNztcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGJ1ZmZlciA9IF92YWx1ZTtcblxuICAgICAgICAgICAgaWYgKCFfX3N0YXJ0c1dpdGhBbnlTZXEoYnVmZmVyLCBzZXFzQXJyLCBzYW1lKSkge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMjQ7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuYWJydXB0KFwicmV0dXJuXCIsIHRydWUpO1xuXG4gICAgICAgICAgY2FzZSAyNDpcbiAgICAgICAgICAgIF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gPSB0cnVlO1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDEzO1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICBjYXNlIDI3OlxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDMzO1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICBjYXNlIDI5OlxuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDI5O1xuICAgICAgICAgICAgX2NvbnRleHQudDAgPSBfY29udGV4dFtcImNhdGNoXCJdKDExKTtcbiAgICAgICAgICAgIF9kaWRJdGVyYXRvckVycm9yID0gdHJ1ZTtcbiAgICAgICAgICAgIF9pdGVyYXRvckVycm9yID0gX2NvbnRleHQudDA7XG5cbiAgICAgICAgICBjYXNlIDMzOlxuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDMzO1xuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDM0O1xuXG4gICAgICAgICAgICBpZiAoISghX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiAmJiBfaXRlcmF0b3JbXCJyZXR1cm5cIl0gIT0gbnVsbCkpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDM4O1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDM4O1xuICAgICAgICAgICAgcmV0dXJuIF9pdGVyYXRvcltcInJldHVyblwiXSgpO1xuXG4gICAgICAgICAgY2FzZSAzODpcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAzODtcblxuICAgICAgICAgICAgaWYgKCFfZGlkSXRlcmF0b3JFcnJvcikge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gNDE7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB0aHJvdyBfaXRlcmF0b3JFcnJvcjtcblxuICAgICAgICAgIGNhc2UgNDE6XG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuZmluaXNoKDM4KTtcblxuICAgICAgICAgIGNhc2UgNDI6XG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuZmluaXNoKDMzKTtcblxuICAgICAgICAgIGNhc2UgNDM6XG4gICAgICAgICAgICByZX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ERvbmVCdWZmZXIgPSB0aGlzLmJ1ZmZlcnMuZmluZChmdW5jdGlvbiAoYnVmZmVyKSB7XG4gICAgICAgIHJldHVybiAhYnVmZmVyLmRvbmU7XG4gICAgICB9KTtcbiAgICB9XG4gIH0sIHtcbiAgICBrZXk6IFwiYWR2YW5jZUJ1ZmZlclwiLFxuICAgIHZhbHVlOiBmdW5jdGlvbiAoKSB7XG4gICAgICB2YXIgX2FkdmFuY2VCdWZmZXIgPSBfYXN5bmNUb0dlbmVyYXRvciggLyojX19QVVJFX18qL19yZWdlbmVyYXRvclJ1bnRpbWUubWFyayhmdW5jdGlvbiBfY2FsbGVlMyhidWZmZXIpIHtcbiAgICAgICAgdmFyIHdhc0RvbmU7XG4gICAgICAgIHJldHVybiBfcmVnZW5lcmF0b3JSdW50aW1lLndyYXAoZnVuY3Rpb24gX2NhbGxlZTMkKF9jb250ZXh0Mykge1xuICAgICAgICAgIHdoaWxlICgxKSB7XG4gICAgICAgICAgICBzd2l0Y2ggKF9jb250ZXh0My5wcmV2ID0gX2NvbnRleHQzLm5leHQpIHtcbiAgICAgICAgICAgICAgY2FzZSAwOlxuICAgICAgICAgICAgICAgIHdhc0RvbmUgPSBidWZmZXIuZG9uZTtcbiAgICAgICAgICAgICAgICBfY29udGV4dDMubmV4dCA9IDM7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGJ1ZmZlcltfX2FkdmFuY2VdKCk7XG5cbiAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgIHRoaXMuaW5kZXgrKztcblxuICAgICAgICAgICAgICAgIGlmICghd2FzRG9uZSAmJiBidWZmZXIuZG9uZSkge1xuICAgICAgICAgICAgICAgICAgdGhpcy51cGRhdGVOb3REb25lKCk7XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgIGNhc2UgNTpcbiAgICAgICAgICAgICAgY2FzZSBcImVuZFwiOlxuICAgICAgICAgICAgICAgIHJldHVybiBfY29udGV4dDMuc3RvcCgp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ICAgICAgICAgICAgIH0pKTtcblxuICAgICAgICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgICAgICAgdGhpcy5idWZmZXJzID0gX2NvbnRleHQ0LnNlbnQ7XG4gICAgICAgICAgICAgICAgdGhpcy5pdGVyYXRvciA9IHN0cmF0ZWd5LmFwcGx5KHZvaWQgMCwgW29wdGlvbnMsIG5ldyBBc3luY0lucHV0U3VtbWFyeShpbnB1dFN1bW1hcnkpXS5jb25jYXQoX3RvQ29uc3VtYWJsZUFycmF5KHRoaXMuYnVmZmVycykpKTtcbiAgICAgICAgICAgICAgICBfY29udGV4dDQubmV4dCA9IDg7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGlucHV0U3VtbWFyeS5pbml0KHRoaXMuYnVmZmVycyk7XG5cbiAgICAgICAgICAgICAgY2FzZSA4OlxuICAgICAgICAgICAgICBjYXNlIFwiZW5kXCI6XG4gICAgICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0NC5zdG9wKCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuICAgICAgICB9LCBfY2FsbGVlNCwgdGhpcyk7XG4gICAgICB9KSk7XG5cbiAgICAgIGZ1bmN0aW9uIGluaXQoKSB7XG4gICAgICAgIHJldHVybiBfaW5pdC5hcHBseSh0aGlzLCBhcmd1bWVudHMpO1xuICAgICAgfVxuXG4gICAgICByZXR1cm4gaW5pdDtcbiAgICB9KClcbiAgfSwge1xuICAgIGtleTogXCJyZXR1cm5CdWZmZXJzXCIsXG4gICAgdmFsdWU6IGZ1bmN0aW9uICgpIHtcbiAgICAgIHZhciBfcmV0dXJuQnVmZmVycyA9IF9hc3luY1RvR2VuZXJhdG9yKCAvKiNfX1BVUkVfXyovX3JlZ2VuZXJhdG9yUnVudGltZS5tYXJrKGZ1bmN0aW9uIF9jYWxsZWU1KCkge1xuICAgICAgICByZXR1cm4gX3JlZ2VuZXJhdG9yUnVudGltZS53cmFwKGZ1bmN0aW9uIF9jYWxsZWU1JChfY29udGV4dDUpIHtcbiAgICAgICAgICB3aGlsZSAoMSkge1xuICAgICAgICAgICAgc3dpdGNoIChfY29udGV4dDUucHJldiA9IF9jb250ZXh0NS5uZXh0KSB7XG4gICAgICAgICAgICAgIGNhc2UgMDpcbiAgICAgICAgICAgICAgICBfY29udGV4dDUubmV4dCA9IDI7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGFzeW5jUGFyYWxsZWxFYWNoKHRoaXMuYnVmZmVycywgZnVuY3Rpb24gKGJ1ZmZlcikge1xuICAgICAgICAgICAgICAgICAgcmV0dXJuIGJ1ZmZlcltcInJldHVyblwiXSgpO1xuICAgICAgICAgICAgICAgIH0pO1xuXG4gICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgY2FzZSBcImVuZFwiOlxuICAgICAgICAgICAgICAgIHJldHVybiBfY29udGV4dDUuc3RvcCgpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cbiAgICAgICAgfSwgX2NhbGxlZTUsIHRoaXMpO1xuICAgICAgfSkpO1xuXG4gICAgICBmdW5jdGlvbiByZXR1cm5CdWZmZXJzKCkge1xuICAgICAgICByZXR1cm4gX3JldHVybkJ1ZmZlcnMuYXBwbHkodGhpcywgYXJndW1lbnRzKTtcbiAgICAgIH1cblxuICAgICAgcmV0dXJuIHJldHVybkJ1ZmZlcnM7XG4gICAgfSgpXG4gIH0sIHtcbiAgICBrZXk6IFwibmV4dFwiLFxuICAgIHZhbHVlOiBmdW5jdGlvbiAoKSB7XG4gICAgICB2YXIgX25leHQgPSBfYXN5bmNUb0dlbmVyYXRvciggLyojX19QVVJFX18qL19yZWdlbmVyYXRvclJ1bnRpbWUubWFyayhmdW5jdGlvbiBfY2FsbGVlNigpIHtcbiAgICAgICAgdmFyIHN0ZXA7XG4gICAgICAgIHJldHVybiBfcmVnZW5lcmF0b3JSdW50aW1lLndyYXAoZnVuY3Rpb24gX2NhbGxlZTYkKF9jb250ZXh0Nikge1xuICAgICAgICAgIHdoaWxlICgxKSB7XG4gICAgICAgICAgICBzd2l0Y2ggKF9jb250ZXh0Ni5wcmV2ID0gX2NvbnRleHQ2Lm5leHQpIHtcbiAgICAgICAgICAgICAgY2FzZSAwOlxuICAgICAgICAgICAgICAgIGlmICh0aGlzLmluaXRpYWxpemVkKSB7XG4gICAgICAgICAgICAgICAgICBfY29udGV4dDYubmV4dCA9IDM7XG4gICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBfY29udGV4dDYubmV4dCA9IDM7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuaW5pdCgpO1xuXG4gICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICBfY29udGV4dDYubmV4dCA9IDU7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuaXRlcmF0b3IubmV4dCgpO1xuXG4gICAgICAgICAgICAgIGNhc2UgNTpcbiAgICAgICAgICAgICAgICBzdGVwID0gX2NvbnRleHQ2LnNlbnQ7XG5cbiAgICAgICAgICAgICAgICBpZiAoIXN0ZXAuZG9uZSkge1xuICAgICAgICAgICAgICAgICAgX2NvbnRleHQ2Lm5leHQgPSA5O1xuICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgX2NvbnRleHQ2Lm5leHQgPSA5O1xuICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnJldHVybkJ1ZmZlcnMoKTtcblxuICAgICAgICAgICAgICBjYXNlIDk6XG4gICAgICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0Ni5hYnJ1cHQoXCJyZXR1cm5cIiwgc3RlcCk7XG5cbiAgICAgICAgICAgICAgY2FzZSAxMDpcbiAgICAgICAgICAgICAgY2FzZSBcImVuZFwiOlxuICAgICAgICAgICAgICAgIHJldHVybiBfY29udGV4dDYuc3RvcCgpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cbiAgICAgICAgfSwgX2NhbGxlZTYsIHRoaXMpO1xuICAgICAgfSkpO1xuXG4gICAgICBmdW5jdGlvbiBuZXh0KCkge1xuICAgICAgICByZXR1cm4gX25leHQuYXBwbHkodGhpcywgYXJndW1lbnRzKTtcbiAgICAgIH1cblxuICAgICAgcmV0dXJuIG5leHQ7XG4gICAgfSgpXG4gIH0sIHtcbiAgICBrZXk6IFwicmV0dXJuXCIsXG4gICAgdmFsdWU6IGZ1bmN0aW9uICgpIHtcbiAgICAgIHZhciBfcmV0dXJuMiA9IF9hc3luY1RvR2VuZXJhdG9yKCAvKiNfX1BVUkVfXyovX3JlZ2VuZXJhdG9yUnVudGltZS5tYXJrKGZ1bmN0aW9uIF9jYWxsZWU3KCkge1xuICAgICAgICByZXR1cm4gX3JlZ2VuZXJhdG9yUnVudGltZS53cmFwKGZ1bmN0aW9uIF9jYWxsZWU3JChfY29udGV4dDcpIHtcbiAgICAgICAgICB3aGlsZSAoMSkge1xuICAgICAgICAgICAgc3dpdGNoIChfY29udGV4dDcucHJldiA9IF9jb250ZXh0Ny5uZXh0KSB7XG4gICAgICAgICAgICAgIGNhc2UgMDpcbiAgICAgICAgICAgICAgICBfY29udGV4dDcubmV4dCA9IDI7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGFzeW5jQ2FsbFJldHVybih0aGlzLml0ZXJhdG9yKTtcblxuICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgX2NvbnRleHQ3Lm5leHQgPSA0O1xuICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnJldHVybkJ1ZmZlcnMoKTtcblxuICAgICAgICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0Ny5hYnJ1cHQoXCJyZXR1cm5cIiwge1xuICAgICAgICAgICAgICAgICAgdmFsdWU6IHVuZGVmaW5lZCxcbiAgICAgICAgICAgICAgICAgIGRvbmU6IHRydWVcbiAgICAgICAgICAgICAgICB9KTtcblxuIC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AgIF9jb250ZXh0LnByZXYgPSA2O1xuICAgICAgICAgICAgX2l0ZXJhdG9yID0gX2FzeW5jSXRlcmF0b3Ioc291cmNlKTtcblxuICAgICAgICAgIGNhc2UgODpcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxMDtcbiAgICAgICAgICAgIHJldHVybiBfYXdhaXRBc3luY0dlbmVyYXRvcihfaXRlcmF0b3IubmV4dCgpKTtcblxuICAgICAgICAgIGNhc2UgMTA6XG4gICAgICAgICAgICBfc3RlcCA9IF9jb250ZXh0LnNlbnQ7XG4gICAgICAgICAgICBfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uID0gX3N0ZXAuZG9uZTtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxNDtcbiAgICAgICAgICAgIHJldHVybiBfYXdhaXRBc3luY0dlbmVyYXRvcihfc3RlcC52YWx1ZSk7XG5cbiAgICAgICAgICBjYXNlIDE0OlxuICAgICAgICAgICAgX3ZhbHVlID0gX2NvbnRleHQuc2VudDtcblxuICAgICAgICAgICAgaWYgKF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24pIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDI1O1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgc291cmNlVmFsdWUgPSBfdmFsdWU7XG5cbiAgICAgICAgICAgIGlmIChmaXJzdCkge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTk7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuZGVsZWdhdGVZaWVsZChfYXN5bmNHZW5lcmF0b3JEZWxlZ2F0ZShfYXN5bmNJdGVyYXRvcihzdWJzZXFfKSwgX2F3YWl0QXN5bmNHZW5lcmF0b3IpLCBcInQwXCIsIDE5KTtcblxuICAgICAgICAgIGNhc2UgMTk6XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMjE7XG4gICAgICAgICAgICByZXR1cm4gc291cmNlVmFsdWU7XG5cbiAgICAgICAgICBjYXNlIDIxOlxuICAgICAgICAgICAgZmlyc3QgPSBmYWxzZTtcblxuICAgICAgICAgIGNhc2UgMjI6XG4gICAgICAgICAgICBfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uID0gdHJ1ZTtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA4O1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICBjYXNlIDI1OlxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDMxO1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICBjYXNlIDI3OlxuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDI3O1xuICAgICAgICAgICAgX2NvbnRleHQudDEgPSBfY29udGV4dFtcImNhdGNoXCJdKDYpO1xuICAgICAgICAgICAgX2RpZEl0ZXJhdG9yRXJyb3IgPSB0cnVlO1xuICAgICAgICAgICAgX2l0ZXJhdG9yRXJyb3IgPSBfY29udGV4dC50MTtcblxuICAgICAgICAgIGNhc2UgMzE6XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMzE7XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMzI7XG5cbiAgICAgICAgICAgIGlmICghKCFfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uICYmIF9pdGVyYXRvcltcInJldHVyblwiXSAhPSBudWxsKSkge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMzY7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMzY7XG4gICAgICAgICAgICByZXR1cm4gX2F3YWl0QXN5bmNHZW5lcmF0b3IoX2l0ZXJhdG9yW1wicmV0dXJuXCJdKCkpO1xuXG4gICAgICAgICAgY2FzZSAzNjpcbiAgICAgICA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idDBcIiwgOSk7XG5cbiAgICAgICAgY2FzZSA5OlxuICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxMTtcbiAgICAgICAgICByZXR1cm4gc291cmNlVmFsdWU7XG5cbiAgICAgICAgY2FzZSAxMTpcbiAgICAgICAgICBmaXJzdCA9IGZhbHNlO1xuXG4gICAgICAgIGNhc2UgMTI6XG4gICAgICAgICAgX2NvbnRleHQubmV4dCA9IDU7XG4gICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgY2FzZSAxNDpcbiAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTk7XG4gICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgY2FzZSAxNjpcbiAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMTY7XG4gICAgICAgICAgX2NvbnRleHQudDEgPSBfY29udGV4dFtcImNhdGNoXCJdKDMpO1xuXG4gICAgICAgICAgX2l0ZXJhdG9yLmUoX2NvbnRleHQudDEpO1xuXG4gICAgICAgIGNhc2UgMTk6XG4gICAgICAgICAgX2NvbnRleHQucHJldiA9IDE5O1xuXG4gICAgICAgICAgX2l0ZXJhdG9yLmYoKTtcblxuICAgICAgICAgIHJldHVybiBfY29udGV4dC5maW5pc2goMTkpO1xuXG4gICAgICAgIGNhc2UgMjI6XG4gICAgICAgIGNhc2UgXCJlbmRcIjpcbiAgICAgICAgICByZXR1cm4gX2NvbnRleHQuc3RvcCgpO1xuICAgICAgfVxuICAgIH1cbiAgfSwgX21hcmtlZCwgbnVsbCwgW1szLCAxNiwgMTksIDIyXV0pO1xufVxuXG5leHBvcnRzLl9faW50ZXJwb3NlU2VxID0gX19pbnRlcnBvc2VTZXE7XG52YXIgaW50ZXJwb3NlU2VxID0gLyojX19QVVJFX18qL2l0ZXJhYmxlQ3VycnkoX19pbnRlcnBvc2VTZXEpO1xuZXhwb3J0cy5pbnRlcnBvc2VTZXEgPSBpbnRlcnBvc2VTZXE7IiwidmFyIF9yZXF1aXJlID0gcmVxdWlyZSgnLi4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250ZXh0Lm5leHQgPSAzO1xuICAgICAgICAgICAgcmV0dXJuIF9fYXN5bmNQZWVrZXJhdGUoaXRlcmFibGUpO1xuXG4gICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgcGVla3IgPSBfY29udGV4dC5zZW50O1xuXG4gICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgaWYgKHBlZWtyLmRvbmUpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDE0O1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdmFsdWUgPSBwZWVrci52YWx1ZTtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA4O1xuICAgICAgICAgICAgcmV0dXJuIHBlZWtyLmFkdmFuY2UoKTtcblxuICAgICAgICAgIGNhc2UgODpcbiAgICAgICAgICAgIGlmICghKCFwZWVrci5kb25lICYmIGNvbXBhcmUodmFsdWUsIHBlZWtyLnZhbHVlKSA+IDApKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxMjtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxMTtcbiAgICAgICAgICAgIHJldHVybiBwZWVrcltcInJldHVyblwiXSgpO1xuXG4gICAgICAgICAgY2FzZSAxMTpcbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dC5hYnJ1cHQoXCJyZXR1cm5cIiwgZmFsc2UpO1xuXG4gICAgICAgICAgY2FzZSAxMjpcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA0O1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICBjYXNlIDE0OlxuICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0LmFicnVwdChcInJldHVyblwiLCB0cnVlKTtcblxuICAgICAgICAgIGNhc2UgMTU6XG4gICAgICAgICAgY2FzZSBcImVuZFwiOlxuICAgICA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X2NvbnRleHQubmV4dCkge1xuICAgICAgICAgIGNhc2UgMDpcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyO1xuICAgICAgICAgICAgcmV0dXJuIF9hd2FpdEFzeW5jR2VuZXJhdG9yKF9fYXN5bmNUb0FycmF5KHNlcGFyYXRvclNlcSkpO1xuXG4gICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgX3NlcGFyYXRvclNlcSA9IF9jb250ZXh0LnNlbnQ7XG4gICAgICAgICAgICBpc0ZpcnN0ID0gdHJ1ZTtcbiAgICAgICAgICAgIF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gPSB0cnVlO1xuICAgICAgICAgICAgX2RpZEl0ZXJhdG9yRXJyb3IgPSBmYWxzZTtcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSA2O1xuICAgICAgICAgICAgX2l0ZXJhdG9yID0gX2FzeW5jSXRlcmF0b3Ioc291cmNlKTtcblxuICAgICAgICAgIGNhc2UgODpcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxMDtcbiAgICAgICAgICAgIHJldHVybiBfYXdhaXRBc3luY0dlbmVyYXRvcihfaXRlcmF0b3IubmV4dCgpKTtcblxuICAgICAgICAgIGNhc2UgMTA6XG4gICAgICAgICAgICBfc3RlcCA9IF9jb250ZXh0LnNlbnQ7XG4gICAgICAgICAgICBfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uID0gX3N0ZXAuZG9uZTtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxNDtcbiAgICAgICAgICAgIHJldHVybiBfYXdhaXRBc3luY0dlbmVyYXRvcihfc3RlcC52YWx1ZSk7XG5cbiAgICAgICAgICBjYXNlIDE0OlxuICAgICAgICAgICAgX3ZhbHVlID0gX2NvbnRleHQuc2VudDtcblxuICAgICAgICAgICAgaWYgKF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24pIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDI0O1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdmFsdWUgPSBfdmFsdWU7XG5cbiAgICAgICAgICAgIGlmIChpc0ZpcnN0KSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxOTtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dC5kZWxlZ2F0ZVlpZWxkKF9hc3luY0dlbmVyYXRvckRlbGVnYXRlKF9hc3luY0l0ZXJhdG9yKF9zZXBhcmF0b3JTZXEpLCBfYXdhaXRBc3luY0dlbmVyYXRvciksIFwidDBcIiwgMTkpO1xuXG4gICAgICAgICAgY2FzZSAxOTpcbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dC5kZWxlZ2F0ZVlpZWxkKF9hc3luY0dlbmVyYXRvckRlbGVnYXRlKF9hc3luY0l0ZXJhdG9yKHZhbHVlKSwgX2F3YWl0QXN5bmNHZW5lcmF0b3IpLCBcInQxXCIsIDIwKTtcblxuICAgICAgICAgIGNhc2UgMjA6XG4gICAgICAgICAgICBpc0ZpcnN0ID0gZmFsc2U7XG5cbiAgICAgICAgICBjYXNlIDIxOlxuICAgICAgICAgICAgX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiA9IHRydWU7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gODtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSAyNDpcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAzMDtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSAyNjpcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAyNjtcbiAgICAgICAgICAgIF9jb250ZXh0LnQyID0gX2NvbnRleHRbXCJjYXRjaFwiXSg2KTtcbiAgICAgICAgICAgIF9kaWRJdGVyYXRvckVycm9yID0gdHJ1ZTtcbiAgICAgICAgICAgIF9pdGVyYXRvckVycm9yID0gX2NvbnRleHQudDI7XG5cbiAgICAgICAgICBjYXNlIDMwOlxuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDMwO1xuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDMxO1xuXG4gICAgICAgICAgICBpZiAoISghX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiAmJiBfaXRlcmF0b3JbXCJyZXR1cm5cIl0gIT0gbnVsbCkpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDM1O1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDM1O1xuICAgICAgICAgICAgcmV0dXJuIF9hd2FpdEFzeW5jR2VuZXJhdG9yKF9pdGVyYXRvcltcInJldHVyblwiXSgpKTtcblxuICAgICAgICAgIGNhc2UgMzU6XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMzU7XG5cbiAgICAgICAgICAgIGlmICghX2RpZEl0ZXJhdG9yRXJyb3IpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDM4O1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdGhyb3cgX2l0ZXJhdG9yRXJyb3I7XG5cbiAgICAgICAgICBjYXNlIDM4OlxuICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0LmZpbmlzaCgzNSk7XG5cbiAgICAgICAgICBjYXNlIDM5OlxuICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0LmZpbmlzaCgzMCk7XG5cbiAgICAgICAgICBjYXNlIDQwOlxuICAgICAgICAgIGNhc2UgXCJlbmRcIjpcbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dC5zdG9wKCk7XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICB9LCBfY2FsbGVlLCBudWxsLCBbWzYsIDI2LCAz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AgIGNhc2UgMDpcbiAgICAgICAgICBfc2VwYXJhdG9yU2VxID0gX190b0FycmF5KHNlcGFyYXRvclNlcSk7XG4gICAgICAgICAgaXNGaXJzdCA9IHRydWU7XG4gICAgICAgICAgX2l0ZXJhdG9yID0gX2NyZWF0ZUZvck9mSXRlcmF0b3JIZWxwZXIoc291cmNlKTtcbiAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMztcblxuICAgICAgICAgIF9pdGVyYXRvci5zKCk7XG5cbiAgICAgICAgY2FzZSA1OlxuICAgICAgICAgIGlmICgoX3N0ZXAgPSBfaXRlcmF0b3IubigpKS5kb25lKSB7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTM7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgICB9XG5cbiAgICAgICAgICB2YWx1ZSA9IF9zdGVwLnZhbHVlO1xuXG4gICAgICAgICAgaWYgKGlzRmlyc3QpIHtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA5O1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgcmV0dXJuIF9jb250ZXh0LmRlbGVnYXRlWWllbGQoX3NlcGFyYXRvclNlcSwgXCJ0MFwiLCA5KTtcblxuICAgICAgICBjYXNlIDk6XG4gICAgICAgICAgcmV0dXJuIF9jb250ZXh0LmRlbGVnYXRlWWllbGQodmFsdWUsIFwidDFcIiwgMTApO1xuXG4gICAgICAgIGNhc2UgMTA6XG4gICAgICAgICAgaXNGaXJzdCA9IGZhbHNlO1xuXG4gICAgICAgIGNhc2UgMTE6XG4gICAgICAgICAgX2NvbnRleHQubmV4dCA9IDU7XG4gICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgY2FzZSAxMzpcbiAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTg7XG4gICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgY2FzZSAxNTpcbiAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMTU7XG4gICA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AgX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiA9IF9zdGVwLmRvbmU7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTE7XG4gICAgICAgICAgICByZXR1cm4gX2F3YWl0QXN5bmNHZW5lcmF0b3IoX3N0ZXAudmFsdWUpO1xuXG4gICAgICAgICAgY2FzZSAxMTpcbiAgICAgICAgICAgIF92YWx1ZSA9IF9jb250ZXh0LnNlbnQ7XG5cbiAgICAgICAgICAgIGlmIChfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxOTtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHZhbHVlID0gX3ZhbHVlO1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDE2O1xuICAgICAgICAgICAgcmV0dXJuIGZ1bmModmFsdWUsIGMrKyk7XG5cbiAgICAgICAgICBjYXNlIDE2OlxuICAgICAgICAgICAgX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiA9IHRydWU7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gNTtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSAxOTpcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyNTtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSAyMTpcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAyMTtcbiAgICAgICAgICAgIF9jb250ZXh0LnQwID0gX2NvbnRleHRbXCJjYXRjaFwiXSgzKTtcbiAgICAgICAgICAgIF9kaWRJdGVyYXRvckVycm9yID0gdHJ1ZTtcbiAgICAgICAgICAgIF9pdGVyYXRvckVycm9yID0gX2NvbnRleHQudDA7XG5cbiAgICAgICAgICBjYXNlIDI1OlxuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDI1O1xuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDI2O1xuXG4gICAgICAgICAgICBpZiAoISghX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiAmJiBfaXRlcmF0b3JbXCJyZXR1cm5cIl0gIT0gbnVsbCkpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDMwO1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDMwO1xuICAgICAgICAgICAgcmV0dXJuIF9hd2FpdEFzeW5jR2VuZXJhdG9yKF9pdGVyYXRvcltcInJldHVyblwiXSgpKTtcblxuICAgICAgICAgIGNhc2UgMzA6XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMzA7XG5cbiAgICAgICAgICAgIGlmICghX2RpZEl0ZXJhdG9yRXJyb3IpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDMzO1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdGhyb3cgX2l0ZXJhdG9yRXJyb3I7XG5cbiAgICAgICAgICBjYXNlIDMzOlxuICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0LmZpbmlzaCgzMCk7XG5cbiAgICAgICAgICBjYXNlIDM0OlxuICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0LmZpbmlzaCgyNSk7XG5cbiAgICAgICAgICBjYXNlIDM1OlxuICAgICAgICAgIGNhc2UgXCJlbmRcIjpcbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dC5zdG9wKCk7XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICB9LCBfY2FsbGVlLCBudWxsLCBbWzMsIDIxLCAyNSwgMzVdLCBbMjYsLCAzMCwgMzRdXSk7XG4gIH0pKTtcbiAgcmV0dXJuIF9hc3luY01hcC5hcHBseSh0aGlzLCBhcmd1bWVudHMpO1xufVxuXG52YXIgYXN5bmNNYXAgPSAv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V4dCkge1xuICAgICAgICAgIGNhc2UgMDpcbiAgICAgICAgICAgIGluaXRpYWwgPSBfYXJncy5sZW5ndGggPiAyICYmIF9hcmdzWzJdICE9PSB1bmRlZmluZWQgPyBfYXJnc1syXSA6IHVuZGVmaW5lZDtcbiAgICAgICAgICAgIGMgPSAwO1xuICAgICAgICAgICAgcmVzdWx0ID0gaW5pdGlhbDtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA1O1xuICAgICAgICAgICAgcmV0dXJuIF9fYXN5bmNQZWVrZXJhdGUoaXRlcmFibGUpO1xuXG4gICAgICAgICAgY2FzZSA1OlxuICAgICAgICAgICAgcGVla3IgPSBfY29udGV4dC5zZW50O1xuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDY7XG5cbiAgICAgICAgICAgIGlmICghKGluaXRpYWwgPT09IHVuZGVmaW5lZCkpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDE0O1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgaWYgKCFwZWVrci5kb25lKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxMDtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignQ2Fubm90IHJlZHVjZTogbm8gaW5pdGlhbCB2YWx1ZSBzcGVjaWZpZWQgYW5kIGl0ZXJhYmxlIHdhcyBlbXB0eScpO1xuXG4gICAgICAgICAgY2FzZSAxMDpcbiAgICAgICAgICAgIHJlc3VsdCA9IHBlZWtyLnZhbHVlO1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDEzO1xuICAgICAgICAgICAgcmV0dXJuIHBlZWtyLmFkdmFuY2UoKTtcblxuICAgICAgICAgIGNhc2UgMTM6XG4gICAgICAgICAgICBjID0gMTtcblxuICAgICAgICAgIGNhc2UgMTQ6XG4gICAgICAgICAgICBpZiAocGVla3IuZG9uZSkge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMjI7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTc7XG4gICAgICAgICAgICByZXR1cm4gcmVkdWNlcihyZXN1bHQsIHBlZWtyLnZhbHVlLCBjKyspO1xuXG4gICAgICAgICAgY2FzZSAxNzpcbiAgICAgICAgICAgIHJlc3VsdCA9IF9jb250ZXh0LnNlbnQ7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMjA7XG4gICAgICAgICAgICByZXR1cm4gcGVla3IuYWR2YW5jZSgpO1xuXG4gICAgICAgICAgY2FzZSAyMDpcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxNDtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSAyMjpcbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dC5hYnJ1cHQoXCJyZXR1cm5cIiwgcmVzdWx0KTtcblxuICAgICAgICAgIGNhc2UgMjM6XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMjM7XG4gICAgICAgICAgICBwZWVrcltcInJldHVyblwiXSgpO1xuICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0LmZpbmlzaCgyMyk7XG5cbiAgICAgICAgICBjYXNlIDI2OlxuICAgICAgICAgIGNhc2UgXCJlbmRcIjpcbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dC5zdG9wKCk7XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICB9LCBfY2FsbGVlLCBudWxsLCBbWzYsLCAyMywgMjZdXSk7XG4gIH0pKTtcbiAgcmV0dXJuIF9hc3luY1JlZHVjZS5hcHBseSh0aGlzLCBhcmd1bWVudHMpO1xufVxuXG5leHBvcnRzLl9fYXN5bmNSZWR1Y2UgPSBfX2FzeW5jUmVkdWNlO1xudmFyIGFzeW5jUmVkdWNlID0g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GFydCA9IF9yZWYuc3RhcnQsIHN0ZXAgPSBfcmVmLnN0ZXA7XG5cbiAgICAgICAgICAgIGZvciAoX2xlbiA9IF9hcmdzLmxlbmd0aCwgcGVla3JzID0gbmV3IEFycmF5KF9sZW4gPiAyID8gX2xlbiAtIDIgOiAwKSwgX2tleSA9IDI7IF9rZXkgPCBfbGVuOyBfa2V5KyspIHtcbiAgICAgICAgICAgICAgcGVla3JzW19rZXkgLSAyXSA9IF9hcmdzW19rZXldO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBzdGFydCA9IHN0YXJ0ICUgcGVla3JzLmxlbmd0aDtcbiAgICAgICAgICAgIGkgPSBzdGFydDtcblxuICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgIGlmIChhbGwuZG9uZSkge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTQ7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBwZWVrciA9IHBlZWtyc1tpXTtcblxuICAgICAgICAgICAgaWYgKHBlZWtyLmRvbmUpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDExO1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDk7XG4gICAgICAgICAgICByZXR1cm4gcGVla3IudmFsdWU7XG5cbiAgICAgICAgICBjYXNlIDk6XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTE7XG4gICAgICAgICAgICByZXR1cm4gX2F3YWl0QXN5bmNHZW5lcmF0b3IocGVla3IuYWR2YW5jZSgpKTtcblxuICAgICAgICAgIGNhc2UgMTE6XG4gICAgICAgICAgICBpID0gKGkgKyBzdGVwKSAlIHBlZWtycy5sZW5ndGg7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gNDtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSAxN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gPSBfcmVmLnN0ZXA7XG5cbiAgICAgICAgICBmb3IgKF9sZW4gPSBfYXJncy5sZW5ndGgsIHBlZWtycyA9IG5ldyBBcnJheShfbGVuID4gMiA/IF9sZW4gLSAyIDogMCksIF9rZXkgPSAyOyBfa2V5IDwgX2xlbjsgX2tleSsrKSB7XG4gICAgICAgICAgICBwZWVrcnNbX2tleSAtIDJdID0gX2FyZ3NbX2tleV07XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgc3RhcnQgPSBzdGFydCAlIHBlZWtycy5sZW5ndGg7XG4gICAgICAgICAgaSA9IHN0YXJ0O1xuXG4gICAgICAgIGNhc2UgNDpcbiAgICAgICAgICBpZiAoYWxsLmRvbmUpIHtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxMztcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIHBlZWtyID0gcGVla3JzW2ldO1xuXG4gICAgICAgICAgaWYgKHBlZWtyLmRvbmUpIHtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxMDtcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA5O1xuICAgICAgICAgIHJldHVybiBwZWVrci52YWx1ZTtcblxuICAgICAgICBjYXNlIDk6XG4gICAgICAgICAgcGVla3IuYWR2YW5jZSgpO1xuXG4gICAgICAgIGNhc2UgMTA6XG4gICAgICAgICAgaSA9IChpICsgc3RlcCkgJSBwZWVrcnMubGVuZ3RoO1xuICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA0O1xuICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgIGNhc2UgMTM6XG4gICAgICAgIGNhc2UgXCJlbmRcIjpcbiAgICAgICAgICByZXR1cm4gX2NvbnRleHQuc3RvcCgpO1xuICAgICAgfVxuICAgIH1cbiAgfSwgX21hcmtlZCk7XG59XG5cbmZ1bmN0aW9uIF9fcm91bmRS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CA9IDg7XG4gICAgICAgICAgICByZXR1cm4gX2l0ZXJhdG9yLm5leHQoKTtcblxuICAgICAgICAgIGNhc2UgODpcbiAgICAgICAgICAgIF9zdGVwID0gX2NvbnRleHQuc2VudDtcbiAgICAgICAgICAgIF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gPSBfc3RlcC5kb25lO1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDEyO1xuICAgICAgICAgICAgcmV0dXJuIF9zdGVwLnZhbHVlO1xuXG4gICAgICAgICAgY2FzZSAxMjpcbiAgICAgICAgICAgIF92YWx1ZSA9IF9jb250ZXh0LnNlbnQ7XG5cbiAgICAgICAgICAgIGlmIChfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxOTtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIF8gPSBfdmFsdWU7XG4gICAgICAgICAgICBzaXplKys7XG5cbiAgICAgICAgICBjYXNlIDE2OlxuICAgICAgICAgICAgX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiA9IHRydWU7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gNjtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSAxOTpcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyNTtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSAyMTpcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAyMTtcbiAgICAgICAgICAgIF9jb250ZXh0LnQwID0gX2NvbnRleHRbXCJjYXRjaFwiXSg0KTtcbiAgICAgICAgICAgIF9kaWRJdGVyYXRvckVycm9yID0gdHJ1ZTtcbiAgICAgICAgICAgIF9pdGVyYXRvckVycm9yID0gX2NvbnRleHQudDA7XG5cbiAgICAgICAgICBjYXNlIDI1OlxuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDI1O1xuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDI2O1xuXG4gICAgICAgICAgICBpZiAoISghX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiAmJiBfaXRlcmF0b3JbXCJyZXR1cm5cIl0gIT0gbnVsbCkpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDMwO1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDMwO1xuICAgICAgICAgICAgcmV0dXJuIF9pdGVyYXRvcltcInJldHVyblwiXSgpO1xuXG4gICAgICAgICAgY2FzZSAzMDpcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAzMDtcblxuICAgICAgICAgICAgaWYgKCFfZGlkSXRlcmF0b3JFcnJvcikge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMzM7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB0aHJvdyBfaXRlcmF0b3JFcnJvcjtcblxuICAgICAgICAgIGNhc2UgMzM6XG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuZmluaXNoKDMwKTtcblxuICAgICAgICAgIGNhc2UgMzQ6XG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuZmluaXNoKDI1KTtcblxuICAgICAgICAgIGNhc2UgMzU6XG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuYWJydXB0KFwicmV0dXJuXCIsIHNpemUpO1xuXG4gICAgICAgICAgY2FzZSAzNjpcbiAgICAgICAgICBjYXNlIFwiZW5kXCI6XG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuc3RvcCgpO1xuICAgICAgICB9XG4gICAgICB9XG4gICAgfSwgX2NhbGxlZSwgbnVsbCwgW1s0LCAyMSwgMjUsIDM1XSwgWzI2LCwgMzAsIDM0XV0pO1xuICB9K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zdGVwLnZhbHVlKTtcblxuICAgICAgICAgIGNhc2UgMTg6XG4gICAgICAgICAgICBfdmFsdWUgPSBfY29udGV4dC5zZW50O1xuXG4gICAgICAgICAgICBpZiAoX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbikge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMzY7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB2YWx1ZSA9IF92YWx1ZTtcblxuICAgICAgICAgICAgaWYgKCFidWZmZXIpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDI2O1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdmFsdWUgPSBidWZmZXIucHVzaCh2YWx1ZSk7XG4gICAgICAgICAgICBjb3VudGVyKys7XG5cbiAgICAgICAgICAgIGlmICghKGNvdW50ZXIgPD0gYnVmZmVyU2l6ZSkpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDI2O1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0LmFicnVwdChcImNvbnRpbnVlXCIsIDMzKTtcblxuICAgICAgICAgIGNhc2UgMjY6XG4gICAgICAgICAgICBpZiAoIShjdXJyZW50UG9zID49IGVuZCAmJiBlbmQgPj0gMCkpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDI4O1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0LmFicnVwdChcImJyZWFrXCIsIDM2KTtcblxuICAgICAgICAgIGNhc2UgMjg6XG4gICAgICAgICAgICBpZiAoIShuZXh0VmFsaWRQb3MgPT09IGN1cnJlbnRQb3MpKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAzMjtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAzMTtcbiAgICAgICAgICAgIHJldHVybiB2YWx1ZTtcblxuICAgICAgICAgIGNhc2UgMzE6XG4gICAgICAgICAgICBuZXh0VmFsaWRQb3MgKz0gc3RlcDtcblxuICAgICAgICAgIGNhc2UgMzI6XG4gICAgICAgICAgICBjdXJyZW50UG9zKys7XG5cbiAgICAgICAgICBjYXNlIDMzOlxuICAgICAgICAgICAgX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiA9IHRydWU7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTI7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgIGNhc2UgMzY6XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gNDI7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgIGNhc2UgMzg6XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMzg7XG4gICAgICAgICAgICBfY29udGV4dC50MCA9IF9jb250ZXh0W1wiY2F0Y2hcIl0oMTApO1xuICAgICAgICAgICAgX2RpZEl0ZXJhdG9yRXJyb3IgPSB0cnVlO1xuICAgICAgICAgICAgX2l0ZXJhdG9yRXJyb3IgPSBfY29udGV4dC50MDtcblxuICAgICAgICAgIGNhc2UgNDI6XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gNDI7XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gNDM7XG5cbiAgICAgICAgICAgIGlmICghKCFfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uICYmIF9pdGVyYXRvcltcInJldHVyblwiXSAhPSBudWxsKSkge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gNDc7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gNDc7XG4gICAgICAgICAgICByZ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YWxDb21wbGV0aW9uMiA9IF9zdGVwMi5kb25lO1xuICAgICAgICAgICAgX2NvbnRleHQzLm5leHQgPSAxMztcbiAgICAgICAgICAgIHJldHVybiBfc3RlcDIudmFsdWU7XG5cbiAgICAgICAgICBjYXNlIDEzOlxuICAgICAgICAgICAgX3ZhbHVlMiA9IF9jb250ZXh0My5zZW50O1xuXG4gICAgICAgICAgICBpZiAoX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbjIpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQzLm5leHQgPSAyMTtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHZhbHVlID0gX3ZhbHVlMjtcbiAgICAgICAgICAgIGJ1ZmZlci5wdXNoKHZhbHVlKTtcbiAgICAgICAgICAgIGNvdW50ZXIrKztcblxuICAgICAgICAgIGNhc2UgMTg6XG4gICAgICAgICAgICBfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uMiA9IHRydWU7XG4gICAgICAgICAgICBfY29udGV4dDMubmV4dCA9IDc7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgIGNhc2UgMjE6XG4gICAgICAgICAgICBfY29udGV4dDMubmV4dCA9IDI3O1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICBjYXNlIDIzOlxuICAgICAgICAgICAgX2NvbnRleHQzLnByZXYgPSAyMztcbiAgICAgICAgICAgIF9jb250ZXh0My50MCA9IF9jb250ZXh0M1tcImNhdGNoXCJdKDUpO1xuICAgICAgICAgICAgX2RpZEl0ZXJhdG9yRXJyb3IyID0gdHJ1ZTtcbiAgICAgICAgICAgIF9pdGVyYXRvckVycm9yMiA9IF9jb250ZXh0My50MDtcblxuICAgICAgICAgIGNhc2UgMjc6XG4gICAgICAgICAgICBfY29udGV4dDMucHJldiA9IDI3O1xuICAgICAgICAgICAgX2NvbnRleHQzLnByZXYgPSAyODtcblxuICAgICAgICAgICAgaWYgKCEoIV9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24yICYmIF9pdGVyYXRvcjJbXCJyZXR1cm5cIl0gIT0gbnVsbCkpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQzLm5leHQgPSAzMjtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIF9jb250ZXh0My5uZXh0ID0gMzI7XG4gICAgICAgICAgICByZXR1cm4gX2l0ZXJhdG9yMltcInJldHVyblwiXSgpO1xuXG4gICAgICAgICAgY2FzZSAzMjpcbiAgICAgICAgICAgIF9jb250ZXh0My5wcmV2ID0gMzI7XG5cbiAgICAgICAgICAgIGlmICghX2RpZEl0ZXJhdG9yRXJyb3IyKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0My5uZXh0ID0gMzU7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB0aHJvdyBfaXRlcmF0b3JFcnJvcjI7XG5cbiAgICAgICAgICBjYXNlIDM1OlxuICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0My5maW5pc2goMzIpO1xuXG4gICAgICAgICAgY2FzZSAzNjpcbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dDMuZmluaXNoKDI3KTtcblxuICAgICAgICAgIGNhc2UgMzc6XG4gICAgICAgICAgICBpZiAoIShpc0Zpbml0ZShlbmQpICYmIGVuZCA+IDApKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0My5uZXh0ID0gNDM7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBuZXdFbmQgPSBlbmQgLSAoY291bnRlciAtIGJ1ZmZlci5zaXplKTtcblxuICAgICAgICAgICAgaWYgKCEobmV3RW5kIDwgMCkpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQzLm5leHQgPSA0MTtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAg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hlbHBlcihzb3VyY2UpO1xuICAgICAgICAgIF9jb250ZXh0LnByZXYgPSA5O1xuXG4gICAgICAgICAgX2l0ZXJhdG9yMi5zKCk7XG5cbiAgICAgICAgY2FzZSAxMTpcbiAgICAgICAgICBpZiAoKF9zdGVwMiA9IF9pdGVyYXRvcjIubigpKS5kb25lKSB7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMjc7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgICB9XG5cbiAgICAgICAgICB2YWx1ZSA9IF9zdGVwMi52YWx1ZTtcblxuICAgICAgICAgIGlmICghYnVmZmVyKSB7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTg7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgICB9XG5cbiAgICAgICAgICB2YWx1ZSA9IGJ1ZmZlci5wdXNoKHZhbHVlKTtcbiAgICAgICAgICBjb3VudGVyKys7XG5cbiAgICAgICAgICBpZiAoIShjb3VudGVyIDw9IGJ1ZmZlclNpemUpKSB7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTg7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgICB9XG5cbiAgICAgICAgICByZXR1cm4gX2NvbnRleHQuYWJydXB0KFwiY29udGludWVcIiwgMjUpO1xuXG4gICAgICAgIGNhc2UgMTg6XG4gICAgICAgICAgaWYgKCEoY3VycmVudFBvcyA+PSBlbmQgJiYgZW5kID49IDApKSB7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMjA7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgICB9XG5cbiAgICAgICAgICByZXR1cm4gX2NvbnRleHQuYWJydXB0KFwiYnJlYWtcIiwgMjcpO1xuXG4gICAgICAgIGNhc2UgMjA6XG4gICAgICAgICAgaWYgKCEobmV4dFZhbGlkUG9zID09PSBjdXJyZW50UG9zKSkge1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDI0O1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgX2NvbnRleHQubmV4dCA9IDIzO1xuICAgICAgICAgIHJldHVybiB2YWx1ZTtcblxuICAgICAgICBjYXNlIDIzOlxuICAgICAgICAgIG5leHRWYWxpZFBvcyArPSBzdGVwO1xuXG4gICAgICAgIGNhc2UgMjQ6XG4gICAgICAgICAgY3VycmVudFBvcysrO1xuXG4gICAgICAgIGNhc2UgMjU6XG4gICAgICAgICAgX2NvbnRleHQubmV4dCA9IDExO1xuICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgIGNhc2UgMjc6XG4gICAgICAgICAgX2NvbnRleHQubmV4dCA9IDMyO1xuICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgIGNhc2UgMjk6XG4gICAgICAgICAgX2NvbnRleHQucHJldiA9IDI5O1xuICAgICAgICAgIF9jb250ZXh0LnQwID0gX2NvbnRleHRbXCJjYXRjaFwiXSg5KTtcblxuICAgICAgICAgIF9pdGVyYXRvcjIuZShfY29udGV4dC50MCk7XG5cbiAgICAgICAgY2FzZSAzMjpcbiAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMzI7XG5cbiAgICAgICAgICBfaXRlcmF0b3IyLmYoKTtcblxuICAgICAgICAgIHJldHVybiBfY29udGV4dC5maW5pc2goMzIpO1xuXG4gICAgICAgIGNhc2UgMzU6XG4gICAgICAgIGNhc2UgXCJlbmRcIjpcbiAgICAgICAgICByZXR1cm4gX2NvbnRleHQuc3RvcCgpO1xuICAgICAgfVxuICAgIH1cbiAgfSwgX21hcmtlZCwgbnVsbCwgW1s5LCAyOSwgMzIsIDM1XV0pO1xufVxuXG5leHBvcnRzLl9fc2xpY2VGcm9tU3RhcnQgPSBfX3NsaWNlRnJvbVN0YXJ0O1xuXG5mdW5jdGlvbiBidWZmZXJlZFNsaWNlKHNvdXJjZSwgc3RhcnQsIGVuZCwgc3RlcCkge1xuICB2YXIgYnVmZmVyU2l6ZSA9IE1hdGguYWJzKHN0YXJ0KT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Wx1ZSwgdmFsdWU7XG5cbiAgICByZXR1cm4gX3JlZ2VuZXJhdG9yUnVudGltZS53cmFwKGZ1bmN0aW9uIF9jYWxsZWUkKF9jb250ZXh0KSB7XG4gICAgICB3aGlsZSAoMSkge1xuICAgICAgICBzd2l0Y2ggKF9jb250ZXh0LnByZXYgPSBfY29udGV4dC5uZXh0KSB7XG4gICAgICAgICAgY2FzZSAwOlxuICAgICAgICAgICAgYyA9IDA7XG4gICAgICAgICAgICBfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uID0gdHJ1ZTtcbiAgICAgICAgICAgIF9kaWRJdGVyYXRvckVycm9yID0gZmFsc2U7XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMztcbiAgICAgICAgICAgIF9pdGVyYXRvciA9IF9hc3luY0l0ZXJhdG9yKGl0ZXJhYmxlKTtcblxuICAgICAgICAgIGNhc2UgNTpcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA3O1xuICAgICAgICAgICAgcmV0dXJuIF9pdGVyYXRvci5uZXh0KCk7XG5cbiAgICAgICAgICBjYXNlIDc6XG4gICAgICAgICAgICBfc3RlcCA9IF9jb250ZXh0LnNlbnQ7XG4gICAgICAgICAgICBfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uID0gX3N0ZXAuZG9uZTtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxMTtcbiAgICAgICAgICAgIHJldHVybiBfc3RlcC52YWx1ZTtcblxuICAgICAgICAgIGNhc2UgMTE6XG4gICAgICAgICAgICBfdmFsdWUgPSBfY29udGV4dC5zZW50O1xuXG4gICAgICAgICAgICBpZiAoX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbikge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMjE7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB2YWx1ZSA9IF92YWx1ZTtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxNjtcbiAgICAgICAgICAgIHJldHVybiBmdW5jKHZhbHVlLCBjKyspO1xuXG4gICAgICAgICAgY2FzZSAxNjpcbiAgICAgICAgICAgIGlmICghX2NvbnRleHQuc2VudCkge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTg7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuYWJydXB0KFwicmV0dXJuXCIsIHRydWUpO1xuXG4gICAgICAgICAgY2FzZSAxODpcbiAgICAgICAgICAgIF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gPSB0cnVlO1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDU7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgIGNhc2UgMjE6XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMjc7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgIGNhc2UgMjM6XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMjM7XG4gICAgICAgICAgICBfY29udGV4dC50MCA9IF9jb250ZXh0W1wiY2F0Y2hcIl0oMyk7XG4gICAgICAgICAgICBfZGlkSXRlcmF0b3JFcnJvciA9IHRydWU7XG4gICAgICAgICAgICBfaXRlcmF0b3JFcnJvciA9IF9jb250ZXh0LnQwO1xuXG4gICAgICAgICAgY2FzZSAyNzpcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAyNztcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAyODtcblxuICAgICAgICAgICAgaWYgKCEoIV9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gJiYgX2l0ZXJhdG9yW1wicmV0dXJuXCJdICE9IG51bGwpKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAzMjtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAzMjtcbiAgICAgICAgICAgIHJldHVybiBfaXRlcmF0b3JbXCJyZXR1cm5cIl0oKTtcblxuICAgICAgICAgIGNhc2UgMzI6XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMzI7XG5cbiAgICAgICAgICAgIGlmICghX2RpZEl0ZXJhdG9yRXJyb3IpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDM1O1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdGhyb3cgX2l0ZXJhdG9yRXJyb3I7XG5cbiAgICAgICAgICBjYXNlIDM1OlxuICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0LmZpbmlzaCgzMik7XG5cbiAgICAgICAgICBjYXNlIDM2OlxuICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0LmZpbmlzaCgyNyk7XG5cbiAgICAgICAgICBjYXNlIDM3OlxuICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0LmFicnVwdChcInJldHVyblwiLCBmYWxzZSk7XG5cbiAgICAgICAgICBjYXNlIDM4OlxuICAgICAgICAgIGNhc2UgXCJlbmRcIjpcbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dC5zdG9wKCk7XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICB9LCBfY2FsbGVlLCBudWxsLCBbWzMsIDIzLCAyNywgMzddLCBbMjgsLCAzMiwgMzZdXSk7XG4gIH0pKTtcbiAgcmV0dXJuIF9hc3luY1NvbWUuYXBwbHkodGhpcywgYXJndW1lbnRzKTtcbn1cblxuZXhwb3J0cy5fX2FzeW5jU29tZSA9IF9fYXN5bmNTb21lO1xudmFyIGFzeW5jU29tZSA9IC8qI19fUFVSRV9fKi9hc3luY0l0ZXJhYmxlQ3VycnkoX19hc3luY1NvbWUsIHtcbiAgcmVkdWNlczogdHJ1ZVxufSk7XG5leHBvcnRzLmFzeW5jU29tZSA9IGFzeW5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ICAgdmFyIGdldEtleSwgcGVla3IsIGtleSwgaWR4LCBsYXN0S2V5O1xuICAgIHJldHVybiBfcmVnZW5lcmF0b3JSdW50aW1lLndyYXAoZnVuY3Rpb24gX2NhbGxlZSQoX2NvbnRleHQpIHtcbiAgICAgIHdoaWxlICgxKSB7XG4gICAgICAgIHN3aXRjaCAoX2NvbnRleHQucHJldiA9IF9jb250ZXh0Lm5leHQpIHtcbiAgICAgICAgICBjYXNlIDA6XG4gICAgICAgICAgICBnZXRLZXkgPSBfcmVmLmdldEtleTtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAzO1xuICAgICAgICAgICAgcmV0dXJuIF9hd2FpdEFzeW5jR2VuZXJhdG9yKF9fYXN5bmNQZWVrZXJhdGUoc291cmNlKSk7XG5cbiAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICBwZWVrciA9IF9jb250ZXh0LnNlbnQ7XG4gICAgICAgICAgICBrZXkgPSBpbml0aWFsS2V5O1xuICAgICAgICAgICAgaWR4ID0gMDtcblxuICAgICAgICAgIGNhc2UgNjpcbiAgICAgICAgICAgIGlmIChwZWVrci5kb25lKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyMjtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGxhc3RLZXkgPSBrZXk7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTA7XG4gICAgICAgICAgICByZXR1cm4gX2F3YWl0QXN5bmNHZW5lcmF0b3IoZ2V0S2V5KHBlZWtyLnZhbHVlLCBpZHgrKykpO1xuXG4gICAgICAgICAgY2FzZSAxMDpcbiAgICAgICAgICAgIGtleSA9IF9jb250ZXh0LnNlbnQ7XG5cbiAgICAgICAgICAgIGlmICghKGxhc3RLZXkgIT09IGtleSkpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDE2O1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAg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NwbGl0ZXJhdG9yKHNwbGl0LCBfcmVmLCBzb3VyY2UpIHtcbiAgdmFyIGdldEtleSwgcGVla3IsIGtleSwgaWR4LCBsYXN0S2V5O1xuICByZXR1cm4gX3JlZ2VuZXJhdG9yUnVudGltZS53cmFwKGZ1bmN0aW9uIGdyb3VwaW5nU3BsaXRlcmF0b3IkKF9jb250ZXh0KSB7XG4gICAgd2hpbGUgKDEpIHtcbiAgICAgIHN3aXRjaCAoX2NvbnRleHQucHJldiA9IF9jb250ZXh0Lm5leHQpIHtcbiAgICAgICAgY2FzZSAwOlxuICAgICAgICAgIGdldEtleSA9IF9yZWYuZ2V0S2V5O1xuICAgICAgICAgIHBlZWtyID0gX19wZWVrZXJhdGUoc291cmNlKTtcbiAgICAgICAgICBrZXkgPSBpbml0aWFsS2V5O1xuICAgICAgICAgIGlkeCA9IDA7XG5cbiAgICAgICAgY2FzZSA0OlxuICAgICAgICAgIGlmIChwZWVrci5kb25lKSB7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTc7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgICB9XG5cbiAgICAgICAgICBsYXN0S2V5ID0ga2V5O1xuICAgICAgICAgIGtleSA9IGdldEtleShwZWVrci52YWx1ZSwgaWR4KyspO1xuXG4gICAgICAgICAgaWYgKCEobGFzdEtleSAhPT0ga2V5KSkge1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDEyO1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgX2NvbnRleHQubmV4dCA9IDEwO1xuICAgICAgICAgIHJldHVybiBzcGxpdDtcblxuICAgICAgICBjYXNlIDEwOlxuICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxMjtcbiAgICAgICAgICByZXR1cm4ga2V5O1xuXG4gICAgICAgIGNhc2UgMTI6XG4gICAgICAgICAgX2NvbnRleHQubmV4dCA9IDE0O1xuICAgICAgICAgIHJldHVybiBwZWVrci52YWx1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gICBjYXNlIDc6XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gOTtcbiAgICAgICAgICAgIHJldHVybiBfYXdhaXRBc3luY0dlbmVyYXRvcihfaXRlcmF0b3IubmV4dCgpKTtcblxuICAgICAgICAgIGNhc2UgOTpcbiAgICAgICAgICAgIF9zdGVwID0gX2NvbnRleHQuc2VudDtcbiAgICAgICAgICAgIF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gPSBfc3RlcC5kb25lO1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDEzO1xuICAgICAgICAgICAgcmV0dXJuIF9hd2FpdEFzeW5jR2VuZXJhdG9yKF9zdGVwLnZhbHVlKTtcblxuICAgICAgICAgIGNhc2UgMTM6XG4gICAgICAgICAgICBfdmFsdWUgPSBfY29udGV4dC5zZW50O1xuXG4gICAgICAgICAgICBpZiAoX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbikge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMzE7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBidWZmZXIgPSBfdmFsdWU7XG5cbiAgICAgICAgICAgIGlmICghKHNraXAgPiAwKSkge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTk7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBza2lwLS07XG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuYWJydXB0KFwiY29udGludWVcIiwgMjgpO1xuXG4gICAgICAgICAgY2FzZSAxOTpcbiAgICAgICAgICAgIG1hdGNoaW5nTGVuZ3RoID0gZ2V0TWF0Y2hpbmdMZW5ndGgoYnVmZmVyLCBzZXBhcmF0b3JTZXFzLCBzYW1lKTtcblxuICAgICAgICAgICAgaWYgKCEobWF0Y2hpbmdMZW5ndGggPiAwKSkge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMjY7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMjM7XG4gICAgICAgICAgICByZXR1cm4gc3BsaXQ7XG5cbiAgICAgICAgICBjYXNlIDIzOlxuICAgICAgICAgICAgc2tpcCA9IG1hdGNoaW5nTGVuZ3RoIC0gMTtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyODtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSAyNjpcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyODtcbiAgICAgICAgICAgIHJldHVybiBidWZmZXIuZ2V0KDApO1xuXG4gICAgICAgICAgY2FzZSAyODpcbiAgICAgICAgICAgIF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gPSB0cnVlO1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDc7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgIGNhc2UgMzE6XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMzc7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgIGNhc2UgMzM6XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMzM7XG4gICAgICAgICAgICBfY29udGV4dC50MCA9IF9jb250ZXh0W1wiY2F0Y2hcIl0oNSk7XG4gICAgICAgICAgICBfZGlkSXRlcmF0b3JFcnJvciA9IHRydWU7XG4gICAgICAgICAgICBfaXRlcmF0b3JFcnJvciA9IF9jb250ZXh0LnQwO1xuXG4gICAgICAgICAgY2FzZSAzNzpcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAzNztcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAzODtcblxuICAgICAgICAgICAgaWYgKCEoIV9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gJiYgX2l0ZXJhdG9yW1wicmV0dXJuXCJdICE9IG51bGwpKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA0MjtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA0MjtcbiAgICAgICAgICAgIHJldHVybiBfYXdhaXRBc3luY0dlbmVyYXRvcihfaXRlcmF0b3JbXCJyZXR1cm5cIl0oKSk7XG5cbiAgICAgICAgICBjYXNlIDQyOlxuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDQyO1xuXG4gICAgICAgICAgICBpZiAoIV9kaWRJdGVyYXRvckVycm9yKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA0NTtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHRocm93IF9pdGVyYXRvckVycm9yO1xuXG4gICAgICAgICAgY2FzZSA0NTpcbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dC5maW5pc2goNDIpO1xuXG4gICAgICAgICAgY2FzZSA0NjpcbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dC5maW5pc2goMzcpO1xuXG4gICAgICAgICAgY2FzZSA0NzpcbiAgICAgICAgICBjYXNlIFwiZW5kXCI6XG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuc3RvcCgpO1xuICAgICAgICB9XG4gICAgICB9XG4gICAgfSwgX2NhbGxlZSwgbnVsbCwgW1s1LCAzMywgMzcsIDQ3XSwgWzM4LCwgNDIsIDQ2XV0pO1xuICB9KSk7XG4gIHJldHVybiBfYXN5bmNBbnlTZXFzcGxpdGVyYXRvci5hcHBseSh0aGlzLCBhcmd1bWVudHMpO1xufVxuXG5mdW5jdGlvbiBfX2FzeW5jU3BsaXRPbkFueVNlcShfeDQsIF94NSkge1xuICByZXR1cm4gX2FzeW5jU3BsaXRPbkFueVNlcS5hcHBseSh0aGlzLCBhcmd1bWVudHMpO1xufVxuXG5leHBvcnRzLl9fYXN5bmNTcGxpdE9u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VyYXRvcjIgPSBfY3JlYXRlRm9yT2ZJdGVyYXRvckhlbHBlcihfX3dpbmRvd0FoZWFkKHNvdXJjZSwgbWF4TWF0Y2hMZW5ndGgsIHtcbiAgICAgICAgICAgIHVzZUZpbGxlcjogZmFsc2VcbiAgICAgICAgICB9KSk7XG4gICAgICAgICAgX2NvbnRleHQucHJldiA9IDQ7XG5cbiAgICAgICAgICBfaXRlcmF0b3IyLnMoKTtcblxuICAgICAgICBjYXNlIDY6XG4gICAgICAgICAgaWYgKChfc3RlcDIgPSBfaXRlcmF0b3IyLm4oKSkuZG9uZSkge1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDIyO1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgYnVmZmVyID0gX3N0ZXAyLnZhbHVlO1xuXG4gICAgICAgICAgaWYgKCEoc2tpcCA+IDApKSB7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTE7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgICB9XG5cbiAgICAgICAgICBza2lwLS07XG4gICAgICAgICAgcmV0dXJuIF9jb250ZXh0LmFicnVwdChcImNvbnRpbnVlXCIsIDIwKTtcblxuICAgICAgICBjYXNlIDExOlxuICAgICAgICAgIG1hdGNoaW5nTGVuZ3RoID0gZ2V0TWF0Y2hpbmdMZW5ndGgoYnVmZmVyLCBzZXBhcmF0b3JTZXFzLCBzYW1lKTtcblxuICAgICAgICAgIGlmICghKG1hdGNoaW5nTGVuZ3RoID4gMCkpIHtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxODtcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxNTtcbiAgICAgICAgICByZXR1cm4gc3BsaXQ7XG5cbiAgICAgICAgY2FzZSAxNTpcbiAgICAgICAgICBza2lwID0gbWF0Y2hpbmdMZW5ndGggLSAxO1xuICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyMDtcbiAgICAgICAgICBicmVhaztcblxuICAgICAgICBjYXNlIDE4OlxuICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyMDtcbiAgICAgICAgICByZXR1cm4gYnVmZmVyLmdldCgwKTtcblxuICAgICAgICBjYXNlIDIwOlxuICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA2O1xuICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgIGNhc2UgMjI6XG4gICAgICAgICAgX2NvbnRleHQubmV4dCA9IDI3O1xuICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgIGNhc2UgMjQ6XG4gICAgICAgICAgX2NvbnRleHQucHJldiA9IDI0O1xuICAgICAgICAgIF9jb250ZXh0LnQwID0gX2NvbnRleHRbXCJjYXRjaFwiXSg0KTtcblxuICAgICAgICAgIF9pdGVyYXRvcjIuZShfY29udGV4dC50MCk7XG5cbiAgICAgICAgY2FzZSAyNzpcbiAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMjc7XG5cbiAgICAgICAgICBfaXRlcmF0b3IyLmYoKTtcblxuICAgICAgICAgIHJldHVybiBfY29udGV4dC5maW5pc2goMjcpO1xuXG4gICAgICAgIGNhc2UgMzA6XG4gICAgICAgIGNhc2UgXCJlbmRcIjpcbiAgICAgICAgICByZXR1cm4gX2NvbnRleHQuc3RvcCgpO1xuICAgICAgfVxuICAgIH1cbiAgfSwgX21hcmtlZCwgbnVsbCwgW1s0LCAyNCwgMjcsIDMwXV0pO1xufVxuXG5mdW5jdGlvbiBfX3NwbGl0T25BbnlTZXEoc291cmNlLCBzZXBhcmF0b3JTZXFzKSB7XG4gIHZhciBzYW1lLFxuICAgICAgc2VwYXJhdG9yU2Vxc0FycixcbiAgICAgIF9hcmdzMiA9IGFyZ3VtZW50cztcbiAgcmV0dXJuIF9yZWdlbmVyYXRvclJ1bnRpbWUud3JhcChmdW5jdGlvbiBfX3NwbGl0T25BbnlTZXEkKF9jb250ZXh0M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ZTtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxMjtcbiAgICAgICAgICAgIHJldHVybiBfYXdhaXRBc3luY0dlbmVyYXRvcihfc3RlcC52YWx1ZSk7XG5cbiAgICAgICAgICBjYXNlIDEyOlxuICAgICAgICAgICAgX3ZhbHVlID0gX2NvbnRleHQuc2VudDtcblxuICAgICAgICAgICAgaWYgKF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24pIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDI3O1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdmFsdWUgPSBfdmFsdWU7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTc7XG4gICAgICAgICAgICByZXR1cm4gX2F3YWl0QXN5bmNHZW5lcmF0b3IocHJlZGljYXRlKHZhbHVlLCBpKyspKTtcblxuICAgICAgICAgIGNhc2UgMTc6XG4gICAgICAgICAgICBpZiAoIV9jb250ZXh0LnNlbnQpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDIxO1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgX2NvbnRleHQudDAgPSBzcGxpdDtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyMjtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSAyMTpcbiAgICAgICAgICAgIF9jb250ZXh0LnQwID0gdmFsdWU7XG5cbiAgICAgICAgICBjYXNlIDIyOlxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDI0O1xuICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0LnQwO1xuXG4gICAgICAgICAgY2FzZSAyNDpcbiAgICAgICAgICAgIF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gPSB0cnVlO1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDY7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgIGNhc2UgMjc6XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMzM7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgIGNhc2UgMjk6XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMjk7XG4gICAgICAgICAgICBfY29udGV4dC50MSA9IF9jb250ZXh0W1wiY2F0Y2hcIl0oNCk7XG4gICAgICAgICAgICBfZGlkSXRlcmF0b3JFcnJvciA9IHRydWU7XG4gICAgICAgICAgICBfaXRlcmF0b3JFcnJvciA9IF9jb250ZXh0LnQxO1xuXG4gICAgICAgICAgY2FzZSAzMzpcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAzMztcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAzNDtcblxuICAgICAgICAgICAgaWYgKCEoIV9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gJiYgX2l0ZXJhdG9yW1wicmV0dXJuXCJdICE9IG51bGwpKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAzODtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAzODtcbiAgICAgICAgICAgIHJldHVybiBfYXdhaXRBc3luY0dlbmVyYXRvcihfaXRlcmF0b3JbXCJyZXR1cm5cIl0oKSk7XG5cbiAgICAgICAgICBjYXNlIDM4OlxuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDM4O1xuXG4gICAgICAgICAgICBpZiAoIV9kaWRJdGVyYXRvckVycm9yKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA0MTtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHRocm93IF9pdGVyYXRvckVycm9yO1xuXG4gICAgICAgICAgY2FzZSA0MTpcbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dC5maW5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bnRpbWUud3JhcChmdW5jdGlvbiBfY2FsbGVlJChfY29udGV4dCkge1xuICAgICAgd2hpbGUgKDEpIHtcbiAgICAgICAgc3dpdGNoIChfY29udGV4dC5wcmV2ID0gX2NvbnRleHQubmV4dCkge1xuICAgICAgICAgIGNhc2UgMDpcbiAgICAgICAgICAgIGlmICghKHN1YnNlcVBlZWtyLmRvbmUgfHwgc3Vic2VxUGVla3IudmFsdWUuaW5jbHVkZXMobm9uZSkpKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyO1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0LmFicnVwdChcInJldHVyblwiLCB0cnVlKTtcblxuICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgIG1hdGNoZXMgPSBzdWJzZXFQZWVrci52YWx1ZS5tYXAoZnVuY3Rpb24gKCkge1xuICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTtcbiAgICAgICAgICAgIH0pO1xuXG4gICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgaWYgKCEoIXBlZWtyLmRvbmUgJiYgIXN1YnNlcVBlZWtyLmRvbmUpKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyMjtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHZhbHVlID0gcGVla3IudmFsdWU7XG4gICAgICAgICAgICBzZXFWYWx1ZSA9IHN1YnNlcVBlZWtyLnZhbHVlO1xuICAgICAgICAgICAgaSA9IDA7XG5cbiAgICAgICAgICBjYXNlIDc6XG4gICAgICAgICAgICBpZiAoIShpIDwgc2VxVmFsdWUubGVuZ3RoKSkge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTg7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBpZiAobWF0Y2hlc1tpXSkge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTA7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuYWJydXB0KFwiY29udGludWVcIiwgMTUpO1xuXG4gICAgICAgICAgY2FzZSAxMDpcbiAgICAgICAgICAgIGlmICghKHNlcVZhbHVlW2ldID09PSBub25lKSkge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTQ7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuYWJydXB0KFwicmV0dXJuXCIsIHRydWUpO1xuXG4gICAgICAgICAgY2FzZSAxNDpcbiAgICAgICAgICAgIG1hdGNoZXNbaV0gPSBzYW1lKHNlcVZhbHVlW2ldLCB2YWx1ZSk7XG5cbiAgICAgICAgICBjYXNlIDE1OlxuICAgICAgICAgICAgaSsrO1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDc7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgIGNhc2UgMTg6XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMjA7XG4gICAgICAgICAgICByZXR1cm4gUHJvbWlzZS5hbGwoW3N1YnNlcVBlZWtyLmFkdmFuY2UoKSwgcGVla3IuYWR2YW5jZSgpXSk7XG5cbiAgICAgICAgICBjYXNlIDIwOlxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDM7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgIGNhc2UgMjI6XG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuYWJydXB0KFwicmV0dXJuXCIsIHN1YnNlcVBlZWtyLmRvbmUgJiYgbWF0Y2hlcy5pbmNsdWRlcyh0cnVlKSk7XG5cbiAgICAgICAgICBjYXNlIDIzOlxuICAgICAgICAgIGNhc2UgXCJlbmRcIjpcbiAgIC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cblxuICAgICAgICAgICAgaWYgKHNlcXMubGVuZ3RoKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Mi5uZXh0ID0gMztcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dDIuYWJydXB0KFwicmV0dXJuXCIsIGZhbHNlKTtcblxuICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgIF9jb250ZXh0Mi5uZXh0ID0gNTtcbiAgICAgICAgICAgIHJldHVybiBfX2FzeW5jUGVla2VyYXRlKGl0ZXJhYmxlKTtcblxuICAgICAgICAgIGNhc2UgNTpcbiAgICAgICAgICAgIHBlZWtyID0gX2NvbnRleHQyLnNlbnQ7XG4gICAgICAgICAgICBfY29udGV4dDIubmV4dCA9IDg7XG4gICAgICAgICAgICByZXR1cm4gX19hc3luY1BlZWtlcmF0ZShfX2FzeW5jWmlwQWxsKHNlcXMsIHtcbiAgICAgICAgICAgICAgZmlsbGVyOiBub25lXG4gICAgICAgICAgICB9KSk7XG5cbiAgICAgICAgICBjYXNlIDg6XG4gICAgICAgICAgICBzdWJzZXFQZWVrciA9IF9jb250ZXh0Mi5zZW50O1xuICAgICAgICAgICAgX2NvbnRleHQyLm5leHQgPSAxMTtcbiAgICAgICAgICAgIHJldHVybiBfYXN5bmNTdGFydHNXaXRoQW55U2VxKHBlZWtyLCBzdWJzZXFQZWVrciwgc2FtZSk7XG5cbiAgICAgICAgICBjYXNlIDExOlxuICAgICAgICAgICAgc2VxRm91bmQgPSBfY29udGV4dDIuc2VudDtcbiAgICAgICAgICAgIF9jb250ZXh0Mi5uZXh0ID0gMTQ7XG4gICAgICAgICAgICByZXR1cm4gc3Vic2VxUGVla3JbXCJyZXR1cm5cIl0oKTtcblxuICAgICAgICAgIGNhc2UgMTQ6XG4gICAgICAgICAgICBfY29udGV4dDIubmV4dCA9IDE2O1xuICAgICAgICAgICAgcmV0dXJuIHBlZWtyW1wicmV0dXJu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cmF0b3JSdW50aW1lLndyYXAoZnVuY3Rpb24gX2NhbGxlZSQoX2NvbnRleHQpIHtcbiAgICAgIHdoaWxlICgxKSB7XG4gICAgICAgIHN3aXRjaCAoX2NvbnRleHQucHJldiA9IF9jb250ZXh0Lm5leHQpIHtcbiAgICAgICAgICBjYXNlIDA6XG4gICAgICAgICAgICByZXN1bHQgPSAnJztcbiAgICAgICAgICAgIF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gPSB0cnVlO1xuICAgICAgICAgICAgX2RpZEl0ZXJhdG9yRXJyb3IgPSBmYWxzZTtcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAzO1xuICAgICAgICAgICAgX2l0ZXJhdG9yID0gX2FzeW5jSXRlcmF0b3IoY2hhcnMpO1xuXG4gICAgICAgICAgY2FzZSA1OlxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDc7XG4gICAgICAgICAgICByZXR1cm4gX2l0ZXJhdG9yLm5leHQoKTtcblxuICAgICAgICAgIGNhc2UgNzpcbiAgICAgICAgICAgIF9zdGVwID0gX2NvbnRleHQuc2VudDtcbiAgICAgICAgICAgIF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gPSBfc3RlcC5kb25lO1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDExO1xuICAgICAgICAgICAgcmV0dXJuIF9zdGVwLnZhbHVlO1xuXG4gICAgICAgICAgY2FzZSAxMTpcbiAgICAgICAgICAgIF92YWx1ZSA9IF9jb250ZXh0LnNlbnQ7XG5cbiAgICAgICAgICAgIGlmIChfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxODtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIF9jaGFyID0gX3ZhbHVlO1xuICAgICAgICAgICAgcmVzdWx0ICs9IF9jaGFyLnRvU3RyaW5nKCk7XG5cbiAgICAgICAgICBjYXNlIDE1OlxuICAgICAgICAgICAgX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiA9IHRydWU7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gNTtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSAxODpcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyNDtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSAyMDpcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAyMDtcbiAgICAgICAgICAgIF9jb250ZXh0LnQwID0gX2NvbnRleHRbXCJjYXRjaFwiXSgzKTtcbiAgICAgICAgICAgIF9kaWRJdGVyYXRvckVycm9yID0gdHJ1ZTtcbiAgICAgICAgICAgIF9pdGVyYXRvckVycm9yID0gX2NvbnRleHQudDA7XG5cbiAgICAgICAgICBjYXNlIDI0OlxuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDI0O1xuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDI1O1xuXG4gICAgICAgICAgICBpZiAoISghX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiAmJiBfaXRlcmF0b3JbXCJyZXR1cm5cIl0gIT0gbnVsbCkpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDI5O1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDI5O1xuICAgICAgICAgICAgcmV0dXJuIF9pdGVyYXRvcltcInJldHVyblwiXSgpO1xuXG4gICAgICAgICAgY2FzZSAyOTpcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAyOTtcblxuICAgICAgICAgICAgaWYgKCFfZGlkSXRlcmF0b3JFcnJvcikge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMzI7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfV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biAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxMTtcbiAgICAgICAgICAgIHJldHVybiBfc3RlcC52YWx1ZTtcblxuICAgICAgICAgIGNhc2UgMTE6XG4gICAgICAgICAgICBfdmFsdWUyID0gX2NvbnRleHQuc2VudDtcblxuICAgICAgICAgICAgaWYgKF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24pIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDE4O1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdmFsdWUgPSBfdmFsdWUyO1xuICAgICAgICAgICAgX3ZhbHVlID0gdmFsdWU7XG5cbiAgICAgICAgICBjYXNlIDE1OlxuICAgICAgICAgICAgX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiA9IHRydWU7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gNTtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSAxODpcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyNDtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSAyMDpcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAyMDtcbiAgICAgICAgICAgIF9jb250ZXh0LnQwID0gX2NvbnRleHRbXCJjYXRjaFwiXSgzKTtcbiAgICAgICAgICAgIF9kaWRJdGVyYXRvckVycm9yID0gdHJ1ZTtcbiAgICAgICAgICAgIF9pdGVyYXRvckVycm9yID0gX2NvbnRleHQudDA7XG5cbiAgICAgICAgICBjYXNlIDI0OlxuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDI0O1xuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDI1O1xuXG4gICAgICAgICAgICBpZiAoISghX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiAmJiBfaXRlcmF0b3JbXCJyZXR1cm5cIl0gIT0gbnVsbCkpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDI5O1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDI5O1xuICAgICAgICAgICAgcmV0dXJuIF9pdGVyYXRvcltcInJldHVyblwiXSgpO1xuXG4gICAgICAgICAgY2FzZSAyOTpcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAyOTtcblxuICAgICAgICAgICAgaWYgKCFfZGlkSXRlcmF0b3JFcnJvcikge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMzI7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB0aHJvdyBfaXRlcmF0b3JFcnJvcjtcblxuICAgICAgICAgIGNhc2UgMzI6XG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuZmluaXNoKDI5KTtcblxuICAgICAgICAgIGNhc2UgMzM6XG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuZmluaXNoKDI0KTtcblxuICAgICAgICAgIGNhc2UgMzQ6XG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuYWJydXB0KFwicmV0dXJuXCIsIF92YWx1ZSk7XG5cbiAgICAgICAgICBjYXNlIDM1OlxuICAgICAgICAgIGNhc2UgXCJlbmRcIjpcbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dC5zdG9wKCk7XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICB9LCBfY2FsbGVlLCBudWxsLCBbWzMsIDIwLCAyNCwgMzRdLCBbMjUsLCAyOSwgMzNdXSk7XG4gIH0pKTtcbiAgcmV0dXJuIF9hc3luY1Rha2VMYXN0T3IuYXBwbHkodGhpcywgYXJndW1lbnRzKTtcbn1cblxuZXhwb3J0cy5fX2FzeW5jVGFrZUxhc3RPciA9IF9fYXN5bmNUYWtlTGFzdE9yO1xudmFyIGFzeW5jVGFrZUxhc3RPciA9IC8qI19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V3IEhlYXAoY29tcGFyZSk7XG4gICAgICAgICAgICBfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uID0gdHJ1ZTtcbiAgICAgICAgICAgIF9kaWRJdGVyYXRvckVycm9yID0gZmFsc2U7XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gNTtcbiAgICAgICAgICAgIF9pdGVyYXRvciA9IF9hc3luY0l0ZXJhdG9yKHNvdXJjZSk7XG5cbiAgICAgICAgICBjYXNlIDc6XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gOTtcbiAgICAgICAgICAgIHJldHVybiBfYXdhaXRBc3luY0dlbmVyYXRvcihfaXRlcmF0b3IubmV4dCgpKTtcblxuICAgICAgICAgIGNhc2UgOTpcbiAgICAgICAgICAgIF9zdGVwID0gX2NvbnRleHQuc2VudDtcbiAgICAgICAgICAgIF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gPSBfc3RlcC5kb25lO1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDEzO1xuICAgICAgICAgICAgcmV0dXJuIF9hd2FpdEFzeW5jR2VuZXJhdG9yKF9zdGVwLnZhbHVlKTtcblxuICAgICAgICAgIGNhc2UgMTM6XG4gICAgICAgICAgICBfdmFsdWUgPSBfY29udGV4dC5zZW50O1xuXG4gICAgICAgICAgICBpZiAoX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbikge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMjE7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB2YWx1ZSA9IF92YWx1ZTtcbiAgICAgICAgICAgIGhlYXAucHVzaCh2YWx1ZSk7XG5cbiAgICAgICAgICAgIGlmIChoZWFwLnNpemUgPiBuKSB7XG4gICAgICAgICAgICAgIGhlYXAucG9wKCk7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICBjYXNlIDE4OlxuICAgICAgICAgICAgX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiA9IHRydWU7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gNztcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSAyMTpcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyNztcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSAyMzpcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAyMztcbiAgICAgICAgICAgIF9jb250ZXh0LnQwID0gX2NvbnRleHRbXCJjYXRjaFwiXSg1KTtcbiAgICAgICAgICAgIF9kaWRJdGVyYXRvckVycm9yID0gdHJ1ZTtcbiAgICAgICAgICAgIF9pdGVyYXRvckVycm9yID0gX2NvbnRleHQudDA7XG5cbiAgICAgICAgICBjYXNlIDI3OlxuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDI3O1xuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDI4O1xuXG4gICAgICAgICAgICBpZiAoISghX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiAmJiBfaXRlcmF0b3JbXCJyZXR1cm5cIl0gIT0gbnVsbCkpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDMyO1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDMyO1xuICAgICAgICAgICAgcmV0dXJuIF9hd2FpdEFzeW5jR2VuZXJhdG9yKF9pdGVyYXRvcltcInJldHVyblwiXSgpKTtcblxuICAgICAgICAgIGNhc2UgMzI6XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMzI7XG5cbiAgICAgICAgICAgIGlmICghX2RpZEl0ZXJhdG9yRXJyb3IpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDM1O1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdGhyb3cgX2l0ZXJhdG9yRXJyb3I7XG5cbiAgICAgICAgICBjYXNlIDM1OlxuICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0LmZpbmlzaCgzMik7XG5cbiAgICAgICAgICBjYXNlIDM2OlxuICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0LmZpbmlzaCgyNyk7XG5cbiAgICAgICAgICBjYXNlIDM3OlxuICAgICAgICAgICAgaWYgKCFoZWFwLnNpemUpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDQyO1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDQwO1xuICAgICAgICAgICAgcmV0dXJuIGhlYXAucG9wKCk7XG5cbiAgICAgICAgICBjYXNlIDQwOlxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDM3O1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICBjYXNlIDQyOlxuICAgICAgICAgIGNhc2UgXCJlbmRcIjpcbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dC5zdG9wKCk7XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICB9LCBfY2FsbGVlLCBudWxsLCBbWzUsIDIzLCAyNywgMzddLCBbMjgsLCAzMiwgMzZdXSk7XG4gIH0pKTtcbiAgcmV0dXJuIF9hc3luY1Rha2VTb3J0ZWQuYXBwbHkodGhpcywgYXJndW1lbnRzKTtcbn1cblxudmFyIGFzeW5jVGFrZVNvcnRlZCA9IC8qI19fUFVSRV9fKi9hc3luY0l0ZXJhYmxlQ3VycnkoX19hc3luY1Rha2VTb3J0ZWQsIHtcbiAgbWluQXJnczogMCxcbiAgbWF4QXJnczogMixcbiAgdmFsaWRhdGVBcmdzOiBmdW5jdGlvbiB2YWxpZGF0ZUFyZ3MoYXJncykge1xuICAgIGlmICh0eXBlb2YgYXJnc1sxXSA9PT0gJ2Z1bmN0aW9uJykge1xuICAgICAgdmFyIHR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KHRoaXMuZGF0YSwgbElkeCwgaSk7XG4gICAgICAgIHJldHVybiBsSWR4O1xuICAgICAgfSBlbHNlIGlmIChyaWdodElzU21hbGxlcikge1xuICAgICAgICBzd2FwKHRoaXMuZGF0YSwgcklkeCwgaSk7XG4gICAgICAgIHJldHVybiBySWR4O1xuICAgICAgfVxuICAgIH1cbiAgfSwge1xuICAgIGtleTogXCJfYnViYmxlRG93blwiLFxuICAgIHZhbHVlOiBmdW5jdGlvbiBfYnViYmxlRG93bihpKSB7XG4gICAgICB2YXIgc2l6ZSA9IHRoaXMuc2l6ZTtcblxuICAgICAgd2hpbGUgKGkgIT09IG51bGwgJiYgaSA8IHNpemUpIHtcbiAgICAgICAgaSA9IHRoaXMuX2hlYXBpZnkoaSk7XG4gICAgICB9XG4gICAgfVxuICB9LCB7XG4gICAga2V5OiBcInB1c2hcIixcbiAgICB2YWx1ZTogZnVuY3Rpb24gcHVzaCh2YWx1ZSkge1xuICAgICAgdGhpcy5kYXRhLnB1c2godmFsdWUpO1xuXG4gICAgICB0aGlzLl9idWJibGVVcCh0aGlzLnNpemUgLSAxKTtcbiAgICB9XG4gIH0sIHtcbiAgICBrZXk6IFwicG9wXCIsXG4gICAgdmFsdWU6IGZ1bmN0aW9uIHBvcCgpIHtcbiAgICAgIGlmICghdGhpcy5zaXplKSByZXR1cm47XG4gICAgICB2YXIgcm9vdCA9IHRoaXMuZGF0YVswXTtcbiAgICAgIHZhciBsYXN0ID0gdGhpcy5kYXRhLnBvcCgpO1xuXG4gICAgICBpZiAodGhpcy5zaXplID4gMCkge1xuICAgICAgICB0aGlzLmRhdGFbMF0gPSBsYXN0O1xuXG4gICAgICAgIHRoaXMuX2J1YmJsZURvd24oMCk7XG4gICAgICB9XG5cbiAgICAgIHJldHVybiByb290O1xuICAgIH1cbiAgfSwge1xuICAgIGtleTogXCJoYXNcIixcbiAgICB2YWx1ZTogZnVuY3Rpb24gaGFzKGlkeCkge1xuICAgICAgcmV0dXJuIGlkeCA+IDA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kb25lOykge1xuICAgICAgICAgICAgICB2YWx1ZSA9IF9zdGVwLnZhbHVlO1xuICAgICAgICAgICAgICBoZWFwLnB1c2godmFsdWUpO1xuXG4gICAgICAgICAgICAgIGlmIChoZWFwLnNpemUgPiBuKSB7XG4gICAgICAgICAgICAgICAgaGVhcC5wb3AoKTtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgIH0gY2F0Y2ggKGVycikge1xuICAgICAgICAgICAgX2l0ZXJhdG9yLmUoZXJyKTtcbiAgICAgICAgICB9IGZpbmFsbHkge1xuICAgICAgICAgICAgX2l0ZXJhdG9yLmYoKTtcbiAgICAgICAgICB9XG5cbiAgICAgICAgY2FzZSA1OlxuICAgICAgICAgIGlmICghaGVhcC5zaXplKSB7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTA7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgICB9XG5cbiAgICAgICAgICBfY29udGV4dC5uZXh0ID0gODtcbiAgICAgICAgICByZXR1cm4gaGVhcC5wb3AoKTtcblxuICAgICAgICBjYXNlIDg6XG4gICAgICAgICAgX2NvbnRleHQubmV4dCA9IDU7XG4gICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgY2FzZSAxMDpcbiAgICAgICAgY2FzZSBcImVuZFwiOlxuICAgICAgICAgIHJldHVybiBfY29udGV4dC5zdG9wKCk7XG4gICAgICB9XG4gICAgfVxuICB9LCBfbWFya2VkKTtcbn1cblxuZXhwb3J0cy5fX3Rha2VTb3J0ZWQgPSBfX3Rha2VTb3J0ZWQ7XG52YXIgdGFrZVNvcnRlZCA9IC8qI19fUFVSRV9fKi9pdGVyYWJsZUN1cnJ5KF9fdGFrZVNvcnRlZCwge1xuICBtaW5BcmdzOiAwLFxuICBtYXhBcmdzOiAyLFxuICB2YWxpZGF0ZUFyZ3M6IGZ1bmN0aW9uIHZhbGlkYXRlQXJncyhhcmdzKSB7XG4gICAgaWYgKHR5cGVvZiBhcmdzWz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3luY0dlbmVyYXRvcihfc3RlcC52YWx1ZSk7XG5cbiAgICAgICAgICBjYXNlIDEyOlxuICAgICAgICAgICAgX3ZhbHVlID0gX2NvbnRleHQuc2VudDtcblxuICAgICAgICAgICAgaWYgKF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24pIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDI3O1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdmFsdWUgPSBfdmFsdWU7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTc7XG4gICAgICAgICAgICByZXR1cm4gX2F3YWl0QXN5bmNHZW5lcmF0b3IocHJlZGljYXRlKHZhbHVlLCBjKyspKTtcblxuICAgICAgICAgIGNhc2UgMTc6XG4gICAgICAgICAgICB0YWtlID0gX2NvbnRleHQuc2VudDtcblxuICAgICAgICAgICAgaWYgKCF0YWtlKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyMztcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyMTtcbiAgICAgICAgICAgIHJldHVybiB2YWx1ZTtcblxuICAgICAgICAgIGNhc2UgMjE6XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMjQ7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgIGNhc2UgMjM6XG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuYWJydXB0KFwiYnJlYWtcIiwgMjcpO1xuXG4gICAgICAgICAgY2FzZSAyNDpcbiAgICAgICAgICAgIF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gPSB0cnVlO1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDY7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgIGNhc2UgMjc6XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMzM7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgIGNhc2UgMjk6XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMjk7XG4gICAgICAgICAgICBfY29udGV4dC50MCA9IF9jb250ZXh0W1wiY2F0Y2hcIl0oNCk7XG4gICAgICAgICAgICBfZGlkSXRlcmF0b3JFcnJvciA9IHRydWU7XG4gICAgICAgICAgICBfaXRlcmF0b3JFcnJvciA9IF9jb250ZXh0LnQwO1xuXG4gICAgICAgICAgY2FzZSAzMzpcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAzMztcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAzNDtcblxuICAgICAgICAgICAgaWYgKCEoIV9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gJiYgX2l0ZXJhdG9yW1wicmV0dXJuXCJdICE9IG51bGwpKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAzODtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAzODtcbiAgICAgICAgICAgIHJldHVybiBfYXdhaXRBc3luY0dlbmVyYXRvcihfaXRlcmF0b3JbXCJyZXR1cm5cIl0oKSk7XG5cbiAgICAgICAgICBjYXNlIDM4OlxuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDM4O1xuXG4gICAgICAgICAgICBpZiAoIV9kaWRJdGVyYXRvckVycm9yKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA0MTtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHRocm93IF9pdGVyYXRvckVycm9yO1xuXG4gICAgICAgICAgY2FzZSA0MTpcbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dC5maW5pc2goMzgpO1xuXG4gICAgICAgICAgY2FzZSA0MjpcbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dC5maW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h0Lm5leHQpIHtcbiAgICAgICAgY2FzZSAwOlxuICAgICAgICAgIHRha2UgPSB0cnVlO1xuICAgICAgICAgIGMgPSAwO1xuICAgICAgICAgIF9pdGVyYXRvciA9IF9jcmVhdGVGb3JPZkl0ZXJhdG9ySGVscGVyKHNvdXJjZSk7XG4gICAgICAgICAgX2NvbnRleHQucHJldiA9IDM7XG5cbiAgICAgICAgICBfaXRlcmF0b3IucygpO1xuXG4gICAgICAgIGNhc2UgNTpcbiAgICAgICAgICBpZiAoKF9zdGVwID0gX2l0ZXJhdG9yLm4oKSkuZG9uZSkge1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDE2O1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgdmFsdWUgPSBfc3RlcC52YWx1ZTtcbiAgICAgICAgICB0YWtlID0gcHJlZGljYXRlKHZhbHVlLCBjKyspO1xuXG4gICAgICAgICAgaWYgKCF0YWtlKSB7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTM7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgICB9XG5cbiAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTE7XG4gICAgICAgICAgcmV0dXJuIHZhbHVlO1xuXG4gICAgICAgIGNhc2UgMTE6XG4gICAgICAgICAgX2NvbnRleHQubmV4dCA9IDE0O1xuICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgIGNhc2UgMTM6XG4gICAgICAgICAgcmV0dXJuIF9jb250ZXh0LmFicnVwdChcImJyZWFrXCIsIDE2KTtcblxuICAgICAgICBjYXNlIDE0OlxuICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA1O1xuICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgIGNhc2UgMTY6XG4gICAgICAgICAgX2NvbnRleHQubmV4dCA9IDIxO1xuICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgIGNhc2UgMTg6XG4gICAgICAgICAgX2NvbnRleHQucHJ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bENvbXBsZXRpb24gPSB0cnVlO1xuICAgICAgICAgICAgX2RpZEl0ZXJhdG9yRXJyb3IgPSBmYWxzZTtcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSA1O1xuICAgICAgICAgICAgX2l0ZXJhdG9yID0gX2FzeW5jSXRlcmF0b3IoaXRlcmFibGUpO1xuXG4gICAgICAgICAgY2FzZSA3OlxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDk7XG4gICAgICAgICAgICByZXR1cm4gX2F3YWl0QXN5bmNHZW5lcmF0b3IoX2l0ZXJhdG9yLm5leHQoKSk7XG5cbiAgICAgICAgICBjYXNlIDk6XG4gICAgICAgICAgICBfc3RlcCA9IF9jb250ZXh0LnNlbnQ7XG4gICAgICAgICAgICBfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uID0gX3N0ZXAuZG9uZTtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxMztcbiAgICAgICAgICAgIHJldHVybiBfYXdhaXRBc3luY0dlbmVyYXRvcihfc3RlcC52YWx1ZSk7XG5cbiAgICAgICAgICBjYXNlIDEzOlxuICAgICAgICAgICAgX3ZhbHVlID0gX2NvbnRleHQuc2VudDtcblxuICAgICAgICAgICAgaWYgKF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24pIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDIzO1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdmFsdWUgPSBfdmFsdWU7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTg7XG4gICAgICAgICAgICByZXR1cm4gdmFsdWU7XG5cbiAgICAgICAgICBjYXNlIDE4OlxuICAgICAgICAgICAgaWYgKCEoKytpID09PSBuKSkge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMjA7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuYWJydXB0KFwiYnJlYWtcIiwgMjMpO1xuXG4gICAgICAgICAgY2FzZSAyMDpcbiAgICAgICAgICAgIF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gPSB0cnVlO1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDc7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgIGNhc2UgMjM6XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMjk7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgIGNhc2UgMjU6XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMjU7XG4gICAgICAgICAgICBfY29udGV4dC50MCA9IF9jb250ZXh0W1wiY2F0Y2hcIl0oNSk7XG4gICAgICAgICAgICBfZGlkSXRlcmF0b3JFcnJvciA9IHRydWU7XG4gICAgICAgICAgICBfaXRlcmF0b3JFcnJvciA9IF9jb250ZXh0LnQwO1xuXG4gICAgICAgICAgY2FzZSAyOTpcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAyOTtcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAzMDtcblxuICAgICAgICAgICAgaWYgKCEoIV9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gJiYgX2l0ZXJhdG9yW1wicmV0dXJuXCJdICE9IG51bGwpKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAzNDtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAzNDtcbiAgICAgICAgICAgIHJldHVybiBfYXdhaXRBc3luY0dlbmVyYXRvcihfaXRlcmF0b3JbXCJyZXR1cm5cIl0oKSk7XG5cbiAgICAgICAgICBjYXNlIDM0OlxuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDM0O1xuXG4gICAgICAgICAgICBpZiAoIV9kaWRJdGVyYXRvckVycm9yKSB7XG4g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HZhciBpLCBfaXRlcmF0b3IsIF9zdGVwLCB2YWx1ZTtcblxuICByZXR1cm4gX3JlZ2VuZXJhdG9yUnVudGltZS53cmFwKGZ1bmN0aW9uIF9fdGFrZSQoX2NvbnRleHQpIHtcbiAgICB3aGlsZSAoMSkge1xuICAgICAgc3dpdGNoIChfY29udGV4dC5wcmV2ID0gX2NvbnRleHQubmV4dCkge1xuICAgICAgICBjYXNlIDA6XG4gICAgICAgICAgaWYgKCEobiA9PT0gMCkpIHtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyO1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgcmV0dXJuIF9jb250ZXh0LmFicnVwdChcInJldHVyblwiKTtcblxuICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgaSA9IDA7XG4gICAgICAgICAgX2l0ZXJhdG9yID0gX2NyZWF0ZUZvck9mSXRlcmF0b3JIZWxwZXIoaXRlcmFibGUpO1xuICAgICAgICAgIF9jb250ZXh0LnByZXYgPSA0O1xuXG4gICAgICAgICAgX2l0ZXJhdG9yLnMoKTtcblxuICAgICAgICBjYXNlIDY6XG4gICAgICAgICAgaWYgKChfc3RlcCA9IF9pdGVyYXRvci5uKCkpLmRvbmUpIHtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxNDtcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIHZhbHVlID0gX3N0ZXAudmFsdWU7XG4gICAgICAgICAgX2NvbnRleHQubmV4dCA9IDEwO1xuICAgICAgICAgIHJldHVybiB2YWx1ZTtcblxuICAgICAgICBjYXNlIDEwOlxuICAgICAgICAgIGlmICghKCsraSA9PT0gbikpIHtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxMjtcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIHJldHVybiBfY29udGV4dC5hYnJ1cHQoXCJicmVha1wiLCAxNCk7XG5cbiAgICAgICAgY2FzZSAxMjpcbiAgICAgICAgICBfY29udGV4dC5uZXh0ID0gNjtcbiAgICAgICAgICBicmVhaztcblxuICAgICAgICBjYXNlIDE0OlxuICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxOTtcbiAgICAgICAgICBicmVhaztcblxuICAgICAgICBjYXNlIDE2OlxuICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAxNjtcbiAgICAgICAgICBfY29udGV4dC50MCA9IF9jb250ZXh0W1wiY2F0Y2hcIl0oNCk7XG5cbiAgICAgICAgICBfaXRlcmF0b3IuZShfY29udGV4dC50MCk7XG5cbiAgICAgICAgY2FzZSAxOTpcbiAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMTk7XG5cbiAgICAgICAgICBfaXRlcmF0b3IuZigpO1xuXG4gICAgICAgICAgcmV0dXJuIF9jb250ZXh0LmZpbmlzaCgxOSk7XG5cbiAgICAgICAgY2FzZSAyMjpcbiAgICAgICAgY2FzZSBcImVuZFwiOlxuICAgICAgICAgIHJldHVybiBfY29udGV4dC5zdG9wKCk7XG4gICAgICB9XG4gICAgfVxuICB9LCBfbWFya2VkLCBudWxsLCBbWzQsIDE2LCAxOSwgMjJdXSk7XG59XG5cbmV4cG9ydHMuX190YWtlID0gX190YWtlO1xudmFyIHRha2UgPSAvKiNfX1BVUkVfXyovaXRlcmFibGVDdXJyeShfX3Rha2UpO1xuZXhwb3J0cy50YWtlID0gdGFrZTsiLCJ2YXIgX3JlZ2VuZXJhdG9yUnVudGltZSA9IHJlcXVpcmUoXCJAYmFiZWwvcnVudGltZS9yZWdlbmVyYXRvclwiKTtcblxudmFyIF9hd2FpdEFzeW5jR2VuZXJhdG9yID0gcmVxdWlyZShcIkBiYWJlbC9ydW50aW1lL2hlbHBlcnMvYXdhaXRBc3luY0dlbmVyYXRvclwiKTtcblxudmFyIF93cmFwQXN5bmNHZW5lcmF0b3IgPSByZXF1aXJlKFwiQGJhYmVsL3J1bnR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VlO1xuICAgICAgICAgICAgX2RpZEl0ZXJhdG9yRXJyb3IgPSBmYWxzZTtcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAzO1xuICAgICAgICAgICAgX2l0ZXJhdG9yID0gX2FzeW5jSXRlcmF0b3Ioc291cmNlKTtcblxuICAgICAgICAgIGNhc2UgNTpcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA3O1xuICAgICAgICAgICAgcmV0dXJuIF9hd2FpdEFzeW5jR2VuZXJhdG9yKF9pdGVyYXRvci5uZXh0KCkpO1xuXG4gICAgICAgICAgY2FzZSA3OlxuICAgICAgICAgICAgX3N0ZXAgPSBfY29udGV4dC5zZW50O1xuICAgICAgICAgICAgX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiA9IF9zdGVwLmRvbmU7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTE7XG4gICAgICAgICAgICByZXR1cm4gX2F3YWl0QXN5bmNHZW5lcmF0b3IoX3N0ZXAudmFsdWUpO1xuXG4gICAgICAgICAgY2FzZSAxMTpcbiAgICAgICAgICAgIF92YWx1ZSA9IF9jb250ZXh0LnNlbnQ7XG5cbiAgICAgICAgICAgIGlmIChfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyMDtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHZhbHVlID0gX3ZhbHVlO1xuICAgICAgICAgICAgY2FsbGJhY2sodmFsdWUsIGMrKyk7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTc7XG4gICAgICAgICAgICByZXR1cm4gdmFsdWU7XG5cbiAgICAgICAgICBjYXNlIDE3OlxuICAgICAgICAgICAgX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiA9IHRydWU7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gNTtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSAyMDpcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyNjtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSAyMjpcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAyMjtcbiAgICAgICAgICAgIF9jb250ZXh0LnQwID0gX2NvbnRleHRbXCJjYXRjaFwiXSgzKTtcbiAgICAgICAgICAgIF9kaWRJdGVyYXRvckVycm9yID0gdHJ1ZTtcbiAgICAgICAgICAgIF9pdGVyYXRvckVycm9yID0gX2NvbnRleHQudDA7XG5cbiAgICAgICAgICBjYXNlIDI2OlxuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDI2O1xuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDI3O1xuXG4gICAgICAgICAgICBpZiAoISghX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiAmJiBfaXRlcmF0b3JbXCJyZXR1cm5cIl0gIT0gbnVsbCkpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDMxO1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDMxO1xuICAgICAgICAgICAgcmV0dXJuIF9hd2FpdEFzeW5jR2VuZXJhdG9yKF9pdGVyYXRvcltcInJldHVyblwiXSgpKTtcblxuICAgICAgICAgIGNhc2UgMzE6XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMzE7XG5cbiAgICAgICAgICAgIGlmICghX2RpZEl0ZXJhdG9yRXJyb3IpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDM0O1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdGhyb3cgX2l0ZXJhdG9yRXJyb3I7XG5cbiAgICAgICAgICBjYXNlIDM0OlxuICAgICAgICAgICAgcmV0dXJ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b250ZXh0LnByZXYgPSBfY29udGV4dC5uZXh0KSB7XG4gICAgICAgIGNhc2UgMDpcbiAgICAgICAgICBjID0gMDtcbiAgICAgICAgICBfaXRlcmF0b3IgPSBfY3JlYXRlRm9yT2ZJdGVyYXRvckhlbHBlcihzb3VyY2UpO1xuICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAyO1xuXG4gICAgICAgICAgX2l0ZXJhdG9yLnMoKTtcblxuICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgaWYgKChfc3RlcCA9IF9pdGVyYXRvci5uKCkpLmRvbmUpIHtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxMTtcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIHZhbHVlID0gX3N0ZXAudmFsdWU7XG4gICAgICAgICAgY2FsbGJhY2sodmFsdWUsIGMrKyk7XG4gICAgICAgICAgX2NvbnRleHQubmV4dCA9IDk7XG4gICAgICAgICAgcmV0dXJuIHZhbHVlO1xuXG4gICAgICAgIGNhc2UgOTpcbiAgICAgICAgICBfY29udGV4dC5uZXh0ID0gNDtcbiAgICAgICAgICBicmVhaztcblxuICAgICAgICBjYXNlIDExOlxuICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxNjtcbiAgICAgICAgICBicmVhaztcblxuICAgICAgICBjYXNlIDEzOlxuICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAxMztcbiAgICAgICAgICBfY29udGV4dC50MCA9IF9jb250ZXh0W1wiY2F0Y2hcIl0oMik7XG5cbiAgICAgICAgICBfaXRlcmF0b3IuZShfY29udGV4dC50MCk7XG5cbiAgICAgICAgY2FzZSAxNjpcbiAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMTY7XG5cbiAgICAgICAgICBfaXRlcmF0b3IuZigpO1xuXG4gICAgICAgICAgcmV0dXJuIF9jb250ZXh0LmZpbmlzaCgxNik7XG5cbiAgICAgICAgY2FzZSAxOTpcbiAgICAgICAgY2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9yRXJyb3IsIF9pdGVyYXRvckVycm9yLCBfaXRlcmF0b3IsIF9zdGVwLCBfdmFsdWUsIHZhbHVlO1xuXG4gICAgcmV0dXJuIF9yZWdlbmVyYXRvclJ1bnRpbWUud3JhcChmdW5jdGlvbiBfY2FsbGVlJChfY29udGV4dCkge1xuICAgICAgd2hpbGUgKDEpIHtcbiAgICAgICAgc3dpdGNoIChfY29udGV4dC5wcmV2ID0gX2NvbnRleHQubmV4dCkge1xuICAgICAgICAgIGNhc2UgMDpcbiAgICAgICAgICAgIG91dCA9IFtdO1xuICAgICAgICAgICAgX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiA9IHRydWU7XG4gICAgICAgICAgICBfZGlkSXRlcmF0b3JFcnJvciA9IGZhbHNlO1xuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDM7XG4gICAgICAgICAgICBfaXRlcmF0b3IgPSBfYXN5bmNJdGVyYXRvcihzb3VyY2UpO1xuXG4gICAgICAgICAgY2FzZSA1OlxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDc7XG4gICAgICAgICAgICByZXR1cm4gX2l0ZXJhdG9yLm5leHQoKTtcblxuICAgICAgICAgIGNhc2UgNzpcbiAgICAgICAgICAgIF9zdGVwID0gX2NvbnRleHQuc2VudDtcbiAgICAgICAgICAgIF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gPSBfc3RlcC5kb25lO1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDExO1xuICAgICAgICAgICAgcmV0dXJuIF9zdGVwLnZhbHVlO1xuXG4gICAgICAgICAgY2FzZSAxMTpcbiAgICAgICAgICAgIF92YWx1ZSA9IF9jb250ZXh0LnNlbnQ7XG5cbiAgICAgICAgICAgIGlmIChfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxODtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHZhbHVlID0gX3ZhbHVlO1xuICAgICAgICAgICAgb3V0LnB1c2godmFsdWUpO1xuXG4gICAgICAgICAgY2FzZSAxNTpcbiAgICAgICAgICAgIF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gPSB0cnVlO1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDU7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgIGNhc2UgMTg6XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMjQ7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgIGNhc2UgMjA6XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMjA7XG4gICAgICAgICAgICBfY29udGV4dC50MCA9IF9jb250ZXh0W1wiY2F0Y2hcIl0oMyk7XG4gICAgICAgICAgICBfZGlkSXRlcmF0b3JFcnJvciA9IHRydWU7XG4gICAgICAgICAgICBfaXRlcmF0b3JFcnJvciA9IF9jb250ZXh0LnQwO1xuXG4gICAgICAgICAgY2FzZSAyNDpcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAyNDtcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAyNTtcblxuICAgICAgICAgICAgaWYgKCEoIV9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gJiYgX2l0ZXJhdG9yW1wicmV0dXJuXCJdICE9IG51bGwpKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyOTtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyOTtcbiAgICAgICAgICAgIHJldHVybiBfaXRlcmF0b3JbXCJyZXR1cm5cIl0oKTtcblxuICAgICAgICAgIGNhc2UgMjk6XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMjk7XG5cbiAgICAgICAgICAgIGlmICghX2RpZEl0ZXJhdG9yRXJyb3IpIHtcbiAgICA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C5wcm90b3R5cGU7XG4gICAgICAgICAgICBvYmogPSBPYmplY3QuY3JlYXRlKHByb3RvKTtcbiAgICAgICAgICAgIF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gPSB0cnVlO1xuICAgICAgICAgICAgX2RpZEl0ZXJhdG9yRXJyb3IgPSBmYWxzZTtcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSA0O1xuICAgICAgICAgICAgX2l0ZXJhdG9yID0gX2FzeW5jSXRlcmF0b3IoaXRlcmFibGUpO1xuXG4gICAgICAgICAgY2FzZSA2OlxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDg7XG4gICAgICAgICAgICByZXR1cm4gX2l0ZXJhdG9yLm5leHQoKTtcblxuICAgICAgICAgIGNhc2UgODpcbiAgICAgICAgICAgIF9zdGVwID0gX2NvbnRleHQuc2VudDtcbiAgICAgICAgICAgIF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gPSBfc3RlcC5kb25lO1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDEyO1xuICAgICAgICAgICAgcmV0dXJuIF9zdGVwLnZhbHVlO1xuXG4gICAgICAgICAgY2FzZSAxMjpcbiAgICAgICAgICAgIF92YWx1ZSA9IF9jb250ZXh0LnNlbnQ7XG5cbiAgICAgICAgICAgIGlmIChfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxOTtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIF92YWx1ZTIgPSBfdmFsdWUsIF92YWx1ZTMgPSBfc2xpY2VkVG9BcnJheShfdmFsdWUyLCAyKSwga2V5ID0gX3ZhbHVlM1swXSwgdmFsdWUgPSBfdmFsdWUzWzFdO1xuICAgICAgICAgICAgb2JqW2tleV0gPSB2YWx1ZTtcblxuICAgICAgICAgIGNhc2UgMTY6XG4gICAgICAgICAgICBfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uID0gdHJ1ZTtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA2O1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICBjYXNlIDE5OlxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDI1O1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICBjYXNlIDIxOlxuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDIxO1xuICAgICAgICAgICAgX2NvbnRleHQudDAgPSBfY29udGV4dFtcImNhdGNoXCJdKDQpO1xuICAgICAgICAgICAgX2RpZEl0ZXJhdG9yRXJyb3IgPSB0cnVlO1xuICAgICAgICAgICAgX2l0ZXJhdG9yRXJyb3IgPSBfY29udGV4dC50MDtcblxuICAgICAgICAgIGNhc2UgMjU6XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMjU7XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMjY7XG5cbiAgICAgICAgICAgIGlmICghKCFfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uICYmIF9pdGVyYXRvcltcInJldHVyblwiXSAhPSBudWxsKSkge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMzA7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMzA7XG4gICAgICAgICAgICByZXR1cm4gX2l0ZXJhdG9yW1wicmV0dXJuXCJdKCk7XG5cbiAgICAgICAgICBjYXNlIDMwOlxuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDMwO1xuXG4gICAgICAgICAgICBpZiAoIV9kaWRJdGVyYXRvckVycm9yKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAzMztcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHRocm93IF9pdGVyYXRvckVycm9yO1xuX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ZXcgQ2lyY3VsYXJCdWZmZXIoc2l6ZSk7XG4gICAgICAgICAgICBidWZmZXJSZWFkUHJveHkgPSBuZXcgUmVhZE9ubHlDaXJjdWxhckJ1ZmZlcihidWZmZXIpO1xuICAgICAgICAgICAgbGVuID0gMDtcbiAgICAgICAgICAgIF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gPSB0cnVlO1xuICAgICAgICAgICAgX2RpZEl0ZXJhdG9yRXJyb3IgPSBmYWxzZTtcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSA2O1xuICAgICAgICAgICAgX2l0ZXJhdG9yID0gX2FzeW5jSXRlcmF0b3Ioc291cmNlKTtcblxuICAgICAgICAgIGNhc2UgODpcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxMDtcbiAgICAgICAgICAgIHJldHVybiBfYXdhaXRBc3luY0dlbmVyYXRvcihfaXRlcmF0b3IubmV4dCgpKTtcblxuICAgICAgICAgIGNhc2UgMTA6XG4gICAgICAgICAgICBfc3RlcCA9IF9jb250ZXh0LnNlbnQ7XG4gICAgICAgICAgICBfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uID0gX3N0ZXAuZG9uZTtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxNDtcbiAgICAgICAgICAgIHJldHVybiBfYXdhaXRBc3luY0dlbmVyYXRvcihfc3RlcC52YWx1ZSk7XG5cbiAgICAgICAgICBjYXNlIDE0OlxuICAgICAgICAgICAgX3ZhbHVlID0gX2NvbnRleHQuc2VudDtcblxuICAgICAgICAgICAgaWYgKF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24pIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDI1O1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdmFsdWUgPSBfdmFsdWU7XG4gICAgICAgICAgICBidWZmZXIucHVzaCh2YWx1ZSk7XG5cbiAgICAgICAgICAgIGlmICghYnVmZmVyLmlzRnVsbCgpKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyMTtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyMTtcbiAgICAgICAgICAgIHJldHVybiBidWZmZXJSZWFkUHJveHk7XG5cbiAgICAgICAgICBjYXNlIDIxOlxuICAgICAgICAgICAgbGVuKys7XG5cbiAgICAgICAgICBjYXNlIDIyOlxuICAgICAgICAgICAgX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiA9IHRydWU7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gODtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSAyNTpcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAzMTtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSAyNzpcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAyNztcbiAgICAgICAgICAgIF9jb250ZXh0LnQwID0gX2NvbnRleHRbXCJjYXRjaFwiXSg2KTtcbiAgICAgICAgICAgIF9kaWRJdGVyYXRvckVycm9yID0gdHJ1ZTtcbiAgICAgICAgICAgIF9pdGVyYXRvckVycm9yID0gX2NvbnRleHQudDA7XG5cbiAgICAgICAgICBjYXNlIDMxOlxuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDMxO1xuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDMyO1xuXG4gICAgICAgICAgICBpZiAoISghX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiAmJiBfaXRlcmF0b3JbXCJyZXR1cm5cIl0gIT0gbnVsbCkpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDM2O1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDM2O1xuICAgICAgICAgICAgcmV0dXJuIF9hd2FpdEFzeW5jR2VuZXJhdG9yKF9pdGVyYXRvcltcInJldHVyblwiXSgpKTtcblxuICAgICAgICAgIGNhc2UgMzY6XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMzY7XG5cbiAgICAgICAgICAgIGlmICghX2RpZEl0ZXJhdG9yRXJyb3IpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDM5O1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdGhyb3cgX2l0ZXJhdG9yRXJyb3I7XG5cbiAgICAgICAgICBjYXNlIDM5OlxuICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0LmZpbmlzaCgzNik7XG5cbiAgICAgICAgICBjYXNlIDQwOlxuICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0LmZpbmlzaCgzMSk7XG5cbiAgICAgICAgICBjYXNlIDQxOlxuICAgICAgICAgICAgaWYgKHVzZUZpbGxlcikge1xuICAgICAgICAgICAgICBmb3IgKGkgPSBsZW47IGkgPCBzaXplOyBpKyspIHtcbiAgICAgICAgICAgICAgICBidWZmZXIucHVzaChmaWxsZXIpO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmICghKGxlbiA+IDAgJiYgbGVuIDwgc2l6ZSkpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDQ1O1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDQ1O1xuICAgICAgICAgICAgcmV0dXJuIGJ1ZmZlclJlYWRQcm94eTtcblxuICAgICAgICAgIGNhc2UgNDU6XG4gICAgICAgICAgICBfaSA9IDA7XG5cbiAgICAgICAgICBjYXNlIDQ2OlxuICAgICAgICAgICAgaWYgKCEoX2kgPCBNYXRoLm1pbihzaXplLCBsZW4pIC0gMSkpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDU0O1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgYnVmZmVyLnNoaWZ0KCk7XG5cbiAgICAgICAgICAgIGlmICh1c2VGaWxsZXIpIHtcbiAgICAgICAgICAgICAgYnVmZmVyLnB1c2goZmlsbGVyKTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDUxO1xuICAgICAgICAgICAgcmV0dXJuIGJ1ZmZlclJlYWRQcm94eTtcblxuICAgICAgICAgIGNhc2UgNTE6XG4gICAgICAgICAgICBfaSsrO1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDQ2O1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICBjYXNlIDU0OlxuICAgICAgICAgIGNhc2UgXCJlbmRcIjpcbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dC5zdG9wKCk7XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICB9LCBfY2FsbGVlLCBudWxsLCBbWzYsIDI3LCAzMSwgNDFdLCBbMzIsLCAzNiwgNDBdXSk7XG4gIH0pKTtcbiAgcmV0dXJuIF9hc3luY1dpbmRvd0FoZWFkLmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7XG59XG5cbnZhciBhc3luY1dpbmRvd0FoZWFkID0gLyojX19QVVJFX18qL2FzeW5jSXRlcmFibGVDdXJyeShfX2FzeW5jV2luZG93QWhlYWQsIHtcbiAgbWluQXJnczogMSxcbiAgbWF4QXJnczogMixcbiAgdmFsaWRhdGVBcmdzOiBmdW5jdGlvbiB2YWxpZGF0ZUFyZ3MoYXJncykge1xuICAgIGlmICh0eXBlb2YgYXJnc1sxXSAhPT0gJ251bWJlcicpIHtcbiAgICAgIHRocm93IG5ldyBFcnJvcignYXN5bmNXaW5kb3dBaGVhZCcuY29uY2F0KFwiIG11c3QgYmUgcGFzc2VkIGEgb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5wdXNoKHZhbHVlKTtcblxuICAgICAgICAgIGlmICghYnVmZmVyLmlzRnVsbCgpKSB7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTM7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgICB9XG5cbiAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTM7XG4gICAgICAgICAgcmV0dXJuIGJ1ZmZlclJlYWRQcm94eTtcblxuICAgICAgICBjYXNlIDEzOlxuICAgICAgICAgIGxlbisrO1xuXG4gICAgICAgIGNhc2UgMTQ6XG4gICAgICAgICAgX2NvbnRleHQubmV4dCA9IDc7XG4gICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgY2FzZSAxNjpcbiAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMjE7XG4gICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgY2FzZSAxODpcbiAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMTg7XG4gICAgICAgICAgX2NvbnRleHQudDAgPSBfY29udGV4dFtcImNhdGNoXCJdKDUpO1xuXG4gICAgICAgICAgX2l0ZXJhdG9yLmUoX2NvbnRleHQudDApO1xuXG4gICAgICAgIGNhc2UgMjE6XG4gICAgICAgICAgX2NvbnRleHQucHJldiA9IDIxO1xuXG4gICAgICAgICAgX2l0ZXJhdG9yLmYoKTtcblxuICAgICAgICAgIHJldHVybiBfY29udGV4dC5maW5pc2goMjEpO1xuXG4gICAgICAgIGNhc2UgMjQ6XG4gICAgICAgICAgaWYgKHVzZUZpbGxlcikge1xuICAgICAgICAgICAgZm9yIChpID0gbGVuOyBpIDwgc2l6ZTsgaSsrKSB7XG4gICAgICAgICAgICAgIGJ1ZmZlci5wdXNoKGZpbGxlcik7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgaWYgKCEobGVuID4gMCAmJiBsZW4gPCBzaXplKSkge1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDI4O1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgX2NvbnRleHQubmV4dCA9IDI4O1xuICAgICAgICAgIHJldHVybiBidWZmZXJSZWFkUHJveHk7XG5cbiAgICAgICAgY2FzZSAyODpcbiAgICAgICAgICBfaSA9IDA7XG5cbiAgICAgICAgY2FzZSAyOTpcbiAgICAgICAgICBpZiAoIShfaSA8IE1hdGgubWluKHNpemUsIGxlbikgLSAxKSkge1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDM3O1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgYnVmZmVyLnNoaWZ0KCk7XG5cbiAgICAgICAgICBpZiAodXNlRmlsbGVyKSB7XG4gICAgICAgICAgICBidWZmZXIucHVzaChmaWxsZXIpO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAzNDtcbiAgICAgICAgICByZXR1cm4gYnVmZmVyUmVhZFByb3h5O1xuXG4gICAgICAgIGNhc2UgMzQ6XG4gICAgICAgICAgX2krKztcbiAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMjk7XG4gICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgY2FzZSAzNzpcbiAgICAgICAgY2FzZSBcImVuZFwiOlxuICAgICAgICAgIHJldHVybiBfY29udGV4dC5zdG9wKCk7XG4gICAgICB9XG4gICAgfVxuICB9LCBfbWFya2VkLCBudWxsLCBbWzUsIDE4LCAyMSwgMjRdXSk7XG59XG5cbmV4cG9ydHMuX193aW5kb3dBaGVhZCA9IF9fd2luZG93QWhlYWQ7XG52YXIgd2luZG93QWhlYWQgPSAvKiNfX1BVUkVfXyovaXRlcmFibGVDdXJyeShfX3dpbmRvd0FoZWFkLCB7XG4gIG1pbkFyZ3M6IDEsXG4gIG1heEFyZ3M6IDIsXG4gIHZhbGlkYXRlQXJnczogZnVuY3Rpb24gdmFsaWRhdGVBcmdzKGFyZ3MpIHtcbiAgICBpZiAodHlwZW9mI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NpemUpO1xuICAgICAgICAgICAgYnVmZmVyUmVhZFByb3h5ID0gbmV3IFJlYWRPbmx5Q2lyY3VsYXJCdWZmZXIoYnVmZmVyKTtcbiAgICAgICAgICAgIGJ1ZmZlci5maWxsKGZpbGxlcik7XG4gICAgICAgICAgICBfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uID0gdHJ1ZTtcbiAgICAgICAgICAgIF9kaWRJdGVyYXRvckVycm9yID0gZmFsc2U7XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gNjtcbiAgICAgICAgICAgIF9pdGVyYXRvciA9IF9hc3luY0l0ZXJhdG9yKHNvdXJjZSk7XG5cbiAgICAgICAgICBjYXNlIDg6XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTA7XG4gICAgICAgICAgICByZXR1cm4gX2F3YWl0QXN5bmNHZW5lcmF0b3IoX2l0ZXJhdG9yLm5leHQoKSk7XG5cbiAgICAgICAgICBjYXNlIDEwOlxuICAgICAgICAgICAgX3N0ZXAgPSBfY29udGV4dC5zZW50O1xuICAgICAgICAgICAgX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiA9IF9zdGVwLmRvbmU7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTQ7XG4gICAgICAgICAgICByZXR1cm4gX2F3YWl0QXN5bmNHZW5lcmF0b3IoX3N0ZXAudmFsdWUpO1xuXG4gICAgICAgICAgY2FzZSAxNDpcbiAgICAgICAgICAgIF92YWx1ZSA9IF9jb250ZXh0LnNlbnQ7XG5cbiAgICAgICAgICAgIGlmIChfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyMztcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHZhbHVlID0gX3ZhbHVlO1xuICAgICAgICAgICAgYnVmZmVyLnB1c2godmFsdWUpO1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDIwO1xuICAgICAgICAgICAgcmV0dXJuIGJ1ZmZlclJlYWRQcm94eTtcblxuICAgICAgICAgIGNhc2UgMjA6XG4gICAgICAgICAgICBfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uID0gdHJ1ZTtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA4O1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICBjYXNlIDIzOlxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDI5O1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICBjYXNlIDI1OlxuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDI1O1xuICAgICAgICAgICAgX2NvbnRleHQudDAgPSBfY29udGV4dFtcImNhdGNoXCJdKDYpO1xuICAgICAgICAgICAgX2RpZEl0ZXJhdG9yRXJyb3IgPSB0cnVlO1xuICAgICAgICAgICAgX2l0ZXJhdG9yRXJyb3IgPSBfY29udGV4dC50MDtcblxuICAgICAgICAgIGNhc2UgMjk6XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMjk7XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMzA7XG5cbiAgICAgICAgICAgIGlmICghKCFfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uICYmIF9pdGVyYXRvcltcInJldHVyblwiXSAhPSBudWxsKSkge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMzQ7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMzQ7XG4gICAgICAgICAgICByZXR1cm4gX2F3YWl0QXN5bmNHZW5lcmF0b3IoX2l0ZXJhdG9yW1wicmV0dXJuXCJdKCkpO1xuXG4gICAgICAgICAgY2FzZSAzNDpcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAzNDtcblxuICAgICAgICAgICAgaWYgKCFfZGl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IHVuZGVmaW5lZCA/IF9hcmdzWzJdIDoge30sIGZpbGxlciA9IF9yZWYuZmlsbGVyO1xuICAgICAgICAgIGJ1ZmZlciA9IG5ldyBDaXJjdWxhckJ1ZmZlcihzaXplKTtcbiAgICAgICAgICBidWZmZXJSZWFkUHJveHkgPSBuZXcgUmVhZE9ubHlDaXJjdWxhckJ1ZmZlcihidWZmZXIpO1xuICAgICAgICAgIGJ1ZmZlci5maWxsKGZpbGxlcik7XG4gICAgICAgICAgX2l0ZXJhdG9yID0gX2NyZWF0ZUZvck9mSXRlcmF0b3JIZWxwZXIoc291cmNlKTtcbiAgICAgICAgICBfY29udGV4dC5wcmV2ID0gNTtcblxuICAgICAgICAgIF9pdGVyYXRvci5zKCk7XG5cbiAgICAgICAgY2FzZSA3OlxuICAgICAgICAgIGlmICgoX3N0ZXAgPSBfaXRlcmF0b3IubigpKS5kb25lKSB7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTQ7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgICB9XG5cbiAgICAgICAgICB2YWx1ZSA9IF9zdGVwLnZhbHVlO1xuICAgICAgICAgIGJ1ZmZlci5wdXNoKHZhbHVlKTtcbiAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTI7XG4gICAgICAgICAgcmV0dXJuIGJ1ZmZlclJlYWRQcm94eTtcblxuICAgICAgICBjYXNlIDEyOlxuICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA3O1xuICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgIGNhc2UgMTQ6XG4gICAgICAgICAgX2NvbnRleHQubmV4dCA9IDE5O1xuICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgIGNhc2UgMTY6XG4gICAgICAgICAgX2NvbnRleHQucHJldiA9IDE2O1xuICAgICAgICAgIF9jb250ZXh0LnQwID0gX2NvbnRleHRbXCJjYXRjaFwiXSg1KTtcblxuICAgICAgICAgIF9pdGVyYXRvci5lKF9jb250ZXh0LnQwK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gICAgIGlmIChfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyMjtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHZhbHVlID0gX3ZhbHVlO1xuICAgICAgICAgICAgYnVmZmVyLnB1c2godmFsdWUpO1xuXG4gICAgICAgICAgICBpZiAoIWJ1ZmZlci5pc0Z1bGwoKSkge1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTk7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTk7XG4gICAgICAgICAgICByZXR1cm4gYnVmZmVyUmVhZFByb3h5O1xuXG4gICAgICAgICAgY2FzZSAxOTpcbiAgICAgICAgICAgIF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gPSB0cnVlO1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDY7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgIGNhc2UgMjI6XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMjg7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgIGNhc2UgMjQ6XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMjQ7XG4gICAgICAgICAgICBfY29udGV4dC50MCA9IF9jb250ZXh0W1wiY2F0Y2hcIl0oNCk7XG4gICAgICAgICAgICBfZGlkSXRlcmF0b3JFcnJvciA9IHRydWU7XG4gICAgICAgICAgICBfaXRlcmF0b3JFcnJvciA9IF9jb250ZXh0LnQwO1xuXG4gICAgICAgICAgY2FzZSAyODpcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAyODtcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAyOTtcblxuICAgICAgICAgICAgaWYgKCEoIV9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gJiYgX2l0ZXJhdG9yW1wicmV0dXJuXCJdICE9IG51bGwpKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAzMztcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAzMztcbiAgICAgICAgICAgIHJldHVybiBfYXdhaXRBc3luY0dlbmVyYXRvcihfaXRlcmF0b3JbXCJyZXR1cm5cIl0oKSk7XG5cbiAgICAgICAgICBjYXNlIDMzOlxuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDMzO1xuXG4gICAgICAgICAgICBpZiAoIV9kaWRJdGVyYXRvckVycm9yKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAzNjtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHRocm93IF9pdGVyYXRvckVycm9yO1xuXG4gICAgICAgICAgY2FzZSAzNjpcbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dC5maW5pc2goMzMpO1xuXG4gICAgICAgICAgY2FzZSAzNzpcbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dC5maW5pc2goMjgpO1xuXG4gICAgICAgICAgY2FzZSAzODpcbiAgICAgICAgICBjYXNlIFwiZW5kXCI6XG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuc3RvcCgpO1xuICAgICAgICB9XG4gICAgICB9XG4gICAgfSwgX2NhbGxlZSwgbnVsbCwgW1s0LCAyNCwgMjgsIDM4XSwgWzI5LCwgMzMsIDM3XV0pO1xuICB9KSk7XG4gIHJldHVybiBfYXN5bmNXaW5kb3cuYXBwbHkodGhpcywgYXJndW1lbnRzKTtcbn1cblxudmFyIGFzeW5jV2luZG93ID0gLyojX19QVVJFX18qL2FzeW5jSXRlcmFibGVDdXJyeShfX2FzeW5jV2luZG93LCB7XG4gIHZhbGlkYXRlQXJnczogZnVuY3Rpb24gdmF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XRjaCAoX2NvbnRleHQucHJldiA9IF9jb250ZXh0Lm5leHQpIHtcbiAgICAgICAgY2FzZSAwOlxuICAgICAgICAgIGJ1ZmZlciA9IG5ldyBDaXJjdWxhckJ1ZmZlcihzaXplKTtcbiAgICAgICAgICBidWZmZXJSZWFkUHJveHkgPSBuZXcgUmVhZE9ubHlDaXJjdWxhckJ1ZmZlcihidWZmZXIpO1xuICAgICAgICAgIF9pdGVyYXRvciA9IF9jcmVhdGVGb3JPZkl0ZXJhdG9ySGVscGVyKHNvdXJjZSk7XG4gICAgICAgICAgX2NvbnRleHQucHJldiA9IDM7XG5cbiAgICAgICAgICBfaXRlcmF0b3IucygpO1xuXG4gICAgICAgIGNhc2UgNTpcbiAgICAgICAgICBpZiAoKF9zdGVwID0gX2l0ZXJhdG9yLm4oKSkuZG9uZSkge1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDEzO1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgdmFsdWUgPSBfc3RlcC52YWx1ZTtcbiAgICAgICAgICBidWZmZXIucHVzaCh2YWx1ZSk7XG5cbiAgICAgICAgICBpZiAoIWJ1ZmZlci5pc0Z1bGwoKSkge1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDExO1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgX2NvbnRleHQubmV4dCA9IDExO1xuICAgICAgICAgIHJldHVybiBidWZmZXJSZWFkUHJveHk7XG5cbiAgICAgICAgY2FzZSAxMTpcbiAgICAgICAgICBfY29udGV4dC5uZXh0ID0gNTtcbiAgICAgICAgICBicmVhaztcblxuICAgICAgICBjYXNlIDEzOlxuICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxODtcbiAgICAgICAgICBicmVhaztcblxuICAgICAgICBjYXNlIDE1OlxuICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAxNTtcbiAgICAgICAgICBfY29udGV4dC50MCA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lwQWxsID0gX3dyYXBBc3luY0dlbmVyYXRvciggLyojX19QVVJFX18qL19yZWdlbmVyYXRvclJ1bnRpbWUubWFyayhmdW5jdGlvbiBfY2FsbGVlKHNvdXJjZXMpIHtcbiAgICB2YXIgX3JlZixcbiAgICAgICAgZmlsbGVyLFxuICAgICAgICBwZWVrcnMsXG4gICAgICAgIGRvbmUsXG4gICAgICAgIF9hcmdzID0gYXJndW1lbnRzO1xuXG4gICAgcmV0dXJuIF9yZWdlbmVyYXRvclJ1bnRpbWUud3JhcChmdW5jdGlvbiBfY2FsbGVlJChfY29udGV4dCkge1xuICAgICAgd2hpbGUgKDEpIHtcbiAgICAgICAgc3dpdGNoIChfY29udGV4dC5wcmV2ID0gX2NvbnRleHQubmV4dCkge1xuICAgICAgICAgIGNhc2UgMDpcbiAgICAgICAgICAgIF9yZWYgPSBfYXJncy5sZW5ndGggPiAxICYmIF9hcmdzWzFdICE9PSB1bmRlZmluZWQgPyBfYXJnc1sxXSA6IHt9LCBmaWxsZXIgPSBfcmVmLmZpbGxlcjtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAzO1xuICAgICAgICAgICAgcmV0dXJuIF9hd2FpdEFzeW5jR2VuZXJhdG9yKF9fYXN5bmNUb0FycmF5KF9fYXN5bmNNYXAoc291cmNlcywgX19hc3luY1BlZWtlcmF0ZSkpKTtcblxuICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgIHBlZWtycyA9IF9jb250ZXh0LnNlbnQ7XG4gICAgICAgICAgICBkb25lID0gX19ldmVyeShwZWVrcnMsIGlzRG9uZSk7XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gNTtcblxuICAgICAgICAgIGNhc2UgNjpcbiAgICAgICAgICAgIGlmIChkb25lKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxNDtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA5O1xuICAgICAgICAgICAgcmV0dXJuIHBlZWtycy5tYXAoZnVuY3Rpb24gKF9yZWYyKSB7XG4gICAgICAgICAgICAgIHZhciB2YWx1ZSA9IF9yZWYyLnZhbHVlLFxuICAgICAgICAgICAgICAgICAgZG9uZSA9IF9yZWYyLmRvbmU7XG4gICAgICAgICAgICAgIHJldHVybiBkb25lID8gZmlsbGVyIDogdmFsdWU7XG4gICAgICAgICAgICB9KTtcblxuICAgICAgICAgIGNhc2UgOTpcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxMTtcbiAgICAgICAgICAgIHJldHVybiBfYXdhaXRBc3luY0dlbmVyYXRvcihhc3luY1BhcmFsbGVsRWFjaChwZWVrcnMsIGZ1bmN0aW9uIChwZWVrcikge1xuICAgICAgICAgICAgICByZXR1cm4gcGVla3IuYWR2YW5jZSgpO1xuICAgICAgICAgICAgfSkpO1xuXG4gICAgICAgICAgY2FzZSAxMTpcbiAgICAgICAgICAgIGRvbmUgPSBfX2V2ZXJ5KHBlZWtycywgaXNEb25lKTtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA2O1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICBjYXNlIDE0OlxuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDE0O1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDE3O1xuICAgICAgICAgICAgcmV0dXJuIF9hd2FpdEFzeW5jR2VuZXJhdG9yKGFzeW5jUGFyYWxsZWxFYWNoKHBlZWtycywgZnVuY3Rpb24gKHBlZWtyKSB7XG4gICAgICAgICAgICAgIHJldHVybiBwZWVrcltcInJldHVyblwiXSgpO1xuICAgICAgICAgICAgfSkpO1xuXG4gICAgICAgICAgY2FzZSAxNzpcbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dC5maW5pc2goMTQpO1xuXG4gICAgICAgICAgY2FzZSAxODpcbiAgICAgICAgICBjYXNlIFwiZW5kXCI6XG4gICA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ICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgX2NvbnRleHQubmV4dCA9IDc7XG4gICAgICAgICAgcmV0dXJuIHBlZWtycy5tYXAoZnVuY3Rpb24gKF9yZWYyKSB7XG4gICAgICAgICAgICB2YXIgdmFsdWUgPSBfcmVmMi52YWx1ZSxcbiAgICAgICAgICAgICAgICBkb25lID0gX3JlZjIuZG9uZTtcbiAgICAgICAgICAgIHJldHVybiBkb25lID8gZmlsbGVyIDogdmFsdWU7XG4gICAgICAgICAgfSk7XG5cbiAgICAgICAgY2FzZSA3OlxuICAgICAgICAgIHBhcmFsbGVsRWFjaChwZWVrcnMsIGZ1bmN0aW9uIChwZWVrcikge1xuICAgICAgICAgICAgcmV0dXJuIHBlZWtyLmFkdmFuY2UoKTtcbiAgICAgICAgICB9KTtcbiAgICAgICAgICBkb25lID0gX19ldmVyeShwZWVrcnMsIGlzRG9uZSk7XG4gICAgICAgICAgX2NvbnRleHQubmV4dCA9IDQ7XG4gICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgY2FzZSAxMTpcbiAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMTE7XG4gICAgICAgICAgcGFyYWxsZWxFYWNoKHBlZWtycywgZnVuY3Rpb24gKHBlZWtyKSB7XG4gICAgICAgICAgICByZXR1cm4gcGVla3JbXCJyZXR1cm5cIl0oKTtcbiAgICAgICAgICB9KTtcbiAgICAgICAgICByZXR1cm4gX2NvbnRleHQuZmluaXNoKDExKTtcblxuICAgICAgICBjYXNlIDE0OlxuICAgICAgICBjYXNlIFwiZW5kXCI6XG4gICAgICAgICAgcmV0dXJuIF9jb250ZXh0LnN0b3AoKTtcbiAgICAgIH1cbiAgICB9XG4gIH0sIF9tYXJrZWQsIG51bGwsIFtbMywsIDExLCAxNF1dKTtcbn1cblxuZXhwb3J0cy5fX3ppcEFsbCA9IF9femlwQWxsO1xudmFyIHppcEFsbCA9IC8qI19fUFVSRV9fKi9pdGVyYWJsZUN1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YXN5bmNNYXAoc291cmNlcywgX19hc3luY1BlZWtlcmF0ZSkpKTtcblxuICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgIHBlZWtycyA9IF9jb250ZXh0LnNlbnQ7XG4gICAgICAgICAgICBkb25lID0gX19zb21lKHBlZWtycywgaXNEb25lKTtcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSA0O1xuXG4gICAgICAgICAgY2FzZSA1OlxuICAgICAgICAgICAgaWYgKGRvbmUpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDEzO1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDg7XG4gICAgICAgICAgICByZXR1cm4gcGVla3JzLm1hcChmdW5jdGlvbiAoX3JlZikge1xuICAgICAgICAgICAgICB2YXIgdmFsdWUgPSBfcmVmLnZhbHVlO1xuICAgICAgICAgICAgICByZXR1cm4gdmFsdWU7XG4gICAgICAgICAgICB9KTtcblxuICAgICAgICAgIGNhc2UgODpcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxMDtcbiAgICAgICAgICAgIHJldHVybiBfYXdhaXRBc3luY0dlbmVyYXRvcihQcm9taXNlLmFsbChfX21hcChwZWVrcnMsIGZ1bmN0aW9uIChwZWVrcikge1xuICAgICAgICAgICAgICByZXR1cm4gcGVla3IuYWR2YW5jZSgpO1xuICAgICAgICAgICAgfSkpKTtcblxuICAgICAgICAgIGNhc2UgMTA6XG4gICAgICAgICAgICBkb25lID0gX19zb21lKHBlZWtycywgaXNEb25lKTtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA1O1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICBjYXNlIDEzOlxuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDEzO1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDE2O1xuICAgICAgICAgICAgcmV0dXJuIF9hd2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biAgICAgICAgICBpZiAoZG9uZSkge1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDExO1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgX2NvbnRleHQubmV4dCA9IDY7XG4gICAgICAgICAgcmV0dXJuIHBlZWtycy5tYXAoZnVuY3Rpb24gKF9yZWYpIHtcbiAgICAgICAgICAgIHZhciB2YWx1ZSA9IF9yZWYudmFsdWU7XG4gICAgICAgICAgICByZXR1cm4gdmFsdWU7XG4gICAgICAgICAgfSk7XG5cbiAgICAgICAgY2FzZSA2OlxuICAgICAgICAgIF9pdGVyYXRvciA9IF9jcmVhdGVGb3JPZkl0ZXJhdG9ySGVscGVyKHBlZWtycyk7XG5cbiAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgZm9yIChfaXRlcmF0b3IucygpOyAhKF9zdGVwID0gX2l0ZXJhdG9yLm4oKSkuZG9uZTspIHtcbiAgICAgICAgICAgICAgcGVla3IgPSBfc3RlcC52YWx1ZTtcbiAgICAgICAgICAgICAgcGVla3IuYWR2YW5jZSgpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH0gY2F0Y2ggKGVycikge1xuICAgICAgICAgICAgX2l0ZXJhdG9yLmUoZXJyKTtcbiAgICAgICAgICB9IGZpbmFsbHkge1xuICAgICAgICAgICAgX2l0ZXJhdG9yLmYoKTtcbiAgICAgICAgICB9XG5cbiAgICAgICAgICBkb25lID0gX19zb21lKHBlZWtycywgaXNEb25lKTtcbiAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMztcbiAgICAgICAgICBicmVhaztcblxuICAgICAgICBjYXNlIDExOlxuICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAxMTtcbiAgICAgICAgICBwYXJhbGxlbEVhY2gocGVla3JzLCBmdW5jdGlvbiAocGVla3IpIHtcbiAgICAgICAgICAgIHJldHVybiBwZWVrcltcInJldHVyblwiXSgpO1xuICAgICAgICAgIH0pO1xuICAgICAgICA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clwiKTtcblxudmFyIF9tYXJrZWQgPSAvKiNfX1BVUkVfXyovX3JlZ2VuZXJhdG9yUnVudGltZS5tYXJrKF9fYXJyYXlSZXZlcnNlKTtcblxudmFyIF9yZXF1aXJlID0gcmVxdWlyZSgnLi4vLi4vaW50ZXJuYWwvaXRlcmFibGUuanMnKSxcbiAgICB3cmFwV2l0aEl0ZXJhYmxlSXRlcmF0b3IgPSBfcmVxdWlyZS53cmFwV2l0aEl0ZXJhYmxlSXRlcmF0b3I7XG5cbmZ1bmN0aW9uIF9fYXJyYXlSZXZlcnNlKHNvdXJjZSkge1xuICB2YXIgaTtcbiAgcmV0dXJuIF9yZWdlbmVyYXRvclJ1bnRpbWUud3JhcChmdW5jdGlvbiBfX2FycmF5UmV2ZXJzZSQoX2NvbnRleHQpIHtcbiAgICB3aGlsZSAoMSkge1xuICAgICAgc3dpdGNoIChfY29udGV4dC5wcmV2ID0gX2NvbnRleHQubmV4dCkge1xuICAgICAgICBjYXNlIDA6XG4gICAgICAgICAgaWYgKCEoc291cmNlID09IG51bGwpKSB7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMjtcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIHJldHVybiBfY29udGV4dC5hYnJ1cHQoXCJyZXR1cm5cIik7XG5cbiAgICAgICAgY2FzZSAyOlxuICAgICAgICAgIGkgPSBzb3VyY2UubGVuZ3RoIC0gMTtcblxuICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgaWYgKCEoaSA+PSAwKSkge1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDk7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgICB9XG5cbiAgICAgICAgICBfY29udGV4dC5uZXh0ID0gNjtcbiAgICAgICAgICByZXR1cm4gc291cmNlW2ldO1xuXG4gICAgICAgIGNhc2UgNjpcbiAgICAgICAgICBpLS07XG4gICAgICAgICAgX2NvbnRleHQubmV4dCA9IDM7XG4gIC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FzZSBcImVuZFwiOlxuICAgICAgICAgICAgICAgIHJldHVybiBfY29udGV4dDIuc3RvcCgpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cbiAgICAgICAgfSwgX2NhbGxlZTIsIHRoaXMpO1xuICAgICAgfSkpO1xuXG4gICAgICBmdW5jdGlvbiBuZXh0KCkge1xuICAgICAgICByZXR1cm4gX25leHQuYXBwbHkodGhpcywgYXJndW1lbnRzKTtcbiAgICAgIH1cblxuICAgICAgcmV0dXJuIG5leHQ7XG4gICAgfSgpXG4gIH0sIHtcbiAgICBrZXk6IFwicmV0dXJuXCIsXG4gICAgdmFsdWU6IGZ1bmN0aW9uICgpIHtcbiAgICAgIHZhciBfcmV0dXJuMiA9IF9hc3luY1RvR2VuZXJhdG9yKCAvKiNfX1BVUkVfXyovX3JlZ2VuZXJhdG9yUnVudGltZS5tYXJrKGZ1bmN0aW9uIF9jYWxsZWUzKCkge1xuICAgICAgICByZXR1cm4gX3JlZ2VuZXJhdG9yUnVudGltZS53cmFwKGZ1bmN0aW9uIF9jYWxsZWUzJChfY29udGV4dDMpIHtcbiAgICAgICAgICB3aGlsZSAoMSkge1xuICAgICAgICAgICAgc3dpdGNoIChfY29udGV4dDMucHJldiA9IF9jb250ZXh0My5uZXh0KSB7XG4gICAgICAgICAgICAgIGNhc2UgMDpcbiAgICAgICAgICAgICAgICBfY29udGV4dDMubmV4dCA9IDI7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGFzeW5jQ2FsbFJldHVybih0aGlzLml0ZXJhdG9yKTtcblxuICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0My5hYnJ1cHQoXCJyZXR1cm5cIiwgX2NvbnRleHQzLnNlbnQpO1xuXG4gICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgY2FzZSBcImVuZFwiOlxuICAgICAgICAgICAgICAgIHJldHVybiBfY29udGV4dDMuc3RvcCgpO1xuICAgICA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9yZWdlbmVyYXRvclJ1bnRpbWUud3JhcChmdW5jdGlvbiBfY2FsbGVlJChfY29udGV4dDIpIHtcbiAgICAgIHdoaWxlICgxKSB7XG4gICAgICAgIHN3aXRjaCAoX2NvbnRleHQyLnByZXYgPSBfY29udGV4dDIubmV4dCkge1xuICAgICAgICAgIGNhc2UgMDpcbiAgICAgICAgICAgIGl0ZXJhdG9ycyA9IHNvdXJjZXMubWFwKGZ1bmN0aW9uIChpdGVyYWJsZSkge1xuICAgICAgICAgICAgICByZXR1cm4gaXRlcmFibGVbU3ltYm9sLmFzeW5jSXRlcmF0b3JdKCk7XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIHN0ZXBQcm9taXNlcyA9IGl0ZXJhdG9ycy5tYXAoZnVuY3Rpb24gKGl0ZXIsIGlkeCkge1xuICAgICAgICAgICAgICByZXR1cm4gaXRlci5uZXh0KCkudGhlbihmdW5jdGlvbiAoc3RlcCkge1xuICAgICAgICAgICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICAgICAgICBpZHg6IGlkeCxcbiAgICAgICAgICAgICAgICAgIHN0ZXA6IHN0ZXBcbiAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgX2xvb3AgPSAvKiNfX1BVUkVfXyovX3JlZ2VuZXJhdG9yUnVudGltZS5tYXJrKGZ1bmN0aW9uIF9sb29wKCkge1xuICAgICAgICAgICAgICB2YXIgX3JlYWR5LCBpZHgsIHN0ZXA7XG5cbiAgICAgICAgICAgICAgcmV0dXJuIF9yZWdlbmVyYXRvclJ1bnRpbWUud3JhcChmdW5jdGlvbiBfbG9vcCQoX2NvbnRleHQpIHtcbiAgICAgICAgICAgICAgICB3aGlsZSAoMSkge1xuICAgICAgICAgICAgICAgICAgc3dpdGNoIChfY29udGV4dC5wcmV2ID0gX2NvbnRleHQubmV4dCkge1xuICAgICAgICAgICAgICAgICAgICBjYXNlIDA6XG4gICAgICAgICAgICAgICAgICAgICAgX3JlYWR5ID0gcmVhZHksIGlkeCA9IF9yZWFkeS5pZHgsIHN0ZXAgPSBfcmVhZHkuc3RlcDtcbiAgICAgICAgICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMztcbiAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gc3RlcC52YWx1ZTtcblxuICAgICAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgICAgc3RlcFByb21pc2VzW2lkeF0gPSBpdGVyYXRvcnNbaWR4XS5uZXh0KCkudGhlbihmdW5jdGlvbiAoc3RlcCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgaWR4OiBpZHgsXG4gICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZXA6IHN0ZXBcbiAgICAgICAgICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICAgICAgICAgICAgfSk7XG5cbiAgICAgICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICBjYXNlIFwiZW5kXCI6XG4gICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0LnN0b3AoKTtcbiAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIH0sIF9sb29wKTtcbiAgICAgICAgICAgIH0pO1xuXG4gICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgX2NvbnRleHQyLm5leHQgPSA1O1xuICAgICAgICAgICAgcmV0dXJuIF9hd2FpdEFzeW5jR2VuZXJhdG9yKHJhY2VUbyhmdW5jdGlvbiAoX3JlZikge1xuICAgICAgICAgICAgICB2YXIgc3RlcCA9IF9yZWYuc3RlcDtcbiAgICAgICAgICAgICAgcmV0dXJuICFzdGVwLmRvbmU7XG4gICAgICAgICAgICB9LCBudWxsLCBzdGVwUHJvbWlzZXMpKTtcblxuICAgICAgICAgIGNhc2UgNT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m9taXNlQ291bnQgPSAwO1xuICAgIHZhciByZXNvbHZlZCA9IGZhbHNlO1xuICAgIHZhciByZWplY3RlZCA9IGZhbHNlO1xuXG4gICAgdmFyIF9pdGVyYXRvciA9IF9jcmVhdGVGb3JPZkl0ZXJhdG9ySGVscGVyKHByb21pc2VzKSxcbiAgICAgICAgX3N0ZXA7XG5cbiAgICB0cnkge1xuICAgICAgZm9yIChfaXRlcmF0b3IucygpOyAhKF9zdGVwID0gX2l0ZXJhdG9yLm4oKSkuZG9uZTspIHtcbiAgICAgICAgdmFyIHByb21pc2UgPSBfc3RlcC52YWx1ZTtcbiAgICAgICAgcHJvbWlzZVtcImNhdGNoXCJdKGZ1bmN0aW9uIChlcnJvcikge1xuICAgICAgICAgIGlmICghcmVqZWN0ZWQgJiYgIXJlc29sdmVkKSB7XG4gICAgICAgICAgICByZWplY3QoZXJyb3IpO1xuICAgICAgICAgICAgcmVqZWN0ZWQgPSB0cnVlO1xuICAgICAgICAgIH1cbiAgICAgICAgfSkudGhlbihmdW5jdGlvbiAocmVzdWx0KSB7XG4gICAgICAgICAgc2V0dGxlZFByb21pc2VDb3VudCsrO1xuXG4gICAgICAgICAgaWYgKCFyZXNvbHZlZCAmJiAhcmVqZWN0ZWQpIHtcbiAgICAgICAgICAgIGlmIChwcmVkaWNhdGUocmVzdWx0KSkge1xuICAgICAgICAgICAgICByZXNvbHZlKHJlc3VsdCk7XG4gICAgICAgICAgICAgIHJlc29sdmVkID0gdHJ1ZTtcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoc2V0dGxlZFByb21pc2VDb3VudCA9PT0gcHJvbWlzZUNvdW50KSB7XG4gICAgICAgICAgICAgIHJlc29sdmUobm90Rm91bmRWYWx1ZSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuICAgICAgICB9KTtcbiAgICAgICAgcHJvbWlzZUNvdW50Kys7XG4gICAgICB9XG4gICAgfSBjYXRjaCAoZXJyKSB7XG4gICAgICBfaXRlcmF0b3IuZ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PSBfY29udGV4dC5zZW50O1xuICAgICAgICAgICAgX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiA9IF9zdGVwLmRvbmU7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTE7XG4gICAgICAgICAgICByZXR1cm4gX2F3YWl0QXN5bmNHZW5lcmF0b3IoX3N0ZXAudmFsdWUpO1xuXG4gICAgICAgICAgY2FzZSAxMTpcbiAgICAgICAgICAgIF92YWx1ZSA9IF9jb250ZXh0LnNlbnQ7XG5cbiAgICAgICAgICAgIGlmIChfaXRlcmF0b3JOb3JtYWxDb21wbGV0aW9uKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyMztcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHZhbHVlID0gX3ZhbHVlO1xuICAgICAgICAgICAgZHVyYXRpb24gPSBpbnRlcnZhbE1zIC0gKERhdGUubm93KCkgLSB3YWl0U2luY2UpO1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDE3O1xuICAgICAgICAgICAgcmV0dXJuIF9hd2FpdEFzeW5jR2VuZXJhdG9yKGR1cmF0aW9uID4gMCAmJiBkZWxheShkdXJhdGlvbikpO1xuXG4gICAgICAgICAgY2FzZSAxNzpcbiAgICAgICAgICAgIHdhaXRTaW5jZSA9IERhdGUubm93KCk7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMjA7XG4gICAgICAgICAgICByZXR1cm4gdmFsdWU7XG5cbiAgICAgICAgICBjYXNlIDIwOlxuICAgICAgICAgICAgX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiA9IHRydWU7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gNTtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSAyMzpcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyOTtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSAyNTpcbiAgICAgICAgICAgIF9jb250ZXh0LnByZXYgPSAyNTtcbiAgICAgICAgICAgIF9jb250ZXh0LnQwID0gX2NvbnRleHRbXCJjYXRjaFwiXSgzKTtcbiAgICAgICAgICAgIF9kaWRJdGVyYXRvckVycm9yID0gdHJ1ZTtcbiAgICAgICAgICAgIF9pdGVyYXRvckVycm9yID0gX2NvbnRleHQudDA7XG5cbiAgICAgICAgICBjYXNlIDI5OlxuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDI5O1xuICAgICAgICAgICAgX2NvbnRleHQucHJldiA9IDMwO1xuXG4gICAgICAgICAgICBpZiAoISghX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiAmJiBfaXRlcmF0b3JbXCJyZXR1cm5cIl0gIT0gbnVsbCkpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDM0O1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDM0O1xuICAgICAgICAgICAgcmV0dXJuIF9hd2FpdEFzeW5jR2VuZXJhdG9yKF9pdGVyYXRvcltcInJldHVyblwiXSgpKTtcblxuICAgICAgICAgIGNhc2UgMzQ6XG4gICAgICAgICAgICBfY29udGV4dC5wcmV2ID0gMzQ7XG5cbiAgICAgICAgICAgIGlmICghX2RpZEl0ZXJhdG9yRXJyb3IpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDM3O1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdGhyb3cgX2l0ZXJhdG9yRXJyb3I7XG5cbiAgICAgICAgICBjYXNlIDM3OlxuICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0LmZpbmlzaCgzNCk7XG5cbiAgICAgICAgICBjYXNlIDM4OlxuICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0LmZpbmlzaCgyOSk7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9yUnVudGltZS5rZXlzKG9iaik7XG5cbiAgICAgICAgY2FzZSAzOlxuICAgICAgICAgIGlmICgoX2NvbnRleHQudDEgPSBfY29udGV4dC50MCgpKS5kb25lKSB7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTA7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgICB9XG5cbiAgICAgICAgICBrZXkgPSBfY29udGV4dC50MS52YWx1ZTtcblxuICAgICAgICAgIGlmICghaGFzT3duUHJvcGVydHkuY2FsbChvYmosIGtleSkpIHtcbiAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA4O1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgX2NvbnRleHQubmV4dCA9IDg7XG4gICAgICAgICAgcmV0dXJuIFtrZXksIG9ialtrZXldXTtcblxuICAgICAgICBjYXNlIDg6XG4gICAgICAgICAgX2NvbnRleHQubmV4dCA9IDM7XG4gICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgY2FzZSAxMDpcbiAgICAgICAgY2FzZSBcImVuZFwiOlxuICAgICAgICAgIHJldHVybiBfY29udGV4dC5zdG9wKCk7XG4gICAgICB9XG4gICAgfVxuICB9LCBfbWFya2VkKTtcbn1cblxuZXhwb3J0cy5fX29iamVjdEVudHJpZXMgPSBfX29iamVjdEVudHJpZXM7XG52YXIgb2JqZWN0RW50cmllcyA9IC8qI19fUFVSRV9fKi93cmFwV2l0aEl0ZXJhYmxlSXRlcmF0b3IoX19vYmplY3RFbnRyaWVzLCB7XG4gIHZhbGlkYXRlQXJnczogZnVuY3Rpb24gdmFsaWRhdGVBcmdzKGFyZ3MpIHtcbiAgICBpZiAoIShhcmdzWzBdID09IG51bGwgfHwgX3R5cGVvZihhcmdzWzBdKSA9PT0gJ29iamVjdCcpKSB7XG4gICAgICB0aHJvdyBuZXcgRXJyb3IoJ29iaiBhcmd1bWVudCB0byBvYmplY3RFbnRyaWVzIG11c3QgYmUgYW4gb2J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mopIHtcbiAgdmFyIGtleTtcbiAgcmV0dXJuIF9yZWdlbmVyYXRvclJ1bnRpbWUud3JhcChmdW5jdGlvbiBfX29iamVjdEtleXMkKF9jb250ZXh0KSB7XG4gICAgd2hpbGUgKDEpIHtcbiAgICAgIHN3aXRjaCAoX2NvbnRleHQucHJldiA9IF9jb250ZXh0Lm5leHQpIHtcbiAgICAgICAgY2FzZSAwOlxuICAgICAgICAgIGlmICghKG9iaiA9PSBudWxsKSkge1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDI7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgICB9XG5cbiAgICAgICAgICByZXR1cm4gX2NvbnRleHQuYWJydXB0KFwicmV0dXJuXCIpO1xuXG4gICAgICAgIGNhc2UgMjpcbiAgICAgICAgICBfY29udGV4dC50MCA9IF9yZWdlbmVyYXRvclJ1bnRpbWUua2V5cyhvYmopO1xuXG4gICAgICAgIGNhc2UgMzpcbiAgICAgICAgICBpZiAoKF9jb250ZXh0LnQxID0gX2NvbnRleHQudDAoKSkuZG9uZSkge1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDEwO1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAga2V5ID0gX2NvbnRleHQudDEudmFsdWU7XG5cbiAgICAgICAgICBpZiAoIWhhc093blByb3BlcnR5LmNhbGwob2JqLCBrZXkpKSB7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gODtcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA4O1xuICAgICAgICAgIHJldHVybiBrZXk7XG5cbiAgICAgICAgY2FzZSA4OlxuICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAzO1xuICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgIGNhc2UgMTA6XG4gICAgICAgIGNhc2UgXCJlbmRcIjpcbiAgICAgICAgICByZXR1cm4gX2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3RWYWx1ZXMob2JqKSB7XG4gIHZhciBrZXk7XG4gIHJldHVybiBfcmVnZW5lcmF0b3JSdW50aW1lLndyYXAoZnVuY3Rpb24gX19vYmplY3RWYWx1ZXMkKF9jb250ZXh0KSB7XG4gICAgd2hpbGUgKDEpIHtcbiAgICAgIHN3aXRjaCAoX2NvbnRleHQucHJldiA9IF9jb250ZXh0Lm5leHQpIHtcbiAgICAgICAgY2FzZSAwOlxuICAgICAgICAgIGlmICghKG9iaiA9PSBudWxsKSkge1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDI7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgICB9XG5cbiAgICAgICAgICByZXR1cm4gX2NvbnRleHQuYWJydXB0KFwicmV0dXJuXCIpO1xuXG4gICAgICAgIGNhc2UgMjpcbiAgICAgICAgICBfY29udGV4dC50MCA9IF9yZWdlbmVyYXRvclJ1bnRpbWUua2V5cyhvYmopO1xuXG4gICAgICAgIGNhc2UgMzpcbiAgICAgICAgICBpZiAoKF9jb250ZXh0LnQxID0gX2NvbnRleHQudDAoKSkuZG9uZSkge1xuICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDEwO1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAga2V5ID0gX2NvbnRleHQudDEudmFsdWU7XG5cbiAgICAgICAgICBpZiAoIWhhc093blByb3BlcnR5LmNhbGwob2JqLCBrZXkpKSB7XG4gICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gODtcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA4O1xuICAgICAgICAgIHJldHVybiBvYmpba2V5XTtcblxuICAgICAgICBjYXNlIDg6XG4gICAgICAgICAgX2NvbnRleHQubmV4dCA9IDM7XG4gICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgY2FzZSAxMDpcbiAgICAgICAgY2FzZSBcImVuZFwiOlxuICA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5wcmV2ID0gX2NvbnRleHQubmV4dCkge1xuICAgICAgICAgICAgICBjYXNlIDA6XG4gICAgICAgICAgICAgICAgc291cmNlID0gdGhpcy5zb3VyY2UsIHN0cmF0ZWd5ID0gdGhpcy5zdHJhdGVneSwgb3B0aW9ucyA9IHRoaXMub3B0aW9ucztcbiAgICAgICAgICAgICAgICB0aGlzLnBhcnRzSXRlcmF0b3IgPSB0aGlzLnBhcnRzSXRlcmF0b3IgfHwgbmV3IEFzeW5jUGFydHNJdGVyYXRvcihzb3VyY2UsIHN0cmF0ZWd5LCBvcHRpb25zKTtcblxuICAgICAgICAgICAgICAgIGlmICh0aGlzLmZpcnN0UGFydCkge1xuICAgICAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDc7XG4gICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gNTtcbiAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5wYXJ0c0l0ZXJhdG9yLm5leHQoKTtcblxuICAgICAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICAgICAgc3RlcCA9IF9jb250ZXh0LnNlbnQ7XG4gICAgICAgICAgICAgICAgdGhpcy5maXJzdFBhcnQgPSBzdGVwLmRvbmUgPyBbXSA6IHN0ZXAudmFsdWU7XG5cbiAgICAgICAgICAgICAgY2FzZSA3OlxuICAgICAgICAgICAgICBjYXNlIFwiZW5kXCI6XG4gICAgICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0LnN0b3AoKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgIH0sIF9jYWxsZWUsIHRoaXMpO1xuICAgICAgfSkpO1xuXG4gICAgICBmdW5jdGlvbiBzZXR1cEZpcnN0KCkge1xuICAgICAgICByZXR1cm4gX3NldHVwRmlyc3QuYXBwbHkodGhpcywgYXJndW1lbnRzKTtcbiAgICAgIH1cblxuICAgICAgcmV0dXJuIHNldHVwRmlyc3Q7XG4gICAgfSgpXG4gIH0sIHtcbiAgICBrZXk6IFwibmV4dFwiLFxuICAgIHZhbHVlOiBmdW5jdGlvbiBuZXh0KCkge1xuICAgICAgdmFyIHNlbGYgPSB0aGlzO1xuXG4gICAgICBzd2l0Y2ggKHRoaXMuY3VycmVudElkeCsrKSB7XG4gICAgICAgIGNhc2UgMDpcbiAgICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgdmFsdWU6IF93cmFwQXN5bmNHZW5lcmF0b3IoIC8qI19fUFVSRV9fKi9fcmVnZW5lcmF0b3JSdW50aW1lLm1hcmsoZnVuY3Rpb24gX2NhbGxlZTIoKSB7XG4gICAgICAgICAgICAgIHJldHVybiBfcmVnZW5lcmF0b3JSdW50aW1lLndyYXAoZnVuY3Rpb24gX2NhbGxlZTIkKF9jb250ZXh0Mikge1xuICAgICAgICAgICAgICAgIHdoaWxlICgxKSB7XG4gICAgICAgICAgICAgICAgICBzd2l0Y2ggKF9jb250ZXh0Mi5wcmV2ID0gX2NvbnRleHQyLm5leHQpIHtcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAwOlxuICAgICAgICAgICAgICAgICAgICAgIF9jb250ZXh0Mi5uZXh0ID0gMjtcbiAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gX2F3YWl0QXN5bmNHZW5lcmF0b3Ioc2VsZi5zZXR1cEZpcnN0KCkpO1xuXG4gICAgICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gX2NvbnRleHQyLmRlbGVnYXRlWWllbGQoX2FzeW5jR2VuZXJhdG9yRGVsZWdhdGUoX2FzeW5jSXRlcmF0b3Ioc2VsZi5maXJzdFBhcnQpLCBfYXdhaXRBc3luY0dlbmVyYXRvciksIFwidDBcIiwgMyk7XG5cbiAgICAgICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICBjYXNlIFwiZW5kXCI6XG4gICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0Mi5zdG9wKCk7XG4gICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICB9LCBfY2FsbGVlMik7XG4gICAgICAgICAgICB9KSkoKSxcbiAgICAgICAgICAgIGRvbmU6IGZhbHNlXG4gICAgICAgICAgfTtcblxuICAgICAgICBjYXNlIDE6XG4gICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgIHZhbHVlOiBfd3JhcEFzeW5jR2VuZXJhdG9yKCAvKiNfX1BVUkVfXyovX3JlZ2VuZXJhdG9yUnVudGltZS5tYXJrKGZ1bmN0aW9uIF9jYWxsZWUzKCkge1xuICAgICAgICAgICAgICB2YXIgc3RlcDtcbiAgICAgICAgICAgICAgcmV0dXJuIF9yZWdlbmVyYXRvclJ1bnRpbWUud3JhcChmdW5jdGlvbiBfY2FsbGVlMyQoX2NvbnRleHQzKSB7XG4gICAgICAgICAgICAgICAgd2hpbGUgKDEpIHtcbiAgICAgICAgICAgICAgICAgIHN3aXRjaCAoX2NvbnRleHQzLnByZXYgPSBfY29udGV4dDMubmV4dCkge1xuICAgICAgICAgICAgICAgICAgICBjYXNlIDA6XG4gICAgICAgICAgICAgICAgICAgICAgX2NvbnRleHQzLm5leHQgPSAyO1xuICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBfYXdhaXRBc3luY0dlbmVyYXRvcihzZWxmLnNldHVwRmlyc3QoKSk7XG5cbiAgICAgICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICAgIF9jb250ZXh0My5uZXh0ID0gNDtcbiAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gX2F3YWl0QXN5bmNHZW5lcmF0b3Ioc2VsZi5wYXJ0c0l0ZXJhdG9yLm5leHQoKSk7XG5cbiAgICAgICAgICAgICAgICAgICAgY2FzZSA0OlxuICAgICAgICAgICAgICAgICAgICAgIHN0ZXAgPSBfY29udGV4dDMuc2VudDtcbiAgICAgICAgICAgICAgICAgICAgICBzZWxmLnNlY29uZFBhcnQgPSBzdGVwLmRvbmUgPyBbXSA6IHN0ZXAudmFsdWU7XG4gICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0My5kZWxlZ2F0ZVlpZWxkKF9hc3luY0dlbmVyYXRvckRlbGVnYXRlKF9hc3luY0l0ZXJhdG9yKHNlbGYuc2Vjb25kUGFydCksIF9hd2FpdEFzeW5jR2VuZXJhdG9yKSwgXCJ0MFwiLCA3KTtcblxuICAgICAgICAgICAgICAgICAgICBjYXNlIDc6XG4gICAgICAgICAgICAgICAgICAgIGNhc2UgXCJlbmRcIjpcbiAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gX2NvbnRleHQzLnN0b3AoKTtcbiAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIH0sIF9jYWxsZWUzKTtcbiAgICAgICAgICAgIH0pKSgpLFxuICAgICAgICAgICAgZG9uZTogZmFsc2VcbiAgICAgICAgICB9O1xuXG4gICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgIHZhbHVlOiB1bmRlZmluZWQsXG4gICAgICAgICAgICBkb25lOiB0cnVlXG4gICAgICAgICAgfTtcbiAgICAgIH1cbiAgICB9XG4gIH0sIHtcbiAgICBrZXk6IFwicmV0dXJuXCIsXG4gICAgdmFsdWU6IGZ1bmN0aW9uIF9yZXR1cm4oKSB7XG4gICAgICBpZiAodGhpcy5jdXJyZW50SWR4ID09PSAxKSB7XG4gICAgICAgIHRocm93IG5ldyBFcnJvcignWW91IG11c3QgdGFrZSBib3RoIHBhcnRzIG9mIGEgYmlzZWN0b3Igb3IgbmVpdGhlci4nKTtcbiAgICAgIH1cblxuICAgICAgcmV0dXJuIHtcbiAgICAgICAgdmFsdWU6IHVuZGVmaW5lZCxcbiAgICAgICAgZG9uZTogdHJ1ZVxuICAgICAgfTtcbi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VyYXRvclJ1bnRpbWUud3JhcChmdW5jdGlvbiBfY2FsbGVlJChfY29udGV4dCkge1xuICAgICAgICAgIHdoaWxlICgxKSB7XG4gICAgICAgICAgICBzd2l0Y2ggKF9jb250ZXh0LnByZXYgPSBfY29udGV4dC5uZXh0KSB7XG4gICAgICAgICAgICAgIGNhc2UgMDpcbiAgICAgICAgICAgICAgICBkb25lID0gdGhpcy5kb25lLCBleGNoYW5nZSA9IHRoaXMuZXhjaGFuZ2U7XG5cbiAgICAgICAgICAgICAgICBpZiAoIWRvbmUpIHtcbiAgICAgICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA1O1xuICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0LmFicnVwdChcInJldHVyblwiLCB7XG4gICAgICAgICAgICAgICAgICB2YWx1ZTogdW5kZWZpbmVkLFxuICAgICAgICAgICAgICAgICAgZG9uZTogZG9uZVxuICAgICAgICAgICAgICAgIH0pO1xuXG4gICAgICAgICAgICAgIGNhc2UgNTpcbiAgICAgICAgICAgICAgICBoZWFkID0gdGhpcy5oZWFkO1xuXG4gICAgICAgICAgICAgICAgaWYgKGhlYWQubmV4dCkge1xuICAgICAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDk7XG4gICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gOTtcbiAgICAgICAgICAgICAgICByZXR1cm4gZXhjaGFuZ2UuZmV0Y2goKTtcblxuICAgICAgICAgICAgICBjYXNlIDk6XG4gICAgICAgICAgICAgICAgaGVhZCA9IGhlYWQubmV4dDtcbiAgICAgICAgICAgICAgICBfaGVhZCA9IGhlYWQsIHN0ZXAgPSBfaGVhZC5zdGVwO1xuICAgICAgICAgICAgICAgIHRoaXMuZG9uZSA9IHN0ZXAuZG9uZTtcbiAgICAgICAgICAgICAgICB0aGlzLmhlYWQgPSBoZWFkO1xuICAgICAgICAgICAgICAgIHJldHVybiBfY29udGV4dC5hYnJ1cHQoXCJyZXR1cm5cIiwgc3RlcCk7XG5cbiAgICAgICAgICAgICAgY2FzZSAxNDpcbiAgICAgICAgICAgICAgY2FzZSBcImVuZFwiOlxuICAgICAgICAgICAgICAgIHJldHVybiBfY29udGV4dC5zdG9wKCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuICAgICAgICB9LCBfY2FsbGVlLCB0aGlzKTtcbiAgICAgIH0pKTtcblxuICAgICAgZnVuY3Rpb24gbmV4dCgpIHtcbiAgICAgICAgcmV0dXJuIF9uZXh0LmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7XG4gICAgICB9XG5cbiAgICAgIHJldHVybiBuZXh0O1xuICAgIH0oKVxuICB9LCB7XG4gICAga2V5OiBcInJldHVyblwiLFxuICAgIHZhbHVlOiBmdW5jdGlvbiAoKSB7XG4gICAgICB2YXIgX3JldHVybjIgPSBfYXN5bmNUb0dlbmVyYXRvciggLyojX19QVVJFX18qL19yZWdlbmVyYXRvclJ1bnRpbWUubWFyayhmdW5jdGlvbiBfY2FsbGVlMigpIHtcbiAgICAgICAgdmFyIGRvbmUsIGV4Y2hhbmdlO1xuICAgICAgICByZXR1cm4gX3JlZ2VuZXJhdG9yUnVudGltZS53cmFwKGZ1bmN0aW9uIF9jYWxsZWUyJChfY29udGV4dDIpIHtcbiAgICAgICAgICB3aGlsZSAoMSkge1xuICAgICAgICAgICAgc3dpdGNoIChfY29udGV4dDIucHJldiA9IF9jb250ZXh0Mi5uZXh0KSB7XG4gICAgICAgICAgICAgIGNhc2UgMDpcbiAgICAgICAgICAgICAgICBkb25lID0gdGhpcy5kb25lLCBleGNoYW5nZSA9IHRoaXMuZXhjaGFuZ2U7XG5cbiAgICAgICAgICAgICAgICBpZiAoZG9uZSkge1xuICAgICAgICAgICAgICAgICAgX2NvbnRleHQyLm5leHQgPSA0O1xuICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgX2NvbnRleHQyLm5leHQgPSA0O1xuICAgICAgICAgICAgICAgIHJldHVybiBleGNoYW5nZVtcInJldHVyblwiXSgpO1xuXG4gICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICByZXR1cm4gX2NvbnRleHQyLmFicnVwdChcInJldHVyblwiLCB7XG4gICAgICAgICAgICAgICAgICB2YWx1ZTogdW5kZWZpbmVkLFxuICAgICAgICAgICAgICAgICAgZG9uZTogdHJ1ZVxuICAgICAgICAgICAgICAgIH0pO1xuXG4gICAgICAgICAgICAgIGNhc2UgNTpcbiAgICAgICAgICAgICAgY2FzZSBcImVuZFwiOlxuICAgICAgICAgICAgICAgIHJldHVybiBfY29udGV4dDIuc3RvcCgpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cbiAgICAgICAgfSwgX2NhbGxlZTIsIHRoaXMpO1xuICAgICAgfSkpO1xuXG4gICAgICBmdW5jdGlvbiBfcmV0dXJuKCkge1xuICAgICAgICByZXR1cm4gX3JldHVybjIuYXBwbHkodGhpcywgYXJndW1lbnRzKTtcbiAgICAgIH1cblxuICAgICAgcmV0dXJuIF9yZXR1cm47XG4gICAgfSgpXG4gIH1dKTtcblxuICByZXR1cm4gQXN5bmNGb3JrO1xufShBc3luY0l0ZXJhYmxlSXRlcmF0b3IpO1xuXG52YXIgQXN5bmNFeGNoYW5nZSA9IC8qI19fUFVSRV9fKi9mdW5jdGlvbiAoKSB7XG4gIGZ1bmN0aW9uIEFzeW5jRXhjaGFuZ2UoaXRlcmF0b3IpIHtcbiAgICBfY2xhc3NDYWxsQ2hlY2sodGhpcywgQXN5bmNFeGNoYW5nZSk7XG5cbiAgICB0aGlzLml0ZXJhdG9yID0gaXRlcmF0b3I7XG4gICAgdGhpcy50YWlsID0gbmV3IFF1ZXVlSXRlbShudWxsKTtcbiAgICB0aGlzLmh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VtID0gbmV3IFF1ZXVlSXRlbShzdGVwKTtcbiAgICAgICAgICAgICAgICB0aGlzLmhlYWQubmV4dCA9IHRoaXMuaGVhZCA9IG5ld0l0ZW07XG5cbiAgICAgICAgICAgICAgY2FzZSA1OlxuICAgICAgICAgICAgICBjYXNlIFwiZW5kXCI6XG4gICAgICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0My5zdG9wKCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuICAgICAgICB9LCBfY2FsbGVlMywgdGhpcyk7XG4gICAgICB9KSk7XG5cbiAgICAgIGZ1bmN0aW9uIGZldGNoKCkge1xuICAgICAgICByZXR1cm4gX2ZldGNoLmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7XG4gICAgICB9XG5cbiAgICAgIHJldHVybiBmZXRjaDtcbiAgICB9KClcbiAgfSwge1xuICAgIGtleTogXCJyZXR1cm5cIixcbiAgICB2YWx1ZTogZnVuY3Rpb24gKCkge1xuICAgICAgdmFyIF9yZXR1cm4zID0gX2FzeW5jVG9HZW5lcmF0b3IoIC8qI19fUFVSRV9fKi9fcmVnZW5lcmF0b3JSdW50aW1lLm1hcmsoZnVuY3Rpb24gX2NhbGxlZTQoKSB7XG4gICAgICAgIHJldHVybiBfcmVnZW5lcmF0b3JSdW50aW1lLndyYXAoZnVuY3Rpb24gX2NhbGxlZTQkKF9jb250ZXh0NCkge1xuICAgICAgICAgIHdoaWxlICgxKSB7XG4gICAgICAgICAgICBzd2l0Y2ggKF9jb250ZXh0NC5wcmV2ID0gX2NvbnRleHQ0Lm5leHQpIHtcbiAgICAgICAgICAgICAgY2FzZSAwOlxuICAgICAgICAgICAgICAgIC0tdGhpcy5mb3JrcztcblxuICAgICAgICAgICAgICAgIGlmICghKHRoaXMuZm9ya3MgPT09IDApKSB7XG4gICAgICAgICAgICAgICAgICBfY29udGV4dDQubmV4dCA9IDQ7XG4gICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICB9XG5c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HNJdGVyYXRvcik7XG5cbiAgICByZXR1cm4gX3N1cGVyLmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7XG4gIH1cblxuICBfY3JlYXRlQ2xhc3MoQXN5bmNHcm91cHNJdGVyYXRvciwgW3tcbiAgICBrZXk6IFwibmV4dFwiLFxuICAgIHZhbHVlOiBmdW5jdGlvbiAoKSB7XG4gICAgICB2YXIgX25leHQgPSBfYXN5bmNUb0dlbmVyYXRvciggLyojX19QVVJFX18qL19yZWdlbmVyYXRvclJ1bnRpbWUubWFyayhmdW5jdGlvbiBfY2FsbGVlKCkge1xuICAgICAgICB2YXIgc3BsaXRlcmF0b3IsIGtleTtcbiAgICAgICAgcmV0dXJuIF9yZWdlbmVyYXRvclJ1bnRpbWUud3JhcChmdW5jdGlvbiBfY2FsbGVlJChfY29udGV4dCkge1xuICAgICAgICAgIHdoaWxlICgxKSB7XG4gICAgICAgICAgICBzd2l0Y2ggKF9jb250ZXh0LnByZXYgPSBfY29udGV4dC5uZXh0KSB7XG4gICAgICAgICAgICAgIGNhc2UgMDpcbiAgICAgICAgICAgICAgICBpZiAodGhpcy5pbml0aWFsaXplZCkge1xuICAgICAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDM7XG4gICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMztcbiAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5pbml0KCk7XG5cbiAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgIHNwbGl0ZXJhdG9yID0gdGhpcy5zcGxpdGVyYXRvcjtcblxuICAgICAgICAgICAgICAgIGlmICghKHRoaXMuY3VycmVudFBhcnQgIT09IG51bGwpKSB7XG4gICAgICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTI7XG4gICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBpZiAoIShzcGxpdGVyYXRvci52YWx1ZSAhPT0gc3BsaXQgfHwgc3BsaXRlcmF0b3IuY3VycmVudCA9PT0gdGhpcy5zcGxpdFN0ZXApKSB7XG4gICAgICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTI7XG4gICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICB0aGlzLmN1cnJlbnRQYXJ0LmluYWN0aXZlID0gdHJ1ZTtcblxuICAgICAgICAgICAgICBjYXNlIDc6XG4gICAgICAgICAgICAgICAgaWYgKCEoIXNwbGl0ZXJhdG9yLmRvbmUgJiYgc3BsaXRlcmF0b3IudmFsdWUgIT09IHNwbGl0KSkge1xuICAgICAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDEyO1xuICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDEwO1xuICAgICAgICAgICAgICAgIHJldHVybiBzcGxpdGVyYXRvci5hZHZhbmNlKCk7XG5cbiAgICAgICAgICAgICAgY2FzZSAxMDpcbiAgICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gNztcbiAgICAgICAgICAgICAgICBicmVhaztcblxuICAgICAgICAgICAgICBjYXNlIDEyOlxuICAgICAgICAgICAgICAgIGlmICghc3BsaXRlcmF0b3IuZG9uZSkge1xuICAgICAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDE0O1xuICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0LmFicnVwdChcInJldHVyblwiLCB7XG4gICAgICAgICAgICAgICAgICB2YWx1ZTogdW5kZWZpbmVkLFxuICAgICAgICAgICAgICAgICAgZG9uZTogdHJ1ZVxuICAgICAgICAgICAgICAgIH0pO1xuXG4gICAgICAgICAgICAgIGNhc2UgMTQ6XG4gICAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDE2O1xuICAgICAgICAgICAgICAgIHJldHVybiBzcGxpdGVyYXRvci5hZHZhbmNlKCk7XG5cbiAgICAgICAgICAgICAgY2FzZSAxNjpcbiAgICAgICAgICAgICAgICBpZiAoIShzcGxpdGVyYXRvci5kb25lIHx8IHNwbGl0ZXJhdG9yLnZhbHVlID09PSBzcGxpdCkpIHtcbiAgICAgICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxODtcbiAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignVW5leHBlY3RlZCBlbXB0eSBncm91cCcpO1xuXG4gICAgICAgICAgICAgIGNhc2UgMTg6XG4gICAgICAgICAgICAgICAga2V5ID0gc3BsaXRlcmF0b3IudmFsdWU7XG4gICAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDIxO1xuICAgICAgICAgICAgICAgIHJldHVybiBzcGxpdGVyYXRvci5hZHZhbmNlKCk7XG5cbiAgICAgICAgICAgICAgY2FzZSAyMTpcbiAgICAgICAgICAgICAgICB0aGlzLnNwbGl0U3RlcCA9IHNwbGl0ZXJhdG9yLmN1cnJlbnQ7XG4gICAgICAgICAgICAgICAgdGhpcy5jdXJyZW50UGFydCA9IG5ldyBBc3luY1BhcnRJdGVyYXRvcih0aGlzKTtcbiAgICAgICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuYWJydXB0KFwicmV0dXJuXCIsIHtcbiAgICAgICAgICAgICAgICAgIHZhbHVlOiBba2V5LCB0aGlzLmN1cnJlbnRQYXJ0XSxcbiAgICAgICAgICAgICAgICAgIGRvbmU6IGZhbHNlXG4gICAgICAgICAgICAgICAgfSk7XG5cbiAgICAgICAgICAgICAgY2FzZSAyNDpcbiAgICAgICAgICAgICAgY2FzZSBcImVuZFwiOlxuICAgICAgICAgICAgIC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dDIuc2VudDtcbiAgICAgICAgICAgIF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gPSBfc3RlcC5kb25lO1xuICAgICAgICAgICAgX2NvbnRleHQyLm5leHQgPSAxMTtcbiAgICAgICAgICAgIHJldHVybiBfc3RlcC52YWx1ZTtcblxuICAgICAgICAgIGNhc2UgMTE6XG4gICAgICAgICAgICBfdmFsdWUgPSBfY29udGV4dDIuc2VudDtcblxuICAgICAgICAgICAgaWYgKF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24pIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQyLm5leHQgPSAxODtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHZhbHVlID0gX3ZhbHVlO1xuICAgICAgICAgICAgYXJyLnB1c2godmFsdWUpO1xuXG4gICAgICAgICAgY2FzZSAxNTpcbiAgICAgICAgICAgIF9pdGVyYXRvck5vcm1hbENvbXBsZXRpb24gPSB0cnVlO1xuICAgICAgICAgICAgX2NvbnRleHQyLm5leHQgPSA1O1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICBjYXNlIDE4OlxuICAgICAgICAgICAgX2NvbnRleHQyLm5leHQgPSAyNDtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgY2FzZSAyMDpcbiAgICAgICAgICAgIF9jb250ZXh0Mi5wcmV2ID0gMjA7XG4gICAgICAgICAgICBfY29udGV4dDIudDAgPSBfY29udGV4dDJbXCJjYXRjaFwiXSgzKTtcbiAgICAgICAgICAgIF9kaWRJdGVyYXRvckVycm9yID0gdHJ1ZTtcbiAgICAgICAgICAgIF9pdGVyYXRvckVycm9yID0gX2NvbnRleHQyLnQwO1xuXG4gICAgICAgICAgY2FzZSAyNDpcbiAgICAgICAgICAgIF9jb250ZXh0Mi5wcmV2ID0gMjQ7XG4gICAgICAgICAgICBfY29udGV4dDIucHJldiA9IDI1O1xuXG4gICAgICAgICAgICBpZiAoISghX2l0ZXJhdG9yTm9ybWFsQ29tcGxldGlvbiAmJiBfaXRlcmF0b3JbXCJyZXR1cm5cIl0gIT0gbnVsbCkpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQyLm5leHQgPSAyOTtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIF9jb250ZXh0Mi5uZXh0ID0gMjk7XG4gICAgICAgICAgICByZXR1cm4gX2l0ZXJhdG9yW1wicmV0dXJuXCJdKCk7XG5cbiAgICAgICAgICBjYXNlIDI5OlxuICAgICAgICAgICAgX2NvbnRleHQyLnByZXYgPSAyOTtcblxuICAgICAgICAgICAgaWYgKCFfZGlkSXRlcmF0b3JFcnJvcikge1xuICAgICAgICAgICAgICBfY29udGV4dDIubmV4dCA9IDMyO1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdGhyb3cgX2l0ZXJhdG9yRXJyb3I7XG5cbiAgICAgICAgICBjYXNlIDMyOlxuICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0Mi5maW5pc2goMjkpO1xuXG4gICAgICAgICAgY2FzZSAzMzpcbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dDIuZmluaXNoKDI0KTtcblxuICAgICAgICAgIGNhc2UgMzQ6XG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQyLmFicnVwdChcInJldHVyblwiLCBhc3luY1dyYXBXaXRoSXRlcmFibGVJdGVyYXRvcihhc3luY1dyYXApKGFycikpO1xuXG4gICAgICAgICAgY2FzZSAzNTpcbiAgICAgICAgICBjYXNlIFwiZW5kXCI6XG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQyLnN0b3AoKTtcbiAgICAgICAgfVxuICAgICAgfVxuICAgIH0sIF9jYWxsZWUyLCBudWxsLCBbWzMsIDIwLCAyNCwgMzRdLCBbMjUsLCAyOSwgMzNdXSk7XG4gIH0pKTtcbiAgcmV0dXJuIF9hc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BfY29udGV4dC5uZXh0KSB7XG4gICAgICAgICAgICAgIGNhc2UgMDpcbiAgICAgICAgICAgICAgICBzcGxpdGVyYXRvciA9IHRoaXMucGFydHNJdGVyYXRvci5zcGxpdGVyYXRvcjtcbiAgICAgICAgICAgICAgICBjdXJyZW50ID0gc3BsaXRlcmF0b3IuY3VycmVudDtcbiAgICAgICAgICAgICAgICB0aGlzLmFzc2VydEFjdGl2ZSgpO1xuXG4gICAgICAgICAgICAgICAgaWYgKCEodGhpcy5kb25lIHx8IGN1cnJlbnQuZG9uZSB8fCBjdXJyZW50LnZhbHVlID09PSBzcGxpdCkpIHtcbiAgICAgICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAxMDtcbiAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIHRoaXMuZG9uZSA9IHRydWU7XG4gICAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDc7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMucGFydHNJdGVyYXRvci5tYXliZVJldHVyblNvdXJjZSgpO1xuXG4gICAgICAgICAgICAgIGNhc2UgNzpcbiAgICAgICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuYWJydXB0KFwicmV0dXJuXCIsIHtcbiAgICAgICAgICAgICAgICAgIHZhbHVlOiB1bmRlZmluZWQsXG4gICAgICAgICAgICAgICAgICBkb25lOiB0cnVlXG4gICAgICAgICAgICAgICAgfSk7XG5cbiAgICAgICAgICAgICAgY2FzZSAxMDpcbiAgICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTI7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHNwbGl0ZXJhdG9yLmFkdmFuY2UoKTtcblxuICAgICAgICAgICAgICBjYXNlIDEyOlxuICAgICAgICAgICAgICAgIHJldHVybiBfY29udGV4dC5hYnJ1cHQoXCJyZXR1cm5cIiwgY3VycmVudCk7XG5cbiAgICAgICAgICAgICAgY2FzZSAxMzpcbiAgICAgICAgICAgICAgY2FzZSBcImVuZFwiOlxuICAgICAgICAgICAgICAgIHJldHVybiBfY29udGV4dC5zdG9wKCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuICAgICAgICB9LCBfY2FsbGVlLCB0aGlzKTtcbiAgICAgIH0pKTtcblxuICAgICAgZnVuY3Rpb24gbmV4dCgpIHtcbiAgICAgICAgcmV0dXJuIF9uZXh0LmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7XG4gICAgICB9XG5cbiAgICAgIHJldHVybiBuZXh0O1xuICAgIH0oKVxuICB9LCB7XG4gICAga2V5OiBcInJldHVyblwiLFxuICAgIHZhbHVlOiBmdW5jdGlvbiAoKSB7XG4gICAgICB2YXIgX3JldHVybjIgPSBfYXN5bmNUb0dlbmVyYXRvciggLyojX19QVVJFX18qL19yZWdlbmVyYXRvclJ1bnRpbWUubWFyayhmdW5jdGlvbiBfY2FsbGVlMigpIHtcbiAgICAgICAgcmV0dXJuIF9yZWdlbmVyYXRvclJ1bnRpbWUud3JhcChmdW5jdGlvbiBfY2FsbGVlMiQoX2NvbnRleHQyKSB7XG4gICAgICAgICAgd2hpbGUgKDEpIHtcbiAgICAgICAgICAgIHN3aXRjaCAoX2NvbnRleHQyLnByZXYgPSBfY29udGV4dDIubmV4dCkge1xuICAgICAgICAgICAgICBjYXNlIDA6XG4gICAgICAgICAgICAgICAgdGhpcy5kb25lID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICBfY29udGV4dDIubmV4dCA9IDM7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMucGFydHNJdGVyYXRvci5tYXliZVJldHVyblNvdXJjZSgpO1xuXG4gICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICByZXR1cm4gX2NvbnRleHQyLmFicnVwdChcInJldHVyblwiLCB7XG4gICAgICAgICAgICAgICAgICB2YWx1ZTogdW5kZWZpbmVkLFxuICAgICAgICAgICAgICAgICAgZG9uZTogdHJ1ZVxuICAgICAgICAgICAgICAgIH0pO1xuXG4gICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgY2FzZSBcImVuZFwiOlxuICAgICAgICAgICAgICAgIHJldHVybiBfY29udGV4dDIuc3RvcCgpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cbiAgICAgICAgfSwgX2NhbGxlZTIsIHRoaXMpO1xuICAgICAgfSkpO1xuXG4gICAgICBmdW5jdGlvbiBfcmV0dXJuKCkge1xuICAgICAgICByZXR1cm4gX3JldHVybjIuYXBwbHkodGhpcywgYXJndW1lbnRzKTtcbiAgICAgIH1cblxuICAgICAgcmV0dXJuIF9yZXR1cm47XG4gICAgfSgpXG4gIH0sIHtcbiAgICBrZXk6IFwidGhyb3dcIixcbiAgICB2YWx1ZTogZnVuY3Rpb24gKCkge1xuICAgICAgdmFyIF90aHJvdzIgPSBfYXN5bmNUb0dlbmVyYXRvciggLyojX19QVVJFX18qL19yZWdlbmVyYXRvclJ1bnRpbWUubWFyayhmdW5jdGlvbiBfY2FsbGVlMygpIHtcbiAgICAgICAgcmV0dXJuIF9yZWdlbmVyYXRvclJ1bnRpbWUud3JhcChmdW5jdGlvbiBfY2FsbGVlMyQoX2NvbnRleHQzKSB7XG4gICAgICAgICAgd2hpbGUgKDEpIHtcbiAgICAgICAgICAgIHN3aXRjaCAoX2NvbnRleHQzLnByZXYgPSBfY29udGV4dDMubmV4dCkge1xuICAgICAgICAgICAgICBjYXNlIDA6XG4gICAgICAgICAgICAgICAgX2NvbnRleHQzLm5leHQgPSAyO1xuICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW1wicmV0dXJuXCJdKCk7XG5cbiAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgIHJldHVybiBfY29udGV4dDMuYWJydXB0KFwicmV0dXJuXCIsIF9jb250ZXh0My5zZW50KTtcblxuICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgIGNhc2UgXC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cbiAgICAgICAgICAgICAgICB0aGlzLnNwbGl0ZXJhdG9yID0gX2NvbnRleHQ0LnNlbnQ7XG5cbiAgICAgICAgICAgICAgY2FzZSA1OlxuICAgICAgICAgICAgICBjYXNlIFwiZW5kXCI6XG4gICAgICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0NC5zdG9wKCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuICAgICAgICB9LCBfY2FsbGVlNCwgdGhpcyk7XG4gICAgICB9KSk7XG5cbiAgICAgIGZ1bmN0aW9uIGluaXQoKSB7XG4gICAgICAgIHJldHVybiBfaW5pdC5hcHBseSh0aGlzLCBhcmd1bWVudHMpO1xuICAgICAgfVxuXG4gICAgICByZXR1cm4gaW5pdDtcbiAgICB9KClcbiAgfSwge1xuICAgIGtleTogXCJtYXliZVJldHVyblNvdXJjZVwiLFxuICAgIHZhbHVlOiBmdW5jdGlvbiAoKSB7XG4gICAgICB2YXIgX21heWJlUmV0dXJuU291cmNlID0gX2FzeW5jVG9HZW5lcmF0b3IoIC8qI19fUFVSRV9fKi9fcmVnZW5lcmF0b3JSdW50aW1lLm1hcmsoZnVuY3Rpb24gX2NhbGxlZTUoKSB7XG4gICAgICAgIHJldHVybiBfcmVnZW5lcmF0b3JSdW50aW1lLndyYXAoZnVuY3Rpb24gX2NhbGxlZTUkKF9jb250ZXh0NSkge1xuICAgICAgICAgIHdoaWxlICgxKSB7XG4gICAgICAgICAgICBzd2l0Y2ggKF9jb250ZXh0NS5wcmV2ID0gX2NvbnRleHQ1Lm5leHQpIHtcbiAgICAgICAgICAgICAgY2FzZSAwOlxuICAgICAgICAgICAgICAgIGlmICghKHRoaXMuc3BsaXRlcmF0b3IgJiYgdGhpcy5yZXR1cm5lZCAmJiB0aGlzLmN1cnJlbnRQYXJ0LmRvbmUpKSB7XG4gICAgICAgICAgICAgICAgICBfY29udGV4dDUubmV4dCA9IDM7XG4gICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBfY29udGV4dDUubmV4dCA9IDM7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuc3BsaXRlcmF0b3JbXCJyZXR1cm5cIl0oKTtcblxuICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgIGNhc2UgXCJlbmRcIjpcbiAgICAgICAgICAgICAgICByZXR1cm4gX2NvbnRleHQ1LnN0b3AoKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgIH0sIF9jYWxsZWU1LCB0aGlzKTtcbiAgICAgIH0pKTtcblxuICAgICAgZnVuY3Rpb24gbWF5YmVSZXR1cm5Tb3VyY2UoKSB7XG4gICAgICAgIHJldHVybiBfbWF5YmVSZXR1cm5Tb3VyY2UuYXBwbHkodGhpcywgYXJndW1lbnRzKTtcbiAgICAgIH1cblxuICAgICAgcmV0dXJuIG1heWJlUmV0dXJuU291cmNlO1xuICAgIH0oKVxuICB9LCB7XG4gICAga2V5OiBcIm5leHRcIixcbiAgICB2YWx1ZTogZnVuY3Rpb24gKCkge1xuICAgICAgdmFyIF9uZXh0MiA9IF9hc3luY1RvR2VuZXJhdG9yKCAvKiNfX1BVUkVfXyovX3JlZ2VuZXJhdG9yUnVudGltZS5tYXJrKGZ1bmN0aW9uIF9jYWxsZWU2KCkge1xuICAgICAgICB2YXIgc3BsaXRlcmF0b3I7XG4gICAgICAgIHJldHVybiBfcmVnZW5lcmF0b3JSdW50aW1lLndyYXAoZnVuY3Rpb24gX2NhbGxlZTYkKF9jb250ZXh0Nikge1xuICAgICAgICAgIHdoaWxlICgxKSB7XG4gICAgICAgICAgICBzd2l0Y2ggKF9jb250ZXh0Ni5wcmV2ID0gX2NvbnRleHQ2Lm5leHQpIHtcbiAgICAgICAgICAgICAgY2FzZSAwOlxuICAgICAgICAgICAgICAgIGlmICh0aGlzLmluaXRpYWxpemVkKSB7XG4gICAgICAgICAgICAgICAgICBfY29udGV4dDYubmV4dCA9IDM7XG4gICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBfY29udGV4dDYubmV4dCA9IDM7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuaW5pdCgpO1xuXG4gICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICBzcGxpdGVyYXRvciA9IHRoaXMuc3BsaXRlcmF0b3I7XG5cbiAgICAgICAgICAgICAgICBpZiAoIXNwbGl0ZXJhdG9yLmRvbmUpIHtcbiAgICAgICAgICAgICAgICAgIF9jb250ZXh0Ni5uZXh0ID0gNjtcbiAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIHJldHVybiBfY29udGV4dDYuYWJydXB0KFwicmV0dXJuXCIsIHtcbiAgICAgICAgICAgICAgICAgIHZhbHVlOiB1bmRlZmluZWQsXG4gICAgICAgICAgICAgICAgICBkb25lOiB0cnVlXG4gICAgICAgICAgICAgICAgfSk7XG5cbiAgICAgICAgICAgICAgY2FzZSA2OlxuICAgICAgICAgICAgICAgIGlmICghKHRoaXMuY3VycmVudFBhcnQgIT09IG51bGwpKSB7XG4gICAgICAgICAgICAgICAgICBfY29udGV4dDYubmV4dCA9IDE2O1xuICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgaWYgKCEoc3BsaXRlcmF0b3IudmFsdWUgIT09IHNwbGl0IHx8IHNwbGl0ZXJhdG9yLmN1cnJlbnQgPT09IHRoaXMuc3BsaXRTdGVwKSkge1xuICAgICAgICAgICAgICAgICAgX2NvbnRleHQ2Lm5leHQgPSAxNDtcbiAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIHRoaXMuY3VycmVudFBhcnQuaW5hY3RpdmUgPSB0cnVlO1xuXG4gICAgICAgICAgICAgIGNhc2UgOTpcbiAgICAgICAgICAgICAgICBpZiAoISghc3BsaXRlcmF0b3IuZG9uZSAmJiBzcGxpdGVyYXRvci52YWx1ZSAhPT0gc3BsaXQpKSB7XG4gICAgICAgICAgICAgICAgICBfY29udGV4dDYubmV4dCA9IDE0O1xuICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgX2NvbnRleHQ2Lm5leHQgPSAxMjtcbiAgICAgICAgICAgICAgICByZXR1cm4gc3BsaXRlcmF0b3IuYWR2YW5jZSgpO1xuXG4gICAgICAgICAgICAgIGNhc2UgMTI6XG4gICAgICAgICAgICAgICAgX2NvbnRleHQ2Lm5leHQgPSA5O1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgICAgIGNhc2UgMTQ6XG4gICAgICAgICAgICAgICAgX2NvbnRleHQ2Lm5leHQgPSAxNjtcbiAgICAgICAgICAgICAgICByZXR1cm4gc3BsaXRlcmF0b3IuYWR2YW5jZSgpO1xuXG4gICAgICAgICAgICAgIGNhc2UgMTY6XG4gICAgICAgICAgICAgICAgdGhpcy5zcGxpdFN0ZXAgPSBzcGxpdGVyYXRvci5jdXJyZW50O1xuICAgICAgICAgICAgICAgIHRoaXMuY3VycmVudFBhcnQgPSBuZXcgQXN5bmNQYXJ0SXRlcmF0b3IodGhpcyk7XG4gICAgICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0Ni5hYnJ1cHQoXCJyZXR1cm5cIiwge1xuICAgICAgICAgICAgICAgICAgdmFsdWU6IHRoaXMuY3VycmVudFBhcnQsXG4gICAgICAgICAgICAgICAgICBkb25lOiBmYWxzZVxuICAgICAgICAgICAgICAgIH0pO1xuXG4gICAgICAgICAgICAgIGNhc2UgMTk6XG4gICAgICAgICAgICAgIGNhc2UgXCJlbmRcIjpcbiAgICAgICAgICAgICAgICByZXR1cm4gX2NvbnRleHQ2LnN0b3AoKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgIH0sIF9jYWxsZWU2LCB0aGlzKTtcbiAgICAgIH0pKTtcblxuICAgICAgZnVuY3Rpb24gbmV4dCgpIHtcbiAgICAgICAgcmV0dXJuIF9uZXh0Mi5hcHBseSh0aGlzLCBhcmd1bWVudHMpO1xuICAgICAgfVxuXG4gICAgICByZXR1cm4gbmV4dDtcbiAgICB9KClcbiAgfSwge1xuICAgIGtleTogXCJyZXR1cm5cIixcbiAgICB2YWx1ZTogZnVuY3Rpb24gKCkge1xuICAgICAgdmFyIF9yZXR1cm4zID0gX2FzeW5jVG9HZW5lcmF0b3IoIC8qI19fUFVSRV9fKi9fcmVnZW5lcmF0b3JSdW50aW1lLm1hcmsoZnVuY3Rpb24gX2NhbGxlZTcodmFsdWUpIHtcbiAgICAgICAgcmV0dXJuIF9yZWdlbmVyYXRvclJ1bnRpbWUud3JhcChmdW5jdGlvbiBfY2FsbGVlNyQoX2NvbnRleHQ3KSB7XG4gICAgICAgICAgd2hpbGUgKDEpIHtcbiAgICAgICAgICAgIHN3aXRjaCAoX2NvbnRleHQ3LnByZXYgPSBfY29udGV4dDcubmV4dCkge1xuICAgICAgICAgICAgICBjYXNlIDA6XG4gICAgICAgICAgICAgICAgdGhpcy5yZXR1cm5lZCA9IHRydWU7XG4gICAgICAgICAgICAgICAgX2NvbnRleHQ3Lm5leHQgPSAzO1xuICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLm1heWJlUmV0dXJuU291cmNlKCk7XG5cbiAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgIHJldHVybiBfY29udGV4dDcuYWJydXB0KFwicmV0dXJuXCIsIHtcbiAgICAgICAgICAgICAgICAgIHZhbHVlOiB2YWx1ZSxcbiAgICAgICAgICAgICAgICAgIGRvbmU6IHRydWVcbiAgICAgICAgICAgICAgICB9KTtcblxuICAgICAgICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgICAgIGNhc2UgXCJlbmRcIjpcbiAgICAgICAgICAgICAgICByZXR1cm4gX2NvbnRleHQ3LnN0b3AoKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgIH0sIF9jYWxsZWU3LCB0aGlzKTtcbiAgICAgIH0pKTtcblxuICAgICAgZnVuY3Rpb24gX3JldHVybihfeCkge1xuICAgICAgICByZXR1cm4gX3JldHVybjMuYXBwbHkodGhpcywgYXJndW1lbnRzKTtcbiAgICAgIH1cblxuICAgICAgcmV0dXJuIF9yZXR1cm47XG4gICAgfSgpXG4gIH0sIHtcbiAgICBrZXk6IFwidGhyb3dcIixcbiAgICB2YWx1ZTogZnVuY3Rpb24gKCkge1xuICAgICAgdmFyIF90aHJvdzMgPSBfYXN5bmNUb0dlbmVyYXRvciggLyojX19QVVJFX18qL19yZWdlbmVyYXRvclJ1bnRpbWUubWFyayhmdW5jdGlvbiBfY2FsbGVlOCgpIHtcbiAgICAgICAgcmV0dXJuIF9yZWdlbmVyYXRvclJ1bnRpbWUud3JhcChmdW5jdGlvbiBfY2FsbGVlOCQoX2NvbnRleHQ4KSB7XG4gICAgICAgICAgd2hpbGUgKDEpIHtcbiAgICAgICAgICAgIHN3aXRjaCAoX2NvbnRleHQ4LnByZXYgPSBfY29udGV4dDgubmV4dCkge1xuICAgICAgICAgICAgICBjYXNlIDA6XG4gICAgICAgICAgICAgICAgX2NvbnRleHQ4Lm5leHQgPSAyO1xuICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW1wicmV0dXJuXCJdKCk7XG5cbiAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgIHJldHVybiBfY29udGV4dDguYWJydXB0KFwicmV0dXJuXCIsIF9jb250ZXh0OC5zZW50KTtcblxuICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgIGNhc2UgXCJlbmRcIjpcbiAgICAgICAgICAgICAgICByZXR1cm4gX2NvbnRleHQ4LnN0b3AoKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgIC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BjdXJyZW50KTtcblxuICAgICAgICAgICAgICBjYXNlIDU6XG4gICAgICAgICAgICAgIGNhc2UgXCJlbmRcIjpcbiAgICAgICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuc3RvcCgpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cbiAgICAgICAgfSwgX2NhbGxlZSwgdGhpcyk7XG4gICAgICB9KSk7XG5cbiAgICAgIGZ1bmN0aW9uIG5leHQoKSB7XG4gICAgICAgIHJldHVybiBfbmV4dC5hcHBseSh0aGlzLCBhcmd1bWVudHMpO1xuICAgICAgfVxuXG4gICAgICByZXR1cm4gbmV4dDtcbiAgICB9KClcbiAgfSwge1xuICAgIGtleTogXCJyZXR1cm5cIixcbiAgICB2YWx1ZTogZnVuY3Rpb24gKCkge1xuICAgICAgdmFyIF9yZXR1cm4yID0gX2FzeW5jVG9HZW5lcmF0b3IoIC8qI19fUFVSRV9fKi9fcmVnZW5lcmF0b3JSdW50aW1lLm1hcmsoZnVuY3Rpb24gX2NhbGxlZTIoKSB7XG4gICAgICAgIHJldHVybiBfcmVnZW5lcmF0b3JSdW50aW1lLndyYXAoZnVuY3Rpb24gX2NhbGxlZTIkKF9jb250ZXh0Mikge1xuICAgICAgICAgIHdoaWxlICgxKSB7XG4gICAgICAgICAgICBzd2l0Y2ggKF9jb250ZXh0Mi5wcmV2ID0gX2NvbnRleHQyLm5leHQpIHtcbiAgICAgICAgICAgICAgY2FzZSAwOlxuICAgICAgICAgICAgICAgIF9jb250ZXh0Mi5uZXh0ID0gMjtcbiAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5wZWVrcltcInJldHVyblwiXSgpO1xuXG4gICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICByZXR1cm4gX2NvbnRleHQyLmFicnVwdChcInJldHVyblwiLCB7XG4gICAgICAgICAgICAgICAgICB2YWx1ZTogdW5kZWZpbmVkLFxuICAgICAgICAgICAgICAgICAgZG9uZTogdHJ1ZVxuICAgICAgICAgICAgICAgIH0pO1xuXG4gICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgY2FzZSBcImVuZFwiOlxuICAgICAgICAgICAgICAgIHJldHVybiBfY29udGV4dDIuc3RvcCgpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cbiAgICAgICAgfSwgX2NhbGxlZTIsIHRoaXMpO1xuICAgICAgfSkpO1xuXG4gICAgICBmdW5jdGlvbiBfcmV0dXJuKCkge1xuICAgICAgICByZXR1cm4gX3JldHVybjIuYXBwbHkodGhpcywgYXJndW1lbnRzKTtcbiAgICAgIH1cblxuICAgICAgcmV0dXJuIF9yZXR1cm47XG4gICAgfSgpXG4gIH0sIHtcbiAgICBrZXk6IFN5bWJvbC5hc3luY0l0ZXJhdG9yLFxuICAgIHZhbHVlOiBmdW5jdGlvbiB2YWx1ZSgpIHtcbiAgICAgIHJldHVybiB0aGlzO1xuICAgIH1cbiAgfV0pO1xuXG4gIHJldHVybiBBc3luY1BlZWtlcmF0b3JJdGVyYXRvcjtcbn0oKTtcblxudmFyIEFzeW5jUGVla2VyYXRvciA9IC8qI19fUFVSRV9fKi9mdW5jdGlvbiAoKSB7XG4gIF9jcmVhdGVDbGFzcyhBc3luY1BlZWtlcmF0b3IsIG51bGwsIFt7XG4gICAga2V5OiBcImZyb21cIixcbiAgICB2YWx1ZTogZnVuY3Rpb24gKCkge1xuICAgICAgdmFyIF9mcm9tID0gX2FzeW5jVG9HZW5lcmF0b3IoIC8qI19fUFVSRV9fKi9fcmVnZW5lcmF0b3JSdW50aW1lLm1hcmsoZnVuY3Rpb24gX2NhbGxlZTMoaXRlcmFibGUpIHtcbiAgICAgICAgdmFyIGl0ZXJhdG9yLFxuICAgICAgICAgICAgZmlyc3QsXG4gICAgICAgICAgICBfbGVuLFxuICAgICAgICAgICAgYXJncyxcbiAgICAgICAgICAgIF9rZXksXG4gICAgICAgICAgICBfYXJnczMgPSBhcmd1bWVudHM7XG5cbiAgICAgICAgcmV0dXJuIF9yZWdlbmVyYXRvclJ1bnRpbWUud3JhcChmdW5jdGlvbiBfY2FsbGVlMyQoX2NvbnRleHQzKSB7XG4gICAgICAgICAgd2hpbGUgKDEpIHtcbiAgICAgICAgICAgIHN3aXRjaCAoX2NvbnRleHQzLnByZXYgPSBfY29udGV4dDMubmV4dCkge1xuICAgICAgICAgICAgICBjYXNlIDA6XG4gICAgICAgICAgICAgICAgaXRlcmF0b3IgPSBhc3luY0Vuc3VyZUl0ZXJhYmxlKGl0ZXJhYmxlKVtTeW1ib2wuYXN5bmNJdGVyYXRvcl0oKTtcbiAgICAgICAgICAgICAgICBfY29udGV4dDMubmV4dCA9IDM7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGl0ZXJhdG9yLm5leHQoKTtcblxuICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgZmlyc3QgPSBfY29udGV4dDMuc2VudDtcblxuICAgICAgICAgICAgICAgIGZvciAoX2xlbiA9IF9hcmdzMy5sZW5ndGgsIGFyZ3MgPSBuZXcgQXJyYXkoX2xlbiA+IDEgPyBfbGVuIC0gMSA6IDApLCBfa2V5ID0gMTsgX2tleSA8IF9sZW47IF9rZXkrKykge1xuICAgICAgICAgICAgICAgICAgYXJnc1tfa2V5IC0gMV0gPSBfYXJnczNbX2tleV07XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0My5hYnJ1cHQoXCJyZXR1cm5cIiwgX2NvbnN0cnVjdCh0aGlzLCBbaXRlcmF0b3IsIGZpcnN0XS5jb25jYXQoYXJncykpKTtcblxuICAgICAgICAgICAgICBjYXNlIDY6XG4gICAgICAgICAgICAgIGNhc2UgXCJlbmRcIjpcbiAgICAgICAgICAgICAgICByZXR1cm4gX2NvbnRleHQzLnN0b3AoKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgIH0sIF9jYWxsZWUzLCB0aGlzKTtcbiAgICAgIH0pKTtc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ICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIHRoaXNfLmluZGV4Kys7XG4gICAgICAgICAgICAgICAgX2NvbnRleHQ0Lm5leHQgPSA1O1xuICAgICAgICAgICAgICAgIHJldHVybiB0aGlzXy5pdGVyYXRvci5uZXh0KCk7XG5cbiAgICAgICAgICAgICAgY2FzZSA1OlxuICAgICAgICAgICAgICAgIHRoaXNfLmN1cnJlbnQgPSBfY29udGV4dDQuc2VudDtcblxuICAgICAgICAgICAgICBjYXNlIDY6XG4gICAgICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0NC5hYnJ1cHQoXCJyZXR1cm5cIiwgdGhpcyk7XG5cbiAgICAgICAgICAgICAgY2FzZSA3OlxuICAgICAgICAgICAgICBjYXNlIFwiZW5kXCI6XG4gICAgICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0NC5zdG9wKCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuICAgICAgICB9LCBfY2FsbGVlNCwgdGhpcyk7XG4gICAgICB9KSk7XG5cbiAgICAgIGZ1bmN0aW9uIGFkdmFuY2UoKSB7XG4gICAgICAgIHJldHVybiBfYWR2YW5jZS5hcHBseSh0aGlzLCBhcmd1bWVudHMpO1xuICAgICAgfVxuXG4gICAgICByZXR1cm4gYWR2YW5jZTtcbiAgICB9KClcbiAgfSwge1xuICAgIGtleTogXCJyZXR1cm5cIixcbiAgICB2YWx1ZTogZnVuY3Rpb24gKCkge1xuICAgICAgdmFyIF9yZXR1cm4zID0gX2FzeW5jVG9HZW5lcmF0b3IoIC8qI19fUFVSRV9fKi9fcmVnZW5lcmF0b3JSdW50aW1lLm1hcmsoZnVuY3Rpb24gX2NhbGxlZTUoKSB7XG4gICAgICAgIHZhciB0aGlzXztcbiAgICAgICAgcmV0dXJuIF9yZWdlbmVyYXRvclJ1bnRpbWUud3JhcChmdW5jdGlvbiBfY2FsbGVlNSQoX2NvbnRleHQ1KSB7XG4gICAgICAgICAgd2hpbGUgKDEpIHtcbiAgICAgICAgICAgIHN3aXRjaCAoX2NvbnRleHQ1LnByZXYgPSBfY29udGV4dDUubmV4dCkge1xuICAgICAgICAgICAgICBjYXNlIDA6XG4gICAgICAgICAgICAgICAgdGhpc18gPSB0aGlzW19dO1xuXG4gICAgICAgICAgICAgICAgaWYgKHRoaXMuZG9uZSkge1xuICAgICAgICAgICAgICAgICAgX2NvbnRleHQ1Lm5leHQgPSA0O1xuICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgX2NvbnRleHQ1Lm5leHQgPSA0O1xuICAgICAgICAgICAgICAgIHJldHVybiBhc3luY0NhbGxSZXR1cm4odGhpc18uaXRlcmF0b3IpO1xuXG4gICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICB0aGlzXy5jdXJyZW50ID0ge1xuICAgICAgICAgICAgICAgICAgdmFsdWU6IHVuZGVmaW5lZCxcbiAgICAgICAgICAgICAgICAgIGRvbmU6IHRydWVcbiAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICAgIHJldHVybiBfY29udGV4dDUuYWJydXB0KFwicmV0dXJuXCIsIHRoaXMpO1xuXG4gICAgICAgICAgICAgIGNhc2UgNjpcbiAgICAgICAgICAgICAgY2FzZSBcImVuZFwiOlxuICAgICAgICAgICAgICAgIHJldHVybiBfY29udGV4dDUuc3RvcCgpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cbiAgICAgICAgfSwgX2NhbGxlZTUsIHRoaXMpO1xuICAgICAgfSkpO1xuXG4gICAgICBmdW5jdGlvbiBfcmV0dXJuKCkge1xuICAgICAgICByZXR1cm4gX3JldHVybjMuYXBwbHkodGhpcywgYXJndW1lbnRzKTtcbiAgICAgIH1cblxuICAgICAgcmV0dXJuIF9yZXR1cm47XG4gICAgfSgpXG4gIH0sIHtcbiAgICBrZXk6IFwiYXNJdGVyYXRvclwiLFxuICAgIHZhbHVlOiBmdW5jd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O1xuICAgICAgfVxuICAgIH1cbiAgfSwge1xuICAgIGtleTogXCJuZXh0XCIsXG4gICAgdmFsdWU6IGZ1bmN0aW9uIG5leHQoKSB7XG4gICAgICB2YXIgc2VsZiA9IHRoaXM7XG5cbiAgICAgIHN3aXRjaCAodGhpcy5jdXJyZW50SWR4KyspIHtcbiAgICAgICAgY2FzZSAwOlxuICAgICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICB2YWx1ZTogLyojX19QVVJFX18qL19yZWdlbmVyYXRvclJ1bnRpbWUubWFyayhmdW5jdGlvbiBfY2FsbGVlKCkge1xuICAgICAgICAgICAgICByZXR1cm4gX3JlZ2VuZXJhdG9yUnVudGltZS53cmFwKGZ1bmN0aW9uIF9jYWxsZWUkKF9jb250ZXh0KSB7XG4gICAgICAgICAgICAgICAgd2hpbGUgKDEpIHtcbiAgICAgICAgICAgICAgICAgIHN3aXRjaCAoX2NvbnRleHQucHJldiA9IF9jb250ZXh0Lm5leHQpIHtcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAwOlxuICAgICAgICAgICAgICAgICAgICAgIHNlbGYuc2V0dXBGaXJzdCgpO1xuICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBfY29udGV4dC5kZWxlZ2F0ZVlpZWxkKHNlbGYuZmlyc3RQYXJ0LCBcInQwXCIsIDIpO1xuXG4gICAgICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgY2FzZSBcImVuZFwiOlxuICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBfY29udGV4dC5zdG9wKCk7XG4gICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICB9LCBfY2FsbGVlKTtcbiAgICAgICAgICAgIH0pKCksXG4gICAgICAgICAgICBkb25lOiBmYWxzZVxuICAgICAgICAgIH07XG5cbiAgICAgICAgY2FzZSAxOlxuICAgICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICB2YWx1ZTogLyojX19QVVJFX18qL19yZWdlbmVyYXRvclJ1bnRpbWUubWFyayhmdW5jdGlvbiBfY2FsbGVlMigpIHtcbiAgICAgICAgICAgICAgdmFyIHN0ZXA7XG4gICAgICAgICAgICAgIHJldHVybiBfcmVnZW5lcmF0b3JSdW50aW1lLndyYXAoZnVuY3Rpb24gX2NhbGxlZTIkKF9jb250ZXh0Mikge1xuICAgICAgICAgICAgICAgIHdoaWxlICgxKSB7XG4gICAgICAgICAgICAgICAgICBzd2l0Y2ggKF9jb250ZXh0Mi5wcmV2ID0gX2NvbnRleHQyLm5leHQpIHtcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAwOlxuICAgICAgICAgICAgICAgICAgICAgIHNlbGYuc2V0dXBGaXJzdCgpO1xuICAgICAgICAgICAgICAgICAgICAgIHN0ZXAgPSBzZWxmLnBhcnRzSXRlcmF0b3IubmV4dCgpO1xuICAgICAgICAgICAgICAgICAgICAgIHNlbGYuc2Vjb25kUGFydCA9IHN0ZXAuZG9uZSA/IFtdIDogc3RlcC52YWx1ZTtcbiAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gX2NvbnRleHQyLmRlbGVnYXRlWWllbGQoc2VsZi5zZWNvbmRQYXJ0LCBcInQwXCIsIDQpO1xuXG4gICAgICAgICAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgICAgICAgY2FzZSBcImVuZFwiOlxuICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBfY29udGV4dDIuc3RvcCgpO1xuICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgfSwgX2NhbGxlZTIpO1xuICAgICAgICAgICAgfSkoKSxcbiAgICAgICAgICAgIGRvbmU6IGZhbHNlXG4gICAgICAgICAgfTtcblxuICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICB2YWx1ZTogdW5kZWZpbmVkLFxuICAgICAgICAgICAgZG9uZTogdHJ1ZVxu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GltZS53cmFwKGZ1bmN0aW9uIHZhbHVlJChfY29udGV4dCkge1xuICAgICAgICB3aGlsZSAoMSkge1xuICAgICAgICAgIHN3aXRjaCAoX2NvbnRleHQucHJldiA9IF9jb250ZXh0Lm5leHQpIHtcbiAgICAgICAgICAgIGNhc2UgMDpcbiAgICAgICAgICAgICAgaSA9IDA7XG5cbiAgICAgICAgICAgIGNhc2UgMTpcbiAgICAgICAgICAgICAgaWYgKCEoaSA8IHRoaXMuc2l6ZSkpIHtcbiAgICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gNztcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSA0O1xuICAgICAgICAgICAgICByZXR1cm4gdGhpcy5nZXQoaSk7XG5cbiAgICAgICAgICAgIGNhc2UgNDpcbiAgICAgICAgICAgICAgaSsrO1xuICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMTtcbiAgICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICAgIGNhc2UgNzpcbiAgICAgICAgICAgIGNhc2UgXCJlbmRcIjpcbiAgICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0LnN0b3AoKTtcbiAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgIH0sIHZhbHVlLCB0aGlzKTtcbiAgICB9KVxuICB9LCB7XG4gICAga2V5OiBcImNhcGFjaXR5XCIsXG4gICAgZ2V0OiBmdW5jdGlvbiBnZXQoKSB7XG4gICAgICByZXR1cm4gdGhpcy5fYXJyYXkubGVuZ3RoO1xuICAgIH1cbiAgfV0pO1xuXG4gIHJldHVybiBDaXJjdWxhckJ1ZmZlcjtcbn0oKTtcblxuZXhwb3J0cy5DaXJjdWxhckJ1ZmZlciA9IENpcmN1bGFyQnVmZmVyOyIsImZ1bmN0aW9uIGRlZmF1bHRDb21wYXJlT3JkZXIoYSwgYikge1xuICBpZiAoYSA+IGIpIHtcbiA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ncy5cclxuICAgICAqIEBleHBvcnRzIExvbmdcclxuICAgICAqIEBjbGFzcyBBIExvbmcgY2xhc3MgZm9yIHJlcHJlc2VudGluZyBhIDY0IGJpdCB0d28ncy1jb21wbGVtZW50IGludGVnZXIgdmFsdWUuXHJcbiAgICAgKiBAcGFyYW0ge251bWJlcn0gbG93IFRoZSBsb3cgKHNpZ25lZCkgMzIgYml0cyBvZiB0aGUgbG9uZ1xyXG4gICAgICogQHBhcmFtIHtudW1iZXJ9IGhpZ2ggVGhlIGhpZ2ggKHNpZ25lZCkgMzIgYml0cyBvZiB0aGUgbG9uZ1xyXG4gICAgICogQHBhcmFtIHtib29sZWFuPX0gdW5zaWduZWQgV2hldGhlciB1bnNpZ25lZCBvciBub3QsIGRlZmF1bHRzIHRvIGBmYWxzZWAgZm9yIHNpZ25lZFxyXG4gICAgICogQGNvbnN0cnVjdG9yXHJcbiAgICAgKi9cclxuICAgIGZ1bmN0aW9uIExvbmcobG93LCBoaWdoLCB1bnNpZ25lZCkge1xyXG5cclxuICAgICAgICAvKipcclxuICAgICAgICAgKiBUaGUgbG93IDMyIGJpdHMgYXMgYSBzaWduZWQgdmFsdWUuXHJcbiAgICAgICAgICogQHR5cGUge251bWJlcn1cclxuICAgICAgICAgKi9cclxuICAgICAgICB0aGlzLmxvdyA9IGxvdyB8IDA7XHJcblxyXG4gICAgICAgIC8qKlxyXG4gICAgICAgICAqIFRoZSBoaWdoIDMyIGJpdHMgYXMgYSBzaWduZWQgdmFsdWUuXHJcbiAgICAgICAgICogQHR5cGUge251bWJlcn1cclxuICAgICAgICAgKi9cclxuICAgICAgICB0aGlzLmhpZ2ggPSBoaWdoIHwgMDtcclxuXHJcbiAgICAgICAgLyoqXHJcbiAgICAgICAgICogV2hldGhlciB1bnNpZ25lZCBvciBub3QuXHJcbiAgICAgICAgICogQHR5cGUge2Jvb2xlYW59XHJcbiAgICAgICAgICovXHJcbiAgICAgICAgdGhpcy51bnNpZ25lZCA9ICEhdW5zaWduZW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x1ZSA+Pj49IDA7XHJcbiAgICAgICAgICAgIGlmIChjYWNoZSA9ICgwIDw9IHZhbHVlICYmIHZhbHVlIDwgMjU2KSkge1xyXG4gICAgICAgICAgICAgICAgY2FjaGVkT2JqID0gVUlOVF9DQUNIRVt2YWx1ZV07XHJcbiAgICAgICAgICAgICAgICBpZiAoY2FjaGVkT2JqKVxyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBjYWNoZWRPYmo7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgb2JqID0gZnJvbUJpdHModmFsdWUsICh2YWx1ZSB8IDApIDwgMCA/IC0xIDogMCwgdHJ1ZSk7XHJcbiAgICAgICAgICAgIGlmIChjYWNoZSlcclxuICAgICAgICAgICAgICAgIFVJTlRfQ0FDSEVbdmFsdWVdID0gb2JqO1xyXG4gICAgICAgICAgICByZXR1cm4gb2JqO1xyXG4gICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgIHZhbHVlIHw9IDA7XHJcbiAgICAgICAgICAgIGlmIChjYWNoZSA9ICgtMTI4IDw9IHZhbHVlICYmIHZhbHVlIDwgMTI4KSkge1xyXG4gICAgICAgICAgICAgICAgY2FjaGVkT2JqID0gSU5UX0NBQ0hFW3ZhbHVlXTtcclxuICAgICAgICAgICAgICAgIGlmIChjYWNoZWRPYmopXHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGNhY2hlZE9iajtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBvYmogPSBmcm9tQml0cyh2YWx1ZSwgdmFsdWUgPCAwID8gLTEgOiAwLCBmYWxzZSk7XHJcbiAgICAgICAgICAgIGlmIChjYWNoZSlcclxuICAgICAgICAgICAgICAgIElOVF9DQUNIRVt2YWx1ZV0gPSBvYmo7XHJcbiAgICAgICAgICAgIHJldHVybiBvYmo7XHJcbiAgICAgICAgfVxyXG4gICAgfVxyXG5cclxuICAgIC8qKlxyXG4gICAgICogUmV0dXJucyBhIExvbmcgcmVwcmVzZW50aW5nIHRoZSBnaXZlbiAzMiBiaXQgaW50ZWdlciB2YWx1ZS5cclxuICAgICAqIEBmdW5jdGlvblxyXG4gICAgICogQHBhcmFtIHtudW1iZXJ9IHZhbHVlIFRoZSAzMiBiaXQgaW50ZWdlciBpbiBxdWVzdGlvblxyXG4gICAgICogQHBhcmFtIHtib29sZWFuPX0gdW5zaWduZWQgV2hldGhlciB1bnNpZ25lZCBvciBub3QsIGRlZmF1bHRzIHRvIGBmYWxzZWAgZm9yIHNpZ25lZFxyXG4gICAgICogQHJldHVybnMgeyFMb25nfSBUaGUgY29ycmVzcG9uZGluZyBMb25nIHZhbHVlXHJcbiAgICAgKi9cclxuICAgIExvbmcuZnJvbUludCA9IGZyb21JbnQ7XHJcblxyXG4gICAgLyoqXHJcbiAgICAgKiBAcGFyYW0ge251bWJlcn0gdmFsdWVcclxuICAgICAqIEBwYXJhbSB7Ym9vbGVhbj19IHVuc2lnbmVkXHJcbiAgICAgKiBAcmV0dXJucyB7IUxvbmd9XHJcbiAgICAgKiBAaW5uZXJcclxuICAgICAqL1xyXG4gICAgZnVuY3Rpb24gZnJvbU51bWJlcih2YWx1ZSwgdW5zaWduZWQpIHtcclxuICAgICAgICBpZiAoaXNOYU4odmFsdWUpIHx8ICFpc0Zpbml0ZSh2YWx1ZSkpXHJcbiAgICAgICAgICAgIHJldHVybiB1bnNpZ25lZCA/IFVaRVJPIDogWkVSTztcclxuICAgICAgICBpZiAodW5zaWduZWQpIHtcclxuICAgICAgICAgICAgaWYgKHZhbHVlIDwgMClcclxuICAgICAgICAgICAgICAgIHJldHVybiBVWkVSTztcclxuICAgICAgICAgICAgaWYgKHZhbHVlID49IFRXT19QV1JfNjRfREJMKVxyXG4gICAgICAgICAgICAgICAgcmV0dXJuIE1BWF9VTlNJR05FRF9WQUxVRTtcclxuICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICBpZiAodmFsdWUgPD0gLVRXT19QV1JfNjNfREJMKVxyXG4gICAgICAgIC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RibCA9IE1hdGgucG93OyAvLyBVc2VkIDQgdGltZXMgKDQqOCB0byAxNSs0KVxyXG5cclxuICAgIC8qKlxyXG4gICAgICogQHBhcmFtIHtzdHJpbmd9IHN0clxyXG4gICAgICogQHBhcmFtIHsoYm9vbGVhbnxudW1iZXIpPX0gdW5zaWduZWRcclxuICAgICAqIEBwYXJhbSB7bnVtYmVyPX0gcmFkaXhcclxuICAgICAqIEByZXR1cm5zIHshTG9uZ31cclxuICAgICAqIEBpbm5lclxyXG4gICAgICovXHJcbiAgICBmdW5jdGlvbiBmcm9tU3RyaW5nKHN0ciwgdW5zaWduZWQsIHJhZGl4KSB7XHJcbiAgICAgICAgaWYgKHN0ci5sZW5ndGggPT09IDApXHJcbiAgICAgICAgICAgIHRocm93IEVycm9yKCdlbXB0eSBzdHJpbmcnKTtcclxuICAgICAgICBpZiAoc3RyID09PSBcIk5hTlwiIHx8IHN0ciA9PT0gXCJJbmZpbml0eVwiIHx8IHN0ciA9PT0gXCIrSW5maW5pdHlcIiB8fCBzdHIgPT09IFwiLUluZmluaXR5XCIpXHJcbiAgICAgICAgICAgIHJldHVybiBaRVJPO1xyXG4gICAgICAgIGlmICh0eXBlb2YgdW5zaWduZWQgPT09ICdudW1iZXInKSB7XHJcbiAgICAgICAgICAgIC8vIEZvciBnb29nLm1hdGgubG9uZyBjb21wYXRpYmlsaXR5XHJcbiAgICAgICAgICAgIHJhZGl4ID0gdW5zaWduZWQsXHJcbiAgICAgICAgICAgIHVuc2lnbmVkID0gZmFsc2U7XHJcbiAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgdW5zaWduZWQgPSAhISB1bnNpZ25lZDtcclxuICAgICAgICB9XHJcbiAgICAgICAgcmFkaXggPSByYWRpeCB8fCAxMDtcclxuICAgICAgICBpZiAocmFkaXggPCAyIHx8IDM2IDwgcmFkaXgpXHJcbiAgICAgICAgICAgIHRocm93IFJhbmdlRXJyb3IoJ3JhZGl4Jyk7XHJcblxyXG4gICAgICAgIHZhciBwO1xyXG4gICAgICAgIGlmICgocCA9IHN0ci5pbmRleE9mKCctJykpID4gMClcclxuICAgICAgICAgICAgdGhyb3cgRXJyb3IoJ2ludGVyaW9yIGh5cGhlbicpO1xyXG4gICAgICAgIGVsc2UgaWYgKHAgPT09IDApIHtcclxuICAgICAgICAgICAgcmV0dXJuIGZyb21TdHJpbmcoc3RyLnN1YnN0cmluZygxKSwgdW5zaWduZWQsIHJhZGl4KS5uZWcoKTtcclxuICAgICAgICB9XHJcblxyXG4gICAgICAgIC8vIERvIHNldmVyYWwgKDgpIGRpZ2l0cyBlYWNoIHRpbWUgdGhyb3VnaCB0aGUgbG9vcCwgc28gYXMgdG9cclxuICAgICAgICAvLyBtaW5pbWl6ZSB0aGUgY2FsbHMgdG8gdGhlIHZlcnkgZXhwZW5zaXZlIGVtdWxhdGVkIGRpdi5cclxuICAgICAgICB2YXIgcmFkaXhUb1Bvd2VyID0gZnJvbU51bWJlcihwb3dfZGJsKHJhZGl4LCA4KSk7XHJcblxyXG4gICAgICAgIHZhciByZXN1bHQgPSBaRVJPO1xyXG4gICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgc3RyLmxlbmd0aDsgaSArPSA4KSB7XHJcbiAgICAgICAgICAgIHZhciBzaXplID0gTWF0aC5taW4oOCwgc3RyLmxlbmd0aCAtIGkpLFxyXG4gICAgICAgICAgICAgICAgdmFsdWUgPSBwYXJzZUludChzdHIuc3Vic3RyaW5nKGksIGkgKyBzaXplKSwgcmFkaXgpO1xyXG4gICAgICAgICAgICBpZiAoc2l6ZSA8IDgpIHtcclxuICAgICAgICAgICAgICAgIHZhciBwb3dlciA9IGZyb21OdW1iZXIocG93X2RibChyYWRpeCwgc2l6ZSkpO1xyXG4gICAgICAgICAgICAgICAgcmVzdWx0ID0gcmVzdWx0Lm11bChwb3dlcikuYWRkKGZyb21OdW1iZXIodmFsdWUpKTtcclxuICAgICAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgICAgIHJlc3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IGJlXHJcbiAgICAvLyBubyBydW50aW1lIHBlbmFsdHkgZm9yIHRoZXNlLlxyXG5cclxuICAgIC8qKlxyXG4gICAgICogQHR5cGUge251bWJlcn1cclxuICAgICAqIEBjb25zdFxyXG4gICAgICogQGlubmVyXHJcbiAgICAgKi9cclxuICAgIHZhciBUV09fUFdSXzE2X0RCTCA9IDEgPDwgMTY7XHJcblxyXG4gICAgLyoqXHJcbiAgICAgKiBAdHlwZSB7bnVtYmVyfVxyXG4gICAgICogQGNvbnN0XHJcbiAgICAgKiBAaW5uZXJcclxuICAgICAqL1xyXG4gICAgdmFyIFRXT19QV1JfMjRfREJMID0gMSA8PCAyNDtcclxuXHJcbiAgICAvKipcclxuICAgICAqIEB0eXBlIHtudW1iZXJ9XHJcbiAgICAgKiBAY29uc3RcclxuICAgICAqIEBpbm5lclxyXG4gICAgICovXHJcbiAgICB2YXIgVFdPX1BXUl8zMl9EQkwgPSBUV09fUFdSXzE2X0RCTCAqIFRXT19QV1JfMTZfREJMO1xyXG5cclxuICAgIC8qKlxyXG4gICAgICogQHR5cGUge251bWJlcn1cclxuICAgICAqIEBjb25zdFxyXG4gICAgICogQGlubmVyXHJcbiAgICAgKi9cclxuICAgIHZhciBUV09fUFdSXzY0X0RCTCA9IFRXT19QV1JfMzJfREJMICogVFdPX1BXUl8zMl9EQkw7XHJcblxyXG4gICAgLyoqXHJcbiAgICAgKiBAdHlwZSB7bnVtYmVyfVxyXG4gICAgICogQGNvbnN0XHJcbiAgICAgKiBAaW5uZXJcclxuICAgICAqL1xyXG4gICAgdmFyIFRXT19QV1JfNjNfREJMID0gVFdPX1BXUl82NF9EQkwgLyAyO1xyXG5cclxuICAgIC8qKlxyXG4gICAgICogQHR5cGUgeyFMb25nfVxyXG4gICAgICogQGNvbnN0XHJcbiAgICAgKiBAaW5uZXJcclxuICAgICAqL1xyXG4gICAgdmFyIFRXT19QV1JfMjQgPSBmcm9tSW50KFRXT19QV1JfMjRfREJMKTtcclxuXHJcbiAgICAvKipcclxuICAgICAqIEB0eXBlIHshTG9uZ31cclxuICAgICAqIEBpbm5lclxyXG4gICAgICovXHJcbiAgICB2YXIgWkVSTyA9IGZyb21JbnQoMCk7XHJcblxyXG4gICAgLyoqXHJcbiAgICAgKiBTaWduZWQgemVyby5cclxuICAgICAqIEB0eXBlIHshTG9uZ31cclxuICAgICAqL1xyXG4gICAgTG9uZy5aRVJPID0gWkVSTztcclxuXHJcbiAgICAvKipcclxuICAgICAqIEB0eXBlIHshTG9uZ31cclxuICAgICAqIEBpbm5lclxyXG4gICAgICovXHJcbiAgICB2YXIgVVpFUk8gPSBmcm9tSW50KDAsIHRydWUpO1xyXG5cclxuICAgIC8qKlxyXG4gICAgICogVW5zaWduZWQgemVyby5cclxuICAgICAqIEB0eXBlIHshTG9uZ31cclxuICAgICAqL1xyXG4gICAgTG9uZy5VWkVSTyA9IFVaRVJPO1xyXG5cclxuICAgIC8qKlxyXG4gICAgICogQHR5cGUgeyFMb25nfVxyXG4gICAgICogQGlubmVyXHJcbiAgICAgKi9cclxuICAgIHZhciBPTkUgPSBmcm9tSW50KDEpO1xyXG5cclxuICAgIC8qKlxyXG4gICAgICogU2lnbmVkIG9uZS5cclxuICAgICAqIEB0eXBlIHshTG9uZ31cclxuICAgICAqL1xyXG4gICAgTG9uZy5PTkUgPSBPTkU7XHJcblxyXG4gICAgLyoqXHJcbiAgICAgKiBAdHlwZSB7IUxvbmd9XHJcbiAgICAgKiBAaW5uZXJcclxuICAgICAqL1xyXG4gICAgdmFyIFVPTkUgPSBmcm9tSW50KDEsIHRydWUpO1xyXG5cclxuICAgIC8qKlxyXG4gICAgICogVW5zaWduZWQgb25lLlxyXG4gICAgICogQHR5cGUgeyFMb25nfVxyXG4gICAgICovXHJcbiAgICBMb25nLlVPTkUgPSBVT05FO1xyXG5cclxuICAgIC8qKlxyXG4gICAgICogQHR5cGUgeyFMb25nfVxyXG4gICAgICogQGlubmVyXHJcbiAgICAgKi9cclxuICAgIHZhciBORUdfT05F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0gZnJvbU51bWJlcihyYWRpeCksXHJcbiAgICAgICAgICAgICAgICAgICAgZGl2ID0gdGhpcy5kaXYocmFkaXhMb25nKSxcclxuICAgICAgICAgICAgICAgICAgICByZW0xID0gZGl2Lm11bChyYWRpeExvbmcpLnN1Yih0aGlzKTtcclxuICAgICAgICAgICAgICAgIHJldHVybiBkaXYudG9TdHJpbmcocmFkaXgpICsgcmVtMS50b0ludCgpLnRvU3RyaW5nKHJhZGl4KTtcclxuICAgICAgICAgICAgfSBlbHNlXHJcbiAgICAgICAgICAgICAgICByZXR1cm4gJy0nICsgdGhpcy5uZWcoKS50b1N0cmluZyhyYWRpeCk7XHJcbiAgICAgICAgfVxyXG5cclxuICAgICAgICAvLyBEbyBzZXZlcmFsICg2KSBkaWdpdHMgZWFjaCB0aW1lIHRocm91Z2ggdGhlIGxvb3AsIHNvIGFzIHRvXHJcbiAgICAgICAgLy8gbWluaW1pemUgdGhlIGNhbGxzIHRvIHRoZSB2ZXJ5IGV4cGVuc2l2ZSBlbXVsYXRlZCBkaXYuXHJcbiAgICAgICAgdmFyIHJhZGl4VG9Qb3dlciA9IGZyb21OdW1iZXIocG93X2RibChyYWRpeCwgNiksIHRoaXMudW5zaWduZWQpLFxyXG4gICAgICAgICAgICByZW0gPSB0aGlzO1xyXG4gICAgICAgIHZhciByZXN1bHQgPSAnJztcclxuICAgICAgICB3aGlsZSAodHJ1ZSkge1xyXG4gICAgICAgICAgICB2YXIgcmVtRGl2ID0gcmVtLmRpdihyYWRpeFRvUG93ZXIpLFxyXG4gICAgICAgICAgICAgICAgaW50dmFsID0gcmVtLnN1YihyZW1EaXYubXVsKHJhZGl4VG9Qb3dlcikpLnRvSW50KCkgPj4+IDAsXHJcbiAgICAgICAgICAgICAgICBkaWdpdHMgPSBpbnR2YWwudG9TdHJpbmcocmFkaXgpO1xyXG4gICAgICAgICAgICByZW0gPSByZW1EaXY7XHJcbiAgICAgICAgICAgIGlmIChyZW0uaXNaZXJvKCkpXHJcbiAgIC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wbGllcikge1xyXG4gICAgICAgIGlmICh0aGlzLmlzWmVybygpKVxyXG4gICAgICAgICAgICByZXR1cm4gWkVSTztcclxuICAgICAgICBpZiAoIWlzTG9uZyhtdWx0aXBsaWVyKSlcclxuICAgICAgICAgICAgbXVsdGlwbGllciA9IGZyb21WYWx1ZShtdWx0aXBsaWVyKTtcclxuICAgICAgICBpZiAobXVsdGlwbGllci5pc1plcm8oKSlcclxuICAgICAgICAgICAgcmV0dXJuIFpFUk87XHJcbiAgICAgICAgaWYgKHRoaXMuZXEoTUlOX1ZBTFVFKSlcclxuICAgICAgICAgICAgcmV0dXJuIG11bHRpcGxpZXIuaXNPZGQoKSA/IE1JTl9WQUxVRSA6IFpFUk87XHJcbiAgICAgICAgaWYgKG11bHRpcGxpZXIuZXEoTUlOX1ZBTFVFKSlcclxuICAgICAgICAgICAgcmV0dXJuIHRoaXMuaXNPZGQoKSA/IE1JTl9WQUxVRSA6IFpFUk87XHJcblxyXG4gICAgICAgIGlmICh0aGlzLmlzTmVnYXRpdmUoKSkge1xyXG4gICAgICAgICAgICBpZiAobXVsdGlwbGllci5pc05lZ2F0aXZlKCkpXHJcbiAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5uZWcoKS5tdWwobXVsdGlwbGllci5uZWcoKSk7XHJcbiAgICAgICAgICAgIGVsc2VcclxuICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLm5lZygpLm11bChtdWx0aXBsaWVyKS5uZWcoKTtcclxuICAgICAgICB9IGVsc2UgaWYgKG11bHRpcGxpZXIuaXNOZWdhdGl2ZSgpKVxyXG4gICAgICAgICAgICByZXR1cm4gdGhpcy5tdWwobXVsdGlwbGllci5uZWcoKSkubmVnKCk7XHJcblxyXG4gICAgICAgIC8vIElmIGJvdGggbG9uZ3MgYXJlIHNtYWxsLCB1c2UgZmxvYXQgbXVsdGlwbGljYXRpb25cclxuICAgICAgICBpZiAodGhpcy5sdChUV09fUFdSXzI0KSAmJiBtdWx0aXBsaWVyLmx0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xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gTUlOX1ZBTFVFOyAgLy8gcmVjYWxsIHRoYXQgLU1JTl9WQUxVRSA9PSBNSU5fVkFMVUVcclxuICAgICAgICAgICAgICAgIGVsc2UgaWYgKGRpdmlzb3IuZXEoTUlOX1ZBTFVFKSlcclxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gT05FO1xyXG4gICAgICAgICAgICAgICAgZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgLy8gQXQgdGhpcyBwb2ludCwgd2UgaGF2ZSB8b3RoZXJ8ID49IDIsIHNvIHx0aGlzL290aGVyfCA8IHxNSU5fVkFMVUV8LlxyXG4gICAgICAgICAgICAgICAgICAgIHZhciBoYWxmVGhpcyA9IHRoaXMuc2hyKDEpO1xyXG4gICAgICAgICAgICAgICAgICAgIGFwcHJveCA9IGhhbGZUaGlzLmRpdihkaXZpc29yKS5zaGwoMSk7XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKGFwcHJveC5lcShaRVJPKSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZGl2aXNvci5pc05lZ2F0aXZlKCkgPyBPTkUgOiBORUdfT05FO1xyXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlbSA9IHRoaXMuc3ViKGRpdmlzb3IubXVsKGFwcHJveCkpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICByZXMgPSBhcHByb3guYWRkKHJlbS5kaXYoZGl2aXNvcikpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcmVzO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfSBlbHNlIGlmIChkaXZpc29yLmVxKE1JTl9WQUxVRSkpXHJcbiAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy51bnNpZ25lZCA/IFVaRVJPIDogWkVSTztcclxuICAgICAgICAgICAgaWYgKHRoaXMuaXNOZWdhdGl2ZSgpKSB7XHJcbiAgICAgICAgICAgICAgICBpZiAoZGl2aXNvci5pc05lZ2F0aXZlKCkpXHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMubmVnKCkuZGl2KGRpdmlzb3IubmVnKCkpO1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMubmVnKCkuZGl2KGRpdmlzb3IpLm5lZygpO1xyXG4gICAgICAgICAgICB9IGVsc2UgaWYgKGRpdmlzb3IuaXNOZWdhdGl2ZSgpKVxyXG4gICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuZGl2KGRpdmlzb3IubmVnKCkpLm5lZygpO1xyXG4gICAgICAgICAgICByZXMgPSBaRVJPO1xyXG4gICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgIC8vIFRoZSBhbGdvcml0aG0gYmVsb3cgaGFzIG5vdCBiZWVuIG1hZGUgZm9yIHVuc2lnbmVkIGxvbmdzLiBJdCdzIHRoZXJlZm9yZVxyXG4gICAgICAgICAgICAvLyByZXF1aXJlZCB0byB0YWtlIHNwZWNpYWwgY2FyZSBvZiB0aGUgTVNCIHByaW9yIHRvIHJ1bm5pbmcgaXQuXHJcbiAgICAgICAgICAgIGlmICghZGl2aXNvci51bnNpZ25lZClcclxuICAgICAgICAgICAgICAgIGRpdmlzb3IgPSBkaXZpc29yLnRvVW5zaWduZWQoKTtcclxuICAgICAgICAgICAgaWYgKGRpdmlzb3IuZ3QodGhpcykpXHJcbiAgICAgICAgICAgICAgICByZXR1cm4gVVpFUk87XHJcbiAgICAgICAgICAgIGlmIChkaXZpc29yLmd0KHRoaXMuc2hydSgxKSkpIC8vIDE1ID4+PiAxID0gNyA7IHdpdGggZGl2aXNvciA9IDggOyB0cnVlXHJcbiAgICAgICAgICAgICAgICByZXR1cm4gVU9ORTtcclxuICAgICAgICAgICAgcmVzID0gVVpFUk87XHJcbiAgICAgICAgfVxyXG5cclxuIC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0aGlzIExvbmcgdG8gc2lnbmVkLlxyXG4gICAgICogQHJldHVybnMgeyFMb25nfSBTaWduZWQgbG9uZ1xyXG4gICAgICovXHJcbiAgICBMb25nUHJvdG90eXBlLnRvU2lnbmVkID0gZnVuY3Rpb24gdG9TaWduZWQoKSB7XHJcbiAgICAgICAgaWYgKCF0aGlzLnVuc2lnbmVkKVxyXG4gICAgICAgICAgICByZXR1cm4gdGhpcztcclxuICAgICAgICByZXR1cm4gZnJvbUJpdHModGhpcy5sb3csIHRoaXMuaGlnaCwgZmFsc2UpO1xyXG4gICAgfTtcclxuXHJcbiAgICAvKipcclxuICAgICAqIENvbnZlcnRzIHRoaXMgTG9uZyB0byB1bnNpZ25lZC5cclxuICAgICAqIEByZXR1cm5zIHshTG9uZ30gVW5zaWduZWQgbG9uZ1xyXG4gICAgICovXHJcbiAgICBMb25nUHJvdG90eXBlLnRvVW5zaWduZWQgPSBmdW5jdGlvbiB0b1Vuc2lnbmVkKCkge1xyXG4gICAgICAgIGlmICh0aGlzLnVuc2lnbmVkKVxyXG4gICAgICAgICAgICByZXR1cm4gdGhpcztcclxuICAgICAgICByZXR1cm4gZnJvbUJpdHModGhpcy5sb3csIHRoaXMuaGlnaCwgdHJ1ZSk7XHJcbiAgICB9O1xyXG5cclxuICAgIC8qKlxyXG4gICAgICogQ29udmVydHMgdGhpcyBMb25nIHRvIGl0cyBieXRlIHJlcHJlc2VudGF0aW9uLlxyXG4gICAgICogQHBhcmFtIHtib29sZWFuPX0gbGUgV2hldGhlciBsaXR0bGUgb3IgYmlnIGVuZGlhbiwgZGVmYXVsdHMgdG8gYmlnIGVuZGlhblxyXG4gICAgICogQHJldHVybnMgeyFBcnJheS48bnVtYmVyPn0gQnl0ZSByZXByZXNlbnRhdGlvblxyXG4gICAgICovXHJcbiAgICBMb25nUHJvdG90eXBlLnRvQnl0ZXMgPSBmdW5jdGlvbihsZSkge1xyXG4gICAgICAgIHJldHVybiBsZSA/IHRoaXMudG9CeXRlc0xFKC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ICB2YXIgaGkgPSB0aGlzLmhpZ2gsXHJcbiAgICAgICAgICAgIGxvID0gdGhpcy5sb3c7XHJcbiAgICAgICAgcmV0dXJuIFtcclxuICAgICAgICAgICAgKGhpID4+PiAyNCkgJiAweGZmLFxyXG4gICAgICAgICAgICAoaGkgPj4+IDE2KSAmIDB4ZmYsXHJcbiAgICAgICAgICAgIChoaSA+Pj4gIDgpICYgMHhmZixcclxuICAgICAgICAgICAgIGhpICAgICAgICAgJiAweGZmLFxyXG4gICAgICAgICAgICAobG8gPj4+IDI0KSAmIDB4ZmYsXHJcbiAgICAgICAgICAgIChsbyA+Pj4gMTYpICYgMHhmZixcclxuICAgICAgICAgICAgKGxvID4+PiAgOCkgJiAweGZmLFxyXG4gICAgICAgICAgICAgbG8gICAgICAgICAmIDB4ZmZcclxuICAgICAgICBdO1xyXG4gICAgfVxyXG5cclxuICAgIHJldHVybiBMb25nO1xyXG59KTtcclxuIiwiLypcbm9iamVjdC1hc3NpZ25cbihjKSBTaW5kcmUgU29yaHVzXG5AbGljZW5zZSBNSVRcbiovXG5cbid1c2Ugc3RyaWN0Jztcbi8qIGVzbGludC1kaXNhYmxlIG5vLXVudXNlZC12YXJzICovXG52YXIgZ2V0T3duUHJvcGVydHlTeW1ib2xzID0gT2JqZWN0LmdldE93blByb3BlcnR5U3ltYm9scztcbnZhciBoYXNPd25Qcm9wZXJ0eSA9IE9iamVjdC5wcm90b3R5cGUuaGFzT3duUHJvcGVydHk7XG52YXIgcHJvcElzRW51bWVyYWJsZSA9IE9iamVjdC5wcm90b3R5cGUucHJvcGVydHlJc0VudW1lcmFibGU7XG5cbmZ1bmN0aW9uIHRvT2JqZWN0KHZhbCkge1xuXHRpZiAodmFsID09PSBudWxsIHx8IHZhbCA9PT0gdW5kZWZpbmVkKSB7XG5cdFx0dGhyb3cgbmV3IFR5cGVFcnJvcignT2JqZWN0LmFzc2lnbiBjYW5ub3QgYmUgY2FsbGVkIHdpdGggbnVsbCBvciB1bmRlZmluZWQ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1xuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIGlmIChyZXNwb25zZSA9PT0gbnVsbCkge1xuICAgICAgICAgICAgICAgICAgICBzZWxmLmVuZCgvKiBlbmRlZEJ5UlBDICovIHRydWUpO1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdW5kZWZpbmVkO1xuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIGlmICghKHJlc3BvbnNlIGluc3RhbmNlb2YgcmVzcG9uc2VDdG9yKSkge1xuICAgICAgICAgICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICAgICAgICAgICAgcmVzcG9uc2UgPSByZXNwb25zZUN0b3Jbc2VsZi5yZXNwb25zZURlbGltaXRlZCA/IFwiZGVjb2RlRGVsaW1pdGVkXCIgOiBcImRlY29kZVwiXShyZXNwb25zZSk7XG4gICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGVycikge1xuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5lbWl0KFwiZXJyb3JcIiwgZXJyLCBtZXRob2QpO1xuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGNhbGxiYWNrKGVycik7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBzZWxmLmVtaXQoXCJkYXRhXCIsIHJlc3BvbnNlLCBtZXRob2QpO1xuICAgICAgICAgICAgICAgIHJldHVybiBjYWxsYmFjayhudWxsLCByZXNwb25zZSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICk7XG4gICAgfSBjYXRjaCAoZXJyKSB7XG4gICAgICAgIHNlbGYuZW1pdChcImVycm9yXCIsIGVyciwgbWV0aG9kKTtcbiAgICAgICAgc2V0VGltZW91dChmdW5jdGlvbigpIHsgY2FsbGJhY2soZXJyKTsgfSwgMCk7XG4gICAgICAgIHJldHVybiB1bmRlZmluZWQ7XG4gICAgfVxufTtcblxuLyoqXG4gKiBFbmRzIHRoaX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WVsZDtcblxuICAgICAgICAgIGlmIChyZWNvcmQuYXJnID09PSBDb250aW51ZVNlbnRpbmVsKSB7XG4gICAgICAgICAgICBjb250aW51ZTtcbiAgICAgICAgICB9XG5cbiAgICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgdmFsdWU6IHJlY29yZC5hcmcsXG4gICAgICAgICAgICBkb25lOiBjb250ZXh0LmRvbmVcbiAgICAgICAgICB9O1xuXG4gICAgICAgIH0gZWxzZSBpZiAocmVjb3JkLnR5cGUgPT09IFwidGhyb3dcIikge1xuICAgICAgICAgIHN0YXRlID0gR2VuU3RhdGVDb21wbGV0ZWQ7XG4gICAgICAgICAgLy8gRGlzcGF0Y2ggdGhlIGV4Y2VwdGlvbiBieSBsb29waW5nIGJhY2sgYXJvdW5kIHRvIHRoZVxuICAgICAgICAgIC8vIGNvbnRleHQuZGlzcGF0Y2hFeGNlcHRpb24oY29udGV4dC5hcmcpIGNhbGwgYWJvdmUuXG4gICAgICAgICAgY29udGV4dC5tZXRob2QgPSBcInRocm93XCI7XG4gICAgICAgICAgY29udGV4dC5hcmcgPSByZWNvcmQuYXJnO1xuICAgICAgICB9XG4gICAgICB9XG4gICAgfTtcbiAgfVxuXG4gIC8vIENhbGwgZGVsZWdhdGUuaXRlcmF0b3JbY29udGV4dC5tZXRob2RdKGNvbnRleHQuYXJnKSBhbmQgaGFuZGxlIHRoZVxuICAvLyByZXN1bHQsIGVpdGhlciBieSByZXR1cm5pbmcgYSB7IHZhbHVlLCBkb25lIH0gcmVzdWx0IGZyb20gdGhlXG4gIC8vIGRlbGVnYXRlIGl0ZXJhdG9yLCBvciBieSBtb2RpZnlpbmcgY29udGV4dC5tZXRob2QgYW5kIGNvbnRleHQuYXJnLFxuICAvLyBzZXR0aW5nIGNvbnRleHQuZGVsZWdhdGUgdG8gbnVsbCwgYW5kIHJldHVybmluZyB0aGUgQ29udGludWVTZW50aW5lbC5cbiAgZnVuY3Rpb24gbWF5YmVJbnZva2VEZWxlZ2F0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ZXQgdGhhdCBvdmVycmlkZSB0aGUgVHlwZUVycm9yIGJlbG93LlxuICAgICAgICAgICAgcmV0dXJuIENvbnRpbnVlU2VudGluZWw7XG4gICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgY29udGV4dC5tZXRob2QgPSBcInRocm93XCI7XG4gICAgICAgIGNvbnRleHQuYXJnID0gbmV3IFR5cGVFcnJvcihcbiAgICAgICAgICBcIlRoZSBpdGVyYXRvciBkb2VzIG5vdCBwcm92aWRlIGEgJ3Rocm93JyBtZXRob2RcIik7XG4gICAgICB9XG5cbiAgICAgIHJldHVybiBDb250aW51ZVNlbnRpbmVsO1xuICAgIH1cblxuICAgIHZhciByZWNvcmQgPSB0cnlDYXRjaChtZXRob2QsIGRlbGVnYXRlLml0ZXJhdG9yLCBjb250ZXh0LmFyZyk7XG5cbiAgICBpZiAocmVjb3JkLnR5cGUgPT09IFwidGhyb3dcIikge1xuICAgICAgY29udGV4dC5tZXRob2QgPSBcInRocm93XCI7XG4gICAgICBjb250ZXh0LmFyZyA9IHJlY29yZC5hcmc7XG4gICAgICBjb250ZXh0LmRlbGVnYXRlID0gbnVsbDtcbiAgICAgIHJldHVybiBDb250aW51ZVNlbnRpbmVsO1xuICAgIH1cblxuICAgIHZhciBpbmZvID0gcmVjb3JkLmFyZztcblxuICAgIGlmICghIGluZm8pIHtcbiAgICAgIGNvbnRleHQubWV0aG9kID0gXCJ0aHJvd1wiO1xuICAgICAgY29udGV4dC5hcmcgPSBuZXcgVHlwZUVycm9yKFwiaXRlcmF0b3IgcmVzdWx0IGlzIG5vdCBhbiBvYmplY3RcIik7XG4gICAgICBjb250ZXh0LmRlbGVnYXRlID0gbnVsbDtcbiAgICAgIHJldHVybiBDb250aW51ZVNlbnRpbmVsO1xuICAgIH1cblxuICAgIGlmIChpbmZvLmRvbmUpIHtcbiAgICAgIC8vIEFzc2lnbiB0aGUgcmVzdWx0IG9mIHRoZSBmaW5pc2hlZCBkZWxlZ2F0ZSB0byB0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gdGhlIGV4Y2VwdGlvbiBub3JtYWxseS5cbiAgICAgICAgICBjb250ZXh0Lm1ldGhvZCA9IFwibmV4dFwiO1xuICAgICAgICAgIGNvbnRleHQuYXJnID0gdW5kZWZpbmVkO1xuICAgICAgICB9XG5cbiAgICAgICAgcmV0dXJuICEhIGNhdWdodDtcbiAgICAgIH1cblxuICAgICAgZm9yICh2YXIgaSA9IHRoaXMudHJ5RW50cmllcy5sZW5ndGggLSAxOyBpID49IDA7IC0taSkge1xuICAgICAgICB2YXIgZW50cnkgPSB0aGlzLnRyeUVudHJpZXNbaV07XG4gICAgICAgIHZhciByZWNvcmQgPSBlbnRyeS5jb21wbGV0aW9uO1xuXG4gICAgICAgIGlmIChlbnRyeS50cnlMb2MgPT09IFwicm9vdFwiKSB7XG4gICAgICAgICAgLy8gRXhjZXB0aW9uIHRocm93biBvdXRzaWRlIG9mIGFueSB0cnkgYmxvY2sgdGhhdCBjb3VsZCBoYW5kbGVcbiAgICAgICAgICAvLyBpdCwgc28gc2V0IHRoZSBjb21wbGV0aW9uIHZhbHVlIG9mIHRoZSBlbnRpcmUgZnVuY3Rpb24gdG9cbiAgICAgICAgICAvLyB0aHJvdyB0aGUgZXhjZXB0aW9uLlxuICAgICAgICAgIHJldHVybiBoYW5kbGUoXCJlbmRcIik7XG4gICAgICAgIH1cblxuICAgICAgICBpZiAoZW50cnkudHJ5TG9jIDw9IHRoaXMucHJldikge1xuICAgICAgICAgIHZhciBoYXNDYXRjaCA9IGhhc093bi5jYWxsKGVudHJ5LCBcImNhdGNoTG9jXCIpO1xuICAgICAgICAgIHZhciBoYXNGaW5hbGx5ID0gaGFzT3duLmNhbGwoZW50cnksIFwiZmluYWxseUxvY1wiKTtcblxuICAgICAgICAgIGlmIChoYXNDYXRjaCAmJiBoYXNGaW5hbGx5KSB7XG4gICAgICAgICAgICBpZiAodGhpcy5wcmV2IDwgZW50cnkuY2F0Y2hMb2MpIHtcbiAgICAgICAgICAgICAgcmV0dXJuIGhhbmRsZShlbnRyeS5jYXRjaExvYywgdHJ1ZSk7XG4gICAgICAgICAgICB9IGVsc2UgaWYgKHRoaXMucHJldiA8IGVudHJ5LmZpbmFsbHlMb2MpIHtcbiAgICAgICAgICAgICAgcmV0dXJuIGhhbmRsZShlbnRyeS5maW5hbGx5TG9jKTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgIH0gZWxzZSBpZiAoaGFzQ2F0Y2gpIHtcbiAgICAgICAgICAgIGlmICh0aGlzLnByZXYgPCBlbnRyeS5jYXRjaExvYykge1xuICAgICAgICAgICAgICByZXR1cm4gaGFuZGxlKGVudHJ5LmNhdGNoTG9jLCB0cnVlKTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgIH0gZWxzZSBpZiAoaGFzRmluYWxseSkge1xuICAgICAgICAgICAgaWYgKHRoaXMucHJldiA8IGVudHJ5LmZpbmFsbHlMb2MpIHtcbiAgICAgICAgICAgICAgcmV0dXJuIGhhbmRsZShlbnRyeS5maW5hbGx5TG9jKTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXCJ0cnkgc3RhdGVtZW50IHdpdGhvdXQgY2F0Y2ggb3IgZmluYWxseVwiKTtcbiAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICB9LFxuXG4gICAgYWJydXB0OiBmdW5jdGlvbih0eXBlLCBhcmcpIHtcbiAgICAgIGZvciAodmFyIGkgPSB0aGlzLnRyeUVudHJpZXMubGVuZ3RoIC0gMTsgaSA+PSAwOyAtLWkpIHtcbiAgICAgICAgdmFyIGVudHJ5ID0gdGhpcy50cnlFbnRyaWVzW2ldO1xuICAgICAgICBpZiAoZW50cnkudHJ5TG9jIDw9IHRoaXMucHJldiAmJlxuICAgICAgICAgICAgaGFzT3duLmNhbGwoZW50cnksIFwiZmluYWxseUxvY1wiKSAmJlxuICAgICAgICAgICAgdGhpcy5wcmV2IDwgZW50cnkuZmluYWxseUxvYykge1xuICAgICAgICAgIHZhciBmaW5hbGx5RW50cnkgPSBlbnRyeTtcbiAgICAgICAgICBicmVhaztcbiAgICAgICAgfVxuICAgICAgfVxuXG4gICAgICBpZiAoZmluYWxseUVudHJ5ICYmXG4gICAgICAgICAgKHR5cGUgPT09IFwiYnJlYWtcIiB8fFxuICAgICAgICAgICB0eXBlID09PSBcImNvbnRpbnVlXCIpICYmXG4gICAgICAgICAgZmluYWxseUVudHJ5LnRyeUxvYyA8PSBhcmcgJiZcbiAgICAgICAgICBhcmcgPD0gZmluYWxseUVudHJ5LmZpbmFsbHlMb2MpIHtcbiAgICAgICAgLy8gSWdub3JlIHRoZSBmaW5hbGx5IGVudHJ5IGlmIGNvbnRyb2wgaXMgbm90IGp1bXBpbmcgdG8gYVxuICAgICAgICAvLyBsb2NhdGlvbiBvdXRzaWRlIHRoZSB0cnkvY2F0Y2ggYmxvY2suXG4gICAgICAgIGZpbmFsbHlFbnRyeSA9IG51bGw7XG4gICAgICB9XG5cbiAgICAgIHZhciByZWNvcmQgPSBmaW5hbGx5RW50cnkgPyBmaW5hbGx5RW50cnkuY29tcGxldGlvbiA6IHt9O1xuICAgICAgcmVjb3JkLnR5cGUgPSB0eXBlO1xuICAgICAgcmVjb3JkLmFyZyA9IGFyZztcblxuICAgICAgaWYgKGZpbmFsbHlFbnRyeSkge1xuICAgICAgICB0aGlzLm1ldGhvZCA9IFwibmV4dFwiO1xuICAgICAgICB0aGlzLm5leHQgPSBmaW5hbGx5RW50cnkuZmluYWxseUxvYztcbiAgICAgICAgcmV0dXJuIENvbnRpbnVlU2VudGluZWw7XG4gICAgICB9XG5cbiAgICAgIHJldHVybiB0aGlzLmNvbXBsZXRlKHJlY29yZCk7XG4gICAgfSxcblxuICAgIGNvbXBsZXRlOiBmdW5jdGlvbihyZWNvcmQsIGFmdGVyTG9jKSB7XG4gICAgICBpZiAocmVjb3JkLnR5cGUgPT09IFwidGhyb3dcIikge1xuICAgICAgICB0aHJ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gICAgICAgICAgIG5ld3BhcnQgKz0gcGFydFtqXTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgICAgLy8gd2UgdGVzdCBhZ2FpbiB3aXRoIEFTQ0lJIGNoYXIgb25seVxuICAgICAgICAgIGlmICghbmV3cGFydC5tYXRjaChob3N0bmFtZVBhcnRQYXR0ZXJuKSkge1xuICAgICAgICAgICAgdmFyIHZhbGlkUGFydHMgPSBob3N0cGFydHMuc2xpY2UoMCwgaSk7XG4gICAgICAgICAgICB2YXIgbm90SG9zdCA9IGhvc3RwYXJ0cy5zbGljZShpICsgMSk7XG4gICAgICAgICAgICB2YXIgYml0ID0gcGFydC5tYXRjaChob3N0bmFtZVBhcnRTdGFydCk7XG4gICAgICAgICAgICBpZiAoYml0KSB7XG4gICAgICAgICAgICAgIHZhbGlkUGFydHMucHVzaChiaXRbMV0pO1xuICAgICAgICAgICAgICBub3RIb3N0LnVuc2hpZnQoYml0WzJdKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChub3RIb3N0Lmxlbmd0aCkge1xuICAgICAgICAgICAgICByZXN0ID0gJy8nICsgbm90SG9zdC5qb2luKCcuJykgKyByZXN0O1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgdGhpcy5ob3N0bmFtZSA9IHZhbGlkUGFydHMuam9pbignLicpO1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICB9XG4gICAgfVxuXG4gICAgaWYgKHRoaXMuaG9zdG5hbWUubGVuZ3RoID4gaG9zdG5hbWVNYXhMZW4pIHtcbiAgICAgIHRoaXMuaG9zdG5hbWUgPSAnJztcbiAgICB9IGVsc2Uge1xuICAgICAgLy8gaG9zdG5hbWVzIGFyZSBhbHdheXMgbG93ZXIgY2FzZS5cbiAgICAgIHRoaXMuaG9zdG5hbWUgPSB0aGlzLmhvc3RuYW1lLnRvTG93ZXJDYXNlKCk7XG4gICAgfVxuXG4gICAgaW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RvdHlwZS5oYXNPd25Qcm9wZXJ0eTtcblxuZnVuY3Rpb24gZXh0ZW5kKCkge1xuICAgIHZhciB0YXJnZXQgPSB7fVxuXG4gICAgZm9yICh2YXIgaSA9IDA7IGkgPCBhcmd1bWVudHMubGVuZ3RoOyBpKyspIHtcbiAgICAgICAgdmFyIHNvdXJjZSA9IGFyZ3VtZW50c1tpXVxuXG4gICAgICAgIGZvciAodmFyIGtleSBpbiBzb3VyY2UpIHtcbiAgICAgICAgICAgIGlmIChoYXNPd25Qcm9wZXJ0eS5jYWxsKHNvdXJjZSwga2V5KSkge1xuICAgICAgICAgICAgICAgIHRhcmdldFtrZXldID0gc291cmNlW2tleV1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cblxuICAgIHJldHVybiB0YXJnZXRcbn1cbiJdfQ== diff --git a/dist/index.d.ts b/dist/index.d.ts index 3ced0617a..0cefffbab 100644 --- a/dist/index.d.ts +++ b/dist/index.d.ts @@ -5,6 +5,7 @@ export * from "./entities/networkable"; export * from "./entities/player"; export * from "./entities/team"; export * from "./entities/weapon"; +export * from "./entities/projectile"; export * from "./ext/bitbuffer"; export * from "./convars"; export * from "./demo"; diff --git a/dist/index.js b/dist/index.js index 3784014ce..e54af9ecb 100644 --- a/dist/index.js +++ b/dist/index.js @@ -23,6 +23,7 @@ __exportStar(require("./entities/networkable"), exports); __exportStar(require("./entities/player"), exports); __exportStar(require("./entities/team"), exports); __exportStar(require("./entities/weapon"), exports); +__exportStar(require("./entities/projectile"), exports); __exportStar(require("./ext/bitbuffer"), exports); __exportStar(require("./convars"), exports); __exportStar(require("./demo"), exports); diff --git a/dist/index.js.map b/dist/index.js.map index ddfb08237..ae2bd1b35 100644 --- a/dist/index.js.map +++ b/dist/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,mDAAmD;;;;;;;;;;;;;;;;;AAEnD,wDAAsC;AACtC,uDAAqC;AACrC,yDAAuC;AACvC,oDAAkC;AAClC,kDAAgC;AAChC,oDAAkC;AAClC,kDAAgC;AAChC,4CAA0B;AAC1B,yCAAuB;AACvB,6CAA2B;AAC3B,+CAA6B;AAC7B,8CAA4B;AAC5B,+CAA6B;AAC7B,mDAAiC;AACjC,iDAA+B;AAC/B,iDAA+B;AAC/B,8CAA4B;AAC5B,8CAA4B;AAC5B,yCAAmD;AAA1C,iHAAA,oBAAoB,OAAA;AAC7B,2CAA0D;AAAjD,wHAAA,0BAA0B,OAAA"} \ No newline at end of file +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,mDAAmD;;;;;;;;;;;;;;;;;AAEnD,wDAAsC;AACtC,uDAAqC;AACrC,yDAAuC;AACvC,oDAAkC;AAClC,kDAAgC;AAChC,oDAAkC;AAClC,wDAAsC;AACtC,kDAAgC;AAChC,4CAA0B;AAC1B,yCAAuB;AACvB,6CAA2B;AAC3B,+CAA6B;AAC7B,8CAA4B;AAC5B,+CAA6B;AAC7B,mDAAiC;AACjC,iDAA+B;AAC/B,iDAA+B;AAC/B,8CAA4B;AAC5B,8CAA4B;AAC5B,yCAAmD;AAA1C,iHAAA,oBAAoB,OAAA;AAC7B,2CAA0D;AAAjD,wHAAA,0BAA0B,OAAA"} \ No newline at end of file diff --git a/docs/classes/BaseEntity.html b/docs/classes/BaseEntity.html index b27fd8efa..f1ddfd843 100644 --- a/docs/classes/BaseEntity.html +++ b/docs/classes/BaseEntity.html @@ -34,7 +34,7 @@

Hierarchy

  • Weapon
  • Projectile
  • +
  • Defined in src/entities/baseentity.ts:8
  • @@ -100,7 +100,7 @@
    props: undefinedReturns BaseEntity<Props>
    +
  • Defined in src/entities/networkable.ts:48
  • Properties

    @@ -108,7 +108,7 @@
    +
  • Defined in src/entities/networkable.ts:46
  • classId: number
    @@ -116,7 +116,7 @@
    +
  • Defined in src/entities/networkable.ts:32
  • deleting: boolean = false
    @@ -124,7 +124,7 @@
    +
  • Defined in src/entities/networkable.ts:44
  • index: number
    @@ -132,13 +132,13 @@
    +
  • Defined in src/entities/networkable.ts:27
  • props: Props
    +
  • Defined in src/entities/networkable.ts:39
  • serialNum: number
    @@ -146,7 +146,7 @@
    +
  • Defined in src/entities/networkable.ts:37
  • Accessors

    @@ -160,7 +160,7 @@

    Returns

    Number uniquely identifying this entity. Should be unique thr

    Returns number

    +
  • Defined in src/entities/networkable.ts:20
  • +
  • Defined in src/entities/networkable.ts:121
    • @@ -183,7 +183,7 @@

      Returns

      Name of the model that should be rendered for this entity. (e

      Returns null | string

    +
  • Defined in src/entities/baseentity.ts:71
  • +
  • Defined in src/entities/baseentity.ts:32
  • +
  • Defined in src/entities/baseentity.ts:42
  • +
  • Defined in src/entities/baseentity.ts:15
  • +
  • Defined in src/entities/networkable.ts:13
  • +
  • Defined in src/entities/baseentity.ts:59
    • @@ -252,7 +252,7 @@

      Returns

      Team number (0: Unassigned, 1: Spectator, 2: Terrorist, 3: Co

      Returns number

    +
  • Defined in src/entities/baseentity.ts:52
  • Methods

    @@ -281,7 +281,7 @@
    tableName: T

    Returns ArrayType

    +
  • Defined in src/entities/networkable.ts:80
  • +
  • Defined in src/entities/networkable.ts:69
  • +
  • Defined in src/entities/networkable.ts:125
  • +
  • Defined in src/entities/networkable.ts:101
  • +
  • Defined in typings/bit-buffer.d.ts:58
  • byteIndex: number

    Get/set the current index in bytes

    +
  • Defined in typings/bit-buffer.d.ts:43
  • index: number

    Get/set the current index in bits

    +
  • Defined in typings/bit-buffer.d.ts:63
  • length: number

    Get the length of the stream in bits

    +
  • Defined in typings/bit-buffer.d.ts:53
  • view: BitView

    Underlying BitView

    +
  • Defined in typings/bit-buffer.d.ts:48
  • from: ((array: Uint8Array) => BitStream)
    @@ -165,7 +165,7 @@

    Parameters

    array: Uint8Array

    Returns BitStream

    +
  • Defined in typings/bit-buffer.d.ts:39
  • Methods

    @@ -180,7 +180,7 @@

    Parameters

    Optional maxLength: number

    Returns string

    +
  • Defined in typings/bit-buffer.d.ts:90
    • @@ -193,7 +193,7 @@

      Parameters

      length: number

    Returns ArrayBuffer

    +
  • Defined in typings/bit-buffer.d.ts:95
    • @@ -206,7 +206,7 @@

      Parameters

      bits: number

    Returns number

    +
  • Defined in src/ext/bitbuffer.ts:37
    • @@ -219,7 +219,7 @@

      Parameters

      bits: number

    Returns number

    +
  • Defined in src/ext/bitbuffer.ts:36
    • @@ -232,7 +232,7 @@

      Parameters

      bits: number

    Returns number

    +
  • Defined in src/ext/bitbuffer.ts:35
  • +
  • Defined in src/ext/bitbuffer.ts:30
  • +
  • Defined in src/ext/bitbuffer.ts:33
  • +
  • Defined in src/ext/bitbuffer.ts:32
  • +
  • Defined in src/ext/bitbuffer.ts:31
  • +
  • Defined in src/ext/bitbuffer.ts:34
    • @@ -285,7 +285,7 @@

      Parameters

      length: number

    Returns BitStream

    +
  • Defined in typings/bit-buffer.d.ts:94
    • @@ -300,7 +300,7 @@
      bits: number
      signed: boolean

    Returns number

    +
  • Defined in typings/bit-buffer.d.ts:70
  • +
  • Defined in typings/bit-buffer.d.ts:88
    • @@ -321,7 +321,7 @@

      Parameters

      bytes: number

    Returns Buffer

    +
  • Defined in src/ext/bitbuffer.ts:25
  • +
  • Defined in src/ext/bitbuffer.ts:39
  • +
  • Defined in typings/bit-buffer.d.ts:84
  • +
  • Defined in typings/bit-buffer.d.ts:85
  • +
  • Defined in typings/bit-buffer.d.ts:76
  • +
  • Defined in typings/bit-buffer.d.ts:77
  • +
  • Defined in typings/bit-buffer.d.ts:75
  • +
  • Defined in src/ext/bitbuffer.ts:26
    • @@ -390,7 +390,7 @@

      Parameters

      bits: number

    Returns number

    +
  • Defined in src/ext/bitbuffer.ts:28
    • @@ -403,7 +403,7 @@

      Parameters

      bytes: number

    Returns string

    +
  • Defined in src/ext/bitbuffer.ts:24
  • +
  • Defined in src/ext/bitbuffer.ts:29
    • @@ -424,7 +424,7 @@

      Parameters

      bits: number

    Returns number

    +
  • Defined in src/ext/bitbuffer.ts:27
  • +
  • Defined in src/ext/bitbuffer.ts:41
  • +
  • Defined in src/ext/bitbuffer.ts:42
  • +
  • Defined in src/ext/bitbuffer.ts:40
    • @@ -461,7 +461,7 @@

      Parameters

      Optional maxLength: number

    Returns string

    +
  • Defined in typings/bit-buffer.d.ts:91
  • +
  • Defined in src/ext/bitbuffer.ts:43
  • +
  • Defined in typings/bit-buffer.d.ts:73
  • +
  • Defined in typings/bit-buffer.d.ts:74
  • +
  • Defined in typings/bit-buffer.d.ts:72
  • +
  • Defined in src/ext/bitbuffer.ts:44
    • @@ -516,7 +516,7 @@
      str: string
      Optional maxLength: number

    Returns string

    +
  • Defined in typings/bit-buffer.d.ts:92
    • @@ -531,7 +531,7 @@
      value: number
      bits: number

    Returns void

    +
  • Defined in typings/bit-buffer.d.ts:71
    • @@ -544,7 +544,7 @@

      Parameters

      value: boolean

    Returns void

    +
  • Defined in typings/bit-buffer.d.ts:89
    • @@ -557,7 +557,7 @@

      Parameters

      value: number

    Returns void

    +
  • Defined in typings/bit-buffer.d.ts:86
    • @@ -570,7 +570,7 @@

      Parameters

      value: number

    Returns void

    +
  • Defined in typings/bit-buffer.d.ts:87
    • @@ -583,7 +583,7 @@

      Parameters

      value: number

    Returns void

    +
  • Defined in typings/bit-buffer.d.ts:82
    • @@ -596,7 +596,7 @@

      Parameters

      value: number

    Returns void

    +
  • Defined in typings/bit-buffer.d.ts:83
    • @@ -609,7 +609,7 @@

      Parameters

      value: number

    Returns void

    +
  • Defined in typings/bit-buffer.d.ts:81
    • @@ -622,7 +622,7 @@

      Parameters

      value: number

    Returns void

    +
  • Defined in src/ext/bitbuffer.ts:46
    • @@ -635,7 +635,7 @@

      Parameters

      value: number

    Returns void

    +
  • Defined in src/ext/bitbuffer.ts:47
    • @@ -648,7 +648,7 @@

      Parameters

      value: number

    Returns void

    +
  • Defined in src/ext/bitbuffer.ts:45
    • @@ -663,7 +663,7 @@
      str: string
      Optional maxLength: number

    Returns string

    +
  • Defined in typings/bit-buffer.d.ts:93
    • @@ -676,7 +676,7 @@

      Parameters

      value: number

    Returns void

    +
  • Defined in typings/bit-buffer.d.ts:79
    • @@ -689,7 +689,7 @@

      Parameters

      value: number

    Returns void

    +
  • Defined in typings/bit-buffer.d.ts:80
    • @@ -702,7 +702,7 @@

      Parameters

      value: number

    Returns void

    +
  • Defined in typings/bit-buffer.d.ts:78
  • Returns number

    +
  • Defined in typings/bit-buffer.d.ts:11
    • @@ -115,7 +115,7 @@

      Parameters

      offset: number

    Returns number

    +
  • Defined in typings/bit-buffer.d.ts:19
    • @@ -128,7 +128,7 @@

      Parameters

      offset: number

    Returns number

    +
  • Defined in typings/bit-buffer.d.ts:20
    • @@ -141,7 +141,7 @@

      Parameters

      offset: number

    Returns number

    +
  • Defined in typings/bit-buffer.d.ts:15
    • @@ -154,7 +154,7 @@

      Parameters

      offset: number

    Returns number

    +
  • Defined in typings/bit-buffer.d.ts:17
    • @@ -167,7 +167,7 @@

      Parameters

      offset: number

    Returns number

    +
  • Defined in typings/bit-buffer.d.ts:13
    • @@ -180,7 +180,7 @@

      Parameters

      offset: number

    Returns number

    +
  • Defined in typings/bit-buffer.d.ts:16
    • @@ -193,7 +193,7 @@

      Parameters

      offset: number

    Returns number

    +
  • Defined in typings/bit-buffer.d.ts:18
    • @@ -206,7 +206,7 @@

      Parameters

      offset: number

    Returns number

    +
  • Defined in typings/bit-buffer.d.ts:14
    • @@ -225,7 +225,7 @@
      value: number
      bits: number

    Returns void

    +
  • Defined in typings/bit-buffer.d.ts:25
    • @@ -240,7 +240,7 @@
      offset: number
      value: number

    Returns number

    +
  • Defined in typings/bit-buffer.d.ts:33
    • @@ -255,7 +255,7 @@
      offset: number
      value: number

    Returns number

    +
  • Defined in typings/bit-buffer.d.ts:34
    • @@ -270,7 +270,7 @@
      offset: number
      value: number

    Returns number

    +
  • Defined in typings/bit-buffer.d.ts:29
    • @@ -285,7 +285,7 @@
      offset: number
      value: number

    Returns number

    +
  • Defined in typings/bit-buffer.d.ts:31
    • @@ -300,7 +300,7 @@
      offset: number
      value: number

    Returns number

    +
  • Defined in typings/bit-buffer.d.ts:27
    • @@ -315,7 +315,7 @@
      offset: number
      value: number

    Returns number

    +
  • Defined in typings/bit-buffer.d.ts:30
    • @@ -330,7 +330,7 @@
      offset: number
      value: number

    Returns number

    +
  • Defined in typings/bit-buffer.d.ts:32
    • @@ -345,7 +345,7 @@
      offset: number
      value: number

    Returns number

    +
  • Defined in typings/bit-buffer.d.ts:28
  • Returns void

    +
  • Defined in src/convars.ts:28
    • @@ -302,7 +302,7 @@
      event: IConVarChangeEvent
      <

      Returns void

    Returns ConVars

    +
  • Defined in src/convars.ts:15
    • diff --git a/docs/classes/DemoFile.html b/docs/classes/DemoFile.html index 1ea2a03f0..b06724cbc 100644 --- a/docs/classes/DemoFile.html +++ b/docs/classes/DemoFile.html @@ -25,8 +25,8 @@

      Hierarchy

      • DemoFile
    +
  • Defined in src/demo.ts:241
  • +
  • Defined in src/demo.ts:473
  • @@ -134,86 +134,86 @@

    Fires

    DemoFile#end

    Returns DemoFile

    +
  • Defined in src/demo.ts:571
  • Properties

    _bytebuf: ByteBuffer
    +
  • Defined in src/demo.ts:542
  • _chunks: Buffer[] = []
    +
  • Defined in src/demo.ts:543
  • _encryptionKey: null | Uint8Array = null
    +
  • Defined in src/demo.ts:549
  • _hasEnded: boolean = false
    +
  • Defined in src/demo.ts:551
  • _immediateTimerToken: null | Immediate = null
    +
  • Defined in src/demo.ts:546
  • _isBroadcastFragment: boolean = false
    +
  • Defined in src/demo.ts:553
  • _lastThreadYieldTime: number = 0
    +
  • Defined in src/demo.ts:545
  • _supplementCleanupFns: Map<ISupplementInfo, (() => void)> = ...
    +
  • Defined in src/demo.ts:560
  • _supplementEvents: readonly [ISupplementInfo, ISupplementInfo, ISupplementInfo] = ...
    +
  • Defined in src/demo.ts:555
  • _timeoutTimerToken: null | Timer = null
    +
  • Defined in src/demo.ts:547
  • conVars: ConVars
    +
  • Defined in src/demo.ts:540
  • currentTick: number = -1

    When parsing, set to current tick.

    +
  • Defined in src/demo.ts:515
  • entities: Entities
    +
  • Defined in src/demo.ts:536
  • gameEvents: GameEvents
    +
  • Defined in src/demo.ts:537
  • header: IDemoHeader
    +
  • Defined in src/demo.ts:522
  • playerSlot: number = 0
    @@ -222,7 +222,7 @@

    Splitscreen slot is unused for PC games.

    +
  • Defined in src/demo.ts:528
  • recordingClientSlot: null | number = null
    @@ -230,24 +230,24 @@
    +
  • Defined in src/demo.ts:534
  • stringTables: StringTables
    +
  • Defined in src/demo.ts:538
  • tickInterval: number = NaN

    Number of seconds per tick

    +
  • Defined in src/demo.ts:520
  • userMessages: UserMessages
    +
  • Defined in src/demo.ts:539
  • captureRejectionSymbol: typeof captureRejectionSymbol
    +
  • Defined in src/demo.ts:484
  • +
  • Defined in src/demo.ts:508
    • @@ -313,7 +313,7 @@

      Returns

      All connected player entities

      Returns readonly Player[]

    +
  • Defined in src/demo.ts:492
    • @@ -325,7 +325,7 @@

      Returns

      All team entities

      Returns readonly Team[]

    +
  • Defined in src/demo.ts:500
    • @@ -336,7 +336,7 @@

      Returns

      Number of ticks per second

      Returns number

    +
  • Defined in src/demo.ts:477
  • Methods

    @@ -351,7 +351,7 @@

    Parameters

    e: IDemoEndEvent

    Returns void

    +
  • Defined in src/demo.ts:854
    • @@ -364,7 +364,7 @@

      Parameters

      bytes: number

    Returns void

    +
  • Defined in src/demo.ts:1134
    • @@ -377,7 +377,7 @@

      Parameters

      eventName: string

    Returns null | ISupplementInfo

    +
  • Defined in src/demo.ts:641
  • +
  • Defined in src/demo.ts:985
  • +
  • Defined in src/demo.ts:989
    • @@ -406,7 +406,7 @@

      Parameters

      msg: CSVCMsgEncryptedData

    Returns boolean

    +
  • Defined in src/demo.ts:895
  • Returns void

    +
  • Defined in src/demo.ts:935
  • +
  • Defined in src/demo.ts:1095
  • +
  • Defined in src/demo.ts:996
  • +
  • Defined in src/demo.ts:865
  • +
  • Defined in src/demo.ts:1186
  • +
  • Defined in src/demo.ts:1142
    • @@ -467,7 +467,7 @@
    +
  • Defined in src/demo.ts:888
    • @@ -480,7 +480,7 @@

      Parameters

      bytes: number

    Returns boolean

    +
  • Defined in src/demo.ts:1103
  • +
  • Defined in src/demo.ts:824
  • Returns boolean

    +
  • Defined in src/demo.ts:246
  • @@ -547,7 +547,7 @@
    name: "error"
  • error: Error

    Returns boolean

    +
  • Defined in src/demo.ts:252
  • @@ -559,7 +559,7 @@
    name: "warning"
  • event: IDemoWarningEvent

    Returns boolean

    +
  • Defined in src/demo.ts:258
  • @@ -571,7 +571,7 @@
    name: "end"
  • event: IDemoEndEvent

    Returns boolean

    +
  • Defined in src/demo.ts:264
  • @@ -583,7 +583,7 @@
    name: "tickstart"
  • tick: number

    Returns boolean

    +
  • Defined in src/demo.ts:270
  • @@ -595,7 +595,7 @@
    name: "progress"
  • progressFraction: number

    Returns boolean

    +
  • Defined in src/demo.ts:278
  • @@ -607,7 +607,7 @@
    name: "usercmd"
  • userCmd: IUserCmd

    Returns boolean

    +
  • Defined in src/demo.ts:285
  • @@ -619,7 +619,7 @@
    name: "grenadeTrajectory"<
    event: IGrenadeTrajectoryEvent
  • Returns boolean

    +
  • Defined in src/demo.ts:297
  • @@ -631,7 +631,7 @@
    name: "molotovDetonate"event: IMolotovDetonateEvent
  • Returns boolean

    +
  • Defined in src/demo.ts:307
  • @@ -643,7 +643,7 @@
    name: "itemPurchase"
    <
    event: IItemPurchaseEvent
  • Returns boolean

    +
  • Defined in src/demo.ts:316
  • @@ -655,7 +655,7 @@
    name: "tickend"
  • tick: number

    Returns boolean

    +
  • Defined in src/demo.ts:322
  • @@ -667,7 +667,7 @@
    name: NetMessageName
  • msg: any

    Returns boolean

    +
  • Defined in src/demo.ts:324
  • Returns DemoFile

    +
  • Defined in src/demo.ts:245
  • Fired when a fatal error occurs during parsing.

    @@ -816,7 +816,7 @@
    error: Error
  • Returns void

    Returns DemoFile

    +
  • Defined in src/demo.ts:251
  • Fired when a non-fatal error occurs during parsing.

    @@ -841,7 +841,7 @@
    event: Returns void
  • Returns DemoFile

    +
  • Defined in src/demo.ts:257
  • Fired when parsing has finished, successfully or otherwise.

    @@ -866,7 +866,7 @@
    event: Returns void
  • Returns DemoFile

    +
  • Defined in src/demo.ts:263
  • Fired when a tick starts, before any tick command processing.

    @@ -891,7 +891,7 @@
    tick: number
  • Returns void

    Returns DemoFile

    +
  • Defined in src/demo.ts:269
  • Fired per command. Parameter is a value in range [0,1] that indicates @@ -918,7 +918,7 @@

    progressFraction: number
  • Returns void

    Returns DemoFile

    +
  • Defined in src/demo.ts:277
  • Fired each frame indicating all inputs of the recording player. @@ -944,7 +944,7 @@

    userCmd: Returns void
  • Returns DemoFile

    +
  • Defined in src/demo.ts:284
  • @@ -967,7 +967,7 @@
    event: string
  • Returns void

    Returns DemoFile

    +
  • Defined in src/demo.ts:287
  • @@ -990,7 +990,7 @@
    event: string
  • Returns void

    Returns DemoFile

    +
  • Defined in src/demo.ts:288
  • Fired when a grenade detonates, giving information about its trajectory and who threw it.

    @@ -1015,7 +1015,7 @@
    event: IGrenadeTrajectoryEvent
    <

    Returns void

  • Returns DemoFile

    +
  • Defined in src/demo.ts:293
  • Fired when a molotov or incendiary grenade detonates, giving information about who threw it. @@ -1041,7 +1041,7 @@

    event: IMolotovDetonateEvent
    Returns void
  • Returns DemoFile

    +
  • Defined in src/demo.ts:303
  • Fired when a player purchases an item.

    @@ -1066,7 +1066,7 @@
    event: IItemPurchaseEvent
  • <

    Returns void

    Returns DemoFile

    +
  • Defined in src/demo.ts:312
  • Fired after all commands are processed for a tick.

    @@ -1091,7 +1091,7 @@
    tick: number
  • Returns void

    Returns DemoFile

    +
  • Defined in src/demo.ts:321
  • @@ -1114,7 +1114,7 @@
    msg: CNETMsgNOP
  • Returns void

    Returns DemoFile

    +
  • Defined in src/demo.ts:325
  • @@ -1137,7 +1137,7 @@
    msg: CNETMsgDisconnect
  • Returns void

    Returns DemoFile

    +
  • Defined in src/demo.ts:326
  • @@ -1160,7 +1160,7 @@
    msg: CNETMsgFile
  • Returns void

    Returns DemoFile

    +
  • Defined in src/demo.ts:330
  • @@ -1183,7 +1183,7 @@
    msg: CNETMsgSplitScreenUser
  • Returns void

    Returns DemoFile

    +
  • Defined in src/demo.ts:331
  • @@ -1206,7 +1206,7 @@
    msg: CNETMsgTick
  • Returns void

    Returns DemoFile

    +
  • Defined in src/demo.ts:335
  • @@ -1229,7 +1229,7 @@
    msg: CNETMsgStringCmd
  • Returns void

    Returns DemoFile

    +
  • Defined in src/demo.ts:336
  • @@ -1252,7 +1252,7 @@
    msg: CNETMsgSetConVar
  • Returns void

    Returns DemoFile

    +
  • Defined in src/demo.ts:337
  • @@ -1275,7 +1275,7 @@
    msg: CNETMsgSignonState
  • Returns void

    Returns DemoFile

    +
  • Defined in src/demo.ts:338
  • @@ -1298,7 +1298,7 @@
    msg: CNETMsgPlayerAvatarData
    Returns void
  • Returns DemoFile

    +
  • Defined in src/demo.ts:342
  • @@ -1321,7 +1321,7 @@
    msg: CSVCMsgServerInfo
  • Returns void

    Returns DemoFile

    +
  • Defined in src/demo.ts:346
  • @@ -1344,7 +1344,7 @@
    msg: CSVCMsgSendTable
  • Returns void

    Returns DemoFile

    +
  • Defined in src/demo.ts:350
  • @@ -1367,7 +1367,7 @@
    msg: CSVCMsgClassInfo
  • Returns void

    Returns DemoFile

    +
  • Defined in src/demo.ts:351
  • @@ -1390,7 +1390,7 @@
    msg: CSVCMsgSetPause
  • <

    Returns void

    Returns DemoFile

    +
  • Defined in src/demo.ts:352
  • @@ -1413,7 +1413,7 @@
    msg: CSVCMsgCreateStringTable
    Returns void
  • Returns DemoFile

    +
  • Defined in src/demo.ts:353
  • @@ -1436,7 +1436,7 @@
    msg: CSVCMsgUpdateStringTable
    Returns void
  • Returns DemoFile

    +
  • Defined in src/demo.ts:357
  • @@ -1459,7 +1459,7 @@
    msg: CSVCMsgVoiceInit
  • Returns void

    Returns DemoFile

    +
  • Defined in src/demo.ts:361
  • @@ -1482,7 +1482,7 @@
    msg: CSVCMsgVoiceData
  • Returns void

    Returns DemoFile

    +
  • Defined in src/demo.ts:362
  • @@ -1505,7 +1505,7 @@
    msg: CSVCMsgPrint
  • Returns void

    Returns DemoFile

    +
  • Defined in src/demo.ts:363
  • @@ -1528,7 +1528,7 @@
    msg: CSVCMsgSounds
  • Returns void

    Returns DemoFile

    +
  • Defined in src/demo.ts:364
  • @@ -1551,7 +1551,7 @@
    msg: CSVCMsgSetView
  • Returns void

    Returns DemoFile

    +
  • Defined in src/demo.ts:365
  • @@ -1574,7 +1574,7 @@
    msg: CSVCMsgFixAngle
  • <

    Returns void

    Returns DemoFile

    +
  • Defined in src/demo.ts:366
  • @@ -1597,7 +1597,7 @@
    msg: CSVCMsgCrosshairAngle
  • Returns void

    Returns DemoFile

    +
  • Defined in src/demo.ts:367
  • @@ -1620,7 +1620,7 @@
    msg: CSVCMsgBSPDecal
  • <

    Returns void

    Returns DemoFile

    +
  • Defined in src/demo.ts:371
  • @@ -1643,7 +1643,7 @@
    msg: CSVCMsgSplitScreen
  • Returns void

    Returns DemoFile

    +
  • Defined in src/demo.ts:372
  • @@ -1666,7 +1666,7 @@
    msg: CSVCMsgUserMessage
  • Returns void

    Returns DemoFile

    +
  • Defined in src/demo.ts:376
  • @@ -1689,7 +1689,7 @@
    msg: CSVCMsgEntityMsg
  • Returns void

    Returns DemoFile

    +
  • Defined in src/demo.ts:380
  • @@ -1712,7 +1712,7 @@
    msg: CSVCMsgGameEvent
  • Returns void

    Returns DemoFile

    +
  • Defined in src/demo.ts:384
  • @@ -1735,7 +1735,7 @@
    msg: CSVCMsgPacketEntities
  • Returns void

    Returns DemoFile

    +
  • Defined in src/demo.ts:385
  • @@ -1758,7 +1758,7 @@
    msg: CSVCMsgTempEntities
  • Returns void

    Returns DemoFile

    +
  • Defined in src/demo.ts:389
  • @@ -1781,7 +1781,7 @@
    msg: CSVCMsgPrefetch
  • <

    Returns void

    Returns DemoFile

    +
  • Defined in src/demo.ts:393
  • @@ -1804,7 +1804,7 @@
    msg: CSVCMsgMenu
  • Returns void

    Returns DemoFile

    +
  • Defined in src/demo.ts:394
  • @@ -1827,7 +1827,7 @@
    msg: CSVCMsgGameEventList
  • <

    Returns void

    Returns DemoFile

    +
  • Defined in src/demo.ts:395
  • @@ -1850,7 +1850,7 @@
    msg: CSVCMsgGetCvarValue
  • Returns void

    Returns DemoFile

    +
  • Defined in src/demo.ts:399
  • @@ -1873,7 +1873,7 @@
    msg: CSVCMsgPaintmapData
  • Returns void

    Returns DemoFile

    +
  • Defined in src/demo.ts:403
  • @@ -1896,7 +1896,7 @@
    msg: CSVCMsgCmdKeyValues
  • Returns void

    Returns DemoFile

    +
  • Defined in src/demo.ts:407
  • @@ -1919,7 +1919,7 @@
    msg: CSVCMsgEncryptedData
  • <

    Returns void

    Returns DemoFile

    +
  • Defined in src/demo.ts:411
  • @@ -1942,7 +1942,7 @@
    msg: CSVCMsgHltvReplay
  • Returns void

    Returns DemoFile

    +
  • Defined in src/demo.ts:415
  • @@ -1965,7 +1965,7 @@
    msg: CSVCMsgBroadcastCommand
    Returns void
  • Returns DemoFile

    +
  • Defined in src/demo.ts:419
    • @@ -2020,7 +2020,7 @@

      Parameters

      buffer: Buffer

    Returns void

    +
  • Defined in src/demo.ts:813
    • @@ -2040,7 +2040,7 @@
      url: string

    Returns Promise<void>

    +
  • Defined in src/demo.ts:655
    • @@ -2053,7 +2053,7 @@

      Parameters

      stream: Readable

    Returns void

    +
  • Defined in src/demo.ts:750
    • @@ -2244,7 +2244,7 @@
      publicKey: nullReturns void
    +
  • Defined in src/demo.ts:844
  • +
  • Defined in src/demo.ts:952
  • +
  • Defined in src/entities.ts:358
  • serverClassBits: number = 0
    +
  • Defined in src/entities.ts:360
  • serverClasses: IServerClass[] = []
    +
  • Defined in src/entities.ts:346
  • staticBaselines: {
        [classId: number]: UnknownEntityProps | undefined;
    } = {}
    @@ -243,7 +243,7 @@

    Type declaration

  • [classId: number]: UnknownEntityProps | undefined
  • +
  • Defined in src/entities.ts:355
  • tableClassMap: {
        [tableName: string]: NetworkableConstructor;
    } = ...
    @@ -253,14 +253,14 @@

    Type declaration

  • [tableName: string]: NetworkableConstructor
  • +
  • Defined in src/entities.ts:362
  • transmitEntities: TransmitEntities = ...

    Set of which entities were active in the most recent tick.

    +
  • Defined in src/entities.ts:377
  • captureRejectionSymbol: typeof captureRejectionSymbol
    +
  • Defined in src/entities.ts:320
  • +
  • Defined in src/entities.ts:313
  • +
  • Defined in src/entities.ts:328
  • +
  • Defined in src/entities.ts:324
  • +
  • Defined in src/entities.ts:341
  • Methods

    @@ -354,7 +354,7 @@
    existingEntity: undefinedentityBaseline: undefined | UnknownEntityProps

    Returns Networkable<any>

    +
  • Defined in src/entities.ts:730
    • @@ -367,7 +367,7 @@

      Parameters

      name: string

    Returns undefined | CSVCMsgSendTable

    +
  • Defined in src/entities.ts:726
    • @@ -380,7 +380,7 @@

      Parameters

      table: CSVCMsgSendTable

    Returns readonly IFlattenedSendProp[]

    +
  • Defined in src/entities.ts:671
    • @@ -393,7 +393,7 @@

      Parameters

      table: CSVCMsgSendTable

    Returns readonly CSVCMsgSendTable_sendpropT[]

    +
  • Defined in src/entities.ts:607
    • @@ -408,7 +408,7 @@
      table: CSVCMsgSendTable
      excludes: readonly CSVCMsgSendTable_sendpropT[]

    Returns IFlattenedSendProp[]

    +
  • Defined in src/entities.ts:624
  • Returns void

    +
  • Defined in src/entities.ts:1081
    • @@ -434,7 +434,7 @@

      Parameters

      msg: CSVCMsgPacketEntities

    Returns void

    +
  • Defined in src/entities.ts:909
  • Returns void

    +
  • Defined in src/entities.ts:1104
    • @@ -460,7 +460,7 @@

      Parameters

      msg: CSVCMsgTempEntities

    Returns void

    +
  • Defined in src/entities.ts:871
    • @@ -477,7 +477,7 @@
      oldPlayerInfo: nullnull | IPlayerInfo

    Returns void

    +
  • Defined in src/entities.ts:1063
  • Returns readonly IPropUpdate[]

    +
  • Defined in src/entities.ts:786
  • Returns UnknownEntityProps

    +
  • Defined in src/entities.ts:1048
  • Returns void

    +
  • Defined in src/entities.ts:820
    • @@ -537,7 +537,7 @@
      msg: CSVCMsgPacketEntities
      frame: MutableTransmitEntities

    Returns void

    +
  • Defined in src/entities.ts:951
    • @@ -552,7 +552,7 @@
      index: number
      immediate: boolean

    Returns void

    +
  • Defined in src/entities.ts:762
  • Returns UnknownEntityProps

    +
  • Defined in src/entities.ts:857
    • @@ -610,7 +610,7 @@

      Parameters

      name: "datatablesready"

    Returns boolean

    +
  • Defined in src/entities.ts:223
  • @@ -622,7 +622,7 @@
    name: "baselineupdate"
    event: IBaselineUpdateEvent
  • Returns boolean

    +
  • Defined in src/entities.ts:232
  • @@ -634,7 +634,7 @@
    name: "create"
  • event: IEntityCreationEvent

    Returns boolean

    +
  • Defined in src/entities.ts:238
  • @@ -646,7 +646,7 @@
    name: "postcreate"
    event: IEntityCreationEvent
  • Returns boolean

    +
  • Defined in src/entities.ts:249
  • @@ -658,7 +658,7 @@
    name: "beforeremove"
    <
    event: IEntityBeforeRemoveEvent
  • Returns boolean

    +
  • Defined in src/entities.ts:258
  • @@ -670,7 +670,7 @@
    name: "remove"
  • event: IEntityRemoveEvent

    Returns boolean

    +
  • Defined in src/entities.ts:264
  • @@ -682,7 +682,7 @@
    name: "change"
  • event: IEntityChangeEvent

    Returns boolean

    +
  • Defined in src/entities.ts:270
  • @@ -694,7 +694,7 @@
    name: "tempent"
  • event: ITempEntEvent

    Returns boolean

    +
  • Defined in src/entities.ts:276
  • Returns Generator<T, any, unknown>

    +
  • Defined in src/entities.ts:518
    • @@ -740,7 +740,7 @@

      Parameters

      table: string

    Returns Generator<Networkable<UnknownEntityProps>, any, unknown>

    +
  • Defined in src/entities.ts:510
    • @@ -759,7 +759,7 @@
      accountId: number

    Returns null | Player

    +
  • Defined in src/entities.ts:469
    • @@ -778,7 +778,7 @@
      handle: EntityHandle

    Returns null | Networkable<UnknownEntityProps>

    +
  • Defined in src/entities.ts:440
  • +
  • Defined in src/entities.ts:480
    • @@ -816,7 +816,7 @@
      userId: number

    Returns null | Player

    +
  • Defined in src/entities.ts:458
    • @@ -849,7 +849,7 @@

      Parameters

      serverClass: string

    Returns TEntityClass

    +
  • Defined in src/entities.ts:488
    • @@ -862,7 +862,7 @@

      Parameters

      chunk: ByteBuffer

    Returns void

    +
  • Defined in src/entities.ts:526
    • @@ -882,7 +882,7 @@
      handle: number

    Returns boolean

    +
  • Defined in src/entities.ts:431
    • @@ -895,7 +895,7 @@

      Parameters

      demo: DemoFile

    Returns void

    +
  • Defined in src/entities.ts:397
    • @@ -987,7 +987,7 @@
      listener: (Returns void

    Returns Entities

    +
  • Defined in src/entities.ts:222
  • Fired when an instance baseline is updated.

    @@ -1012,7 +1012,7 @@
    event: Returns void
  • Returns Entities

    +
  • Defined in src/entities.ts:228
  • Fired when an entity is created.

    @@ -1037,7 +1037,7 @@
    event: Returns void
  • Returns Entities

    +
  • Defined in src/entities.ts:237
  • Fired after an entity has been created. @@ -1065,7 +1065,7 @@

    event: Returns void
  • Returns Entities

    +
  • Defined in src/entities.ts:245
  • Fired when an entity is marked for deletion.

    @@ -1090,7 +1090,7 @@
    event: Returns void
  • Returns Entities

    +
  • Defined in src/entities.ts:254
  • Fired during DemoFile#tickend when an entity is removed from the game.

    @@ -1115,7 +1115,7 @@
    event: Returns void
  • Returns Entities

    +
  • Defined in src/entities.ts:263
  • Fired when an entity property is changed.

    @@ -1140,7 +1140,7 @@
    event: Returns void
  • Returns Entities

    +
  • Defined in src/entities.ts:269
  • Fired when an a temp ent is created.

    @@ -1165,7 +1165,7 @@
    event: Returns void
  • Returns Entities

    +
  • Defined in src/entities.ts:275
    • diff --git a/docs/classes/GameEvent.html b/docs/classes/GameEvent.html index d6dfec82f..682daacd7 100644 --- a/docs/classes/GameEvent.html +++ b/docs/classes/GameEvent.html @@ -20,7 +20,7 @@

      Hierarchy

      • GameEvent
    +
  • Defined in src/gameevent.ts:18
  • @@ -54,24 +54,24 @@

    Parameters

    descriptor: CSVCMsgGameEventList_descriptorT

    Returns GameEvent

    +
  • Defined in src/gameevent.ts:23
  • Properties

    id: number
    +
  • Defined in src/gameevent.ts:20
  • keyNames: string[]
    +
  • Defined in src/gameevent.ts:21
  • name: string
    +
  • Defined in src/gameevent.ts:19
  • Methods

    @@ -86,7 +86,7 @@

    Parameters

    eventMsg: CSVCMsgGameEvent

    Returns Record<string, undefined | string | number | boolean | Uint8Array | Long>

    +
  • Defined in src/gameevent.ts:29
  • Returns void

    +
  • Defined in src/gameevents.ts:19
  • @@ -365,7 +365,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1266
  • @@ -389,7 +389,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1270
  • @@ -413,7 +413,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1274
  • @@ -437,7 +437,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1278
  • @@ -461,7 +461,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1282
  • @@ -485,7 +485,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1286
  • @@ -509,7 +509,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1290
  • @@ -533,7 +533,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1294
  • @@ -557,7 +557,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1298
  • @@ -581,7 +581,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1299
  • @@ -605,7 +605,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1303
  • @@ -629,7 +629,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1307
  • @@ -653,7 +653,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1311
  • @@ -677,7 +677,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1315
  • @@ -701,7 +701,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1319
  • @@ -725,7 +725,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1323
  • @@ -749,7 +749,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1327
  • @@ -773,7 +773,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1331
  • @@ -797,7 +797,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1335
  • @@ -821,7 +821,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1339
  • @@ -845,7 +845,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1343
  • @@ -869,7 +869,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1347
  • @@ -893,7 +893,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1351
  • @@ -917,7 +917,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1355
  • @@ -941,7 +941,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1359
  • @@ -965,7 +965,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1363
  • @@ -989,7 +989,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1367
  • @@ -1013,7 +1013,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1371
  • @@ -1037,7 +1037,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1375
  • @@ -1061,7 +1061,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1379
  • @@ -1085,7 +1085,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1380
  • @@ -1109,7 +1109,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1384
  • @@ -1133,7 +1133,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1385
  • @@ -1157,7 +1157,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1386
  • @@ -1181,7 +1181,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1390
  • @@ -1205,7 +1205,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1394
  • @@ -1229,7 +1229,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1398
  • @@ -1253,7 +1253,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1402
  • @@ -1277,7 +1277,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1406
  • @@ -1301,7 +1301,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1410
  • @@ -1325,7 +1325,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1411
  • @@ -1349,7 +1349,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1412
  • @@ -1373,7 +1373,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1413
  • @@ -1397,7 +1397,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1414
  • @@ -1421,7 +1421,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1418
  • @@ -1445,7 +1445,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1419
  • @@ -1469,7 +1469,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1423
  • @@ -1493,7 +1493,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1427
  • @@ -1517,7 +1517,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1428
  • @@ -1541,7 +1541,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1432
  • @@ -1565,7 +1565,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1436
  • @@ -1589,7 +1589,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1440
  • @@ -1613,7 +1613,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1444
  • @@ -1637,7 +1637,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1448
  • @@ -1661,7 +1661,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1452
  • @@ -1685,7 +1685,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1453
  • @@ -1709,7 +1709,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1454
  • @@ -1733,7 +1733,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1455
  • @@ -1757,7 +1757,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1459
  • @@ -1781,7 +1781,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1460
  • @@ -1805,7 +1805,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1464
  • @@ -1829,7 +1829,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1468
  • @@ -1853,7 +1853,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1472
  • @@ -1877,7 +1877,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1476
  • @@ -1901,7 +1901,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1480
  • @@ -1925,7 +1925,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1481
  • @@ -1949,7 +1949,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1485
  • @@ -1973,7 +1973,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1486
  • @@ -1997,7 +1997,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1490
  • @@ -2021,7 +2021,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1494
  • @@ -2045,7 +2045,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1498
  • @@ -2069,7 +2069,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1499
  • @@ -2093,7 +2093,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1503
  • @@ -2117,7 +2117,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1507
  • @@ -2141,7 +2141,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1508
  • @@ -2165,7 +2165,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1512
  • @@ -2189,7 +2189,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1516
  • @@ -2213,7 +2213,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1520
  • @@ -2237,7 +2237,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1524
  • @@ -2261,7 +2261,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1528
  • @@ -2285,7 +2285,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1532
  • @@ -2309,7 +2309,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1536
  • @@ -2333,7 +2333,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1537
  • @@ -2357,7 +2357,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1541
  • @@ -2381,7 +2381,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1545
  • @@ -2405,7 +2405,7 @@

    Returns voidReturns GameEvents

  • +
  • Defined in src/eventtypes.ts:1549
    • diff --git a/docs/classes/GameRules.html b/docs/classes/GameRules.html index 8d8e3e7ee..7cb2cab25 100644 --- a/docs/classes/GameRules.html +++ b/docs/classes/GameRules.html @@ -25,7 +25,7 @@

      Hierarchy

      • GameRules
    +
  • Defined in src/entities/gamerules.ts:7
  • @@ -84,7 +84,7 @@
    props: undefinedReturns GameRules
    +
  • Defined in src/entities/networkable.ts:48
  • Properties

    @@ -92,7 +92,7 @@
    +
  • Defined in src/entities/networkable.ts:46
  • classId: number
    @@ -100,7 +100,7 @@
    +
  • Defined in src/entities/networkable.ts:32
  • deleting: boolean = false
    @@ -108,7 +108,7 @@
    +
  • Defined in src/entities/networkable.ts:44
  • index: number
    @@ -116,13 +116,13 @@
    +
  • Defined in src/entities/networkable.ts:27
  • +
  • Defined in src/entities/networkable.ts:39
  • serialNum: number
    @@ -130,7 +130,7 @@
    +
  • Defined in src/entities/networkable.ts:37
  • Accessors

    @@ -144,7 +144,7 @@

    Returns

    Number uniquely identifying this entity. Should be unique thr

    Returns number

    +
  • Defined in src/entities/networkable.ts:20
  • +
  • Defined in src/entities/networkable.ts:121
  • +
  • Defined in src/entities/gamerules.ts:11
  • +
  • Defined in src/entities/gamerules.ts:36
  • +
  • Defined in src/entities/gamerules.ts:18
  • +
  • Defined in src/entities/gamerules.ts:29
  • +
  • Defined in src/entities/networkable.ts:13
  • Methods

    @@ -245,7 +245,7 @@
    tableName: T

    Returns ArrayType

    +
  • Defined in src/entities/networkable.ts:80
  • +
  • Defined in src/entities/networkable.ts:69
  • +
  • Defined in src/entities/networkable.ts:125
  • +
  • Defined in src/entities/networkable.ts:101
  • Returns number

    +
  • Defined in src/entities/networkable.ts:20
  • +
  • Defined in src/entities/networkable.ts:121
  • +
  • Defined in src/entities/networkable.ts:13
  • Methods

    @@ -195,7 +195,7 @@
    tableName: T

    Returns ArrayType

    +
  • Defined in src/entities/networkable.ts:80
    • @@ -225,7 +225,7 @@
      varName: Var

    Returns Props[Table][VarName]

    +
  • Defined in src/entities/networkable.ts:69
  • +
  • Defined in src/entities/networkable.ts:125
    • @@ -267,7 +267,7 @@
      newValue: Pr

    Returns void

    +
  • Defined in src/entities/networkable.ts:101
  • Returns number

    +
  • Defined in src/entities/player.ts:144
  • +
  • Defined in src/entities/player.ts:422
  • +
  • Defined in src/entities/player.ts:403
  • +
  • Defined in src/entities/player.ts:215
  • +
  • Defined in src/entities/player.ts:315
  • +
  • Defined in src/entities/player.ts:329
  • +
  • Defined in src/entities/player.ts:336
  • +
  • Defined in src/entities/player.ts:367
  • +
  • Defined in src/entities/player.ts:533
  • +
  • Defined in src/entities/player.ts:478
  • +
  • Defined in src/entities/player.ts:322
  • +
  • Defined in src/entities/player.ts:101
  • +
  • Defined in src/entities/player.ts:471
  • +
  • Defined in src/entities/player.ts:492
    • @@ -360,7 +360,7 @@

      Returns

      Number uniquely identifying this entity. Should be unique thr

      Returns number

    +
  • Defined in src/entities/networkable.ts:20
  • +
  • Defined in src/entities/player.ts:343
  • +
  • Defined in src/entities/player.ts:270
  • +
  • Defined in src/entities/player.ts:277
  • +
  • Defined in src/entities/player.ts:97
  • +
  • Defined in src/entities/player.ts:155
  • +
  • Defined in src/entities/player.ts:284
  • +
  • Defined in src/entities/player.ts:263
  • +
  • Defined in src/entities/networkable.ts:121
  • +
  • Defined in src/entities/player.ts:464
    • @@ -471,7 +471,7 @@

      Returns

      Player is transitioning from ducked -> standing or standin

      Returns boolean

    +
  • Defined in src/entities/player.ts:457
  • +
  • Defined in src/entities/player.ts:201
  • +
  • Defined in src/entities/player.ts:208
  • +
  • Defined in src/entities/player.ts:249
  • +
  • Defined in src/entities/player.ts:256
    • @@ -526,7 +526,7 @@

      Returns

      true if this player is recording the demo from their POV.

      Returns boolean

    +
  • Defined in src/entities/player.ts:540
  • +
  • Defined in src/entities/player.ts:443
  • +
  • Defined in src/entities/player.ts:375
  • +
  • Defined in src/entities/player.ts:450
  • +
  • Defined in src/entities/player.ts:308
  • +
  • Defined in src/entities/player.ts:148
  • +
  • Defined in src/entities/player.ts:499
    • @@ -601,7 +601,7 @@

      Returns

      Name of the model that should be rendered for this entity. (e

      Returns null | string

    +
  • Defined in src/entities/baseentity.ts:71
  • +
  • Defined in src/entities/baseentity.ts:32
  • +
  • Defined in src/entities/player.ts:359
  • +
  • Defined in src/entities/player.ts:194
  • +
  • Defined in src/entities/baseentity.ts:42
  • +
  • Defined in src/entities/player.ts:222
  • +
  • Defined in src/entities/player.ts:108
  • +
  • Defined in src/entities/player.ts:485
  • +
  • Defined in src/entities/player.ts:351
  • +
  • Defined in src/entities/networkable.ts:13
  • +
  • Defined in src/entities/player.ts:136
  • +
  • Defined in src/entities/player.ts:184
  • +
  • Defined in src/entities/player.ts:177
  • +
  • Defined in src/entities/baseentity.ts:59
    • @@ -764,7 +764,7 @@

      Returns

      Team number (0: Unassigned, 1: Spectator, 2: Terrorist, 3: Co

      Returns number

    +
  • Defined in src/entities/baseentity.ts:52
  • +
  • Defined in src/entities/player.ts:170
  • +
  • Defined in src/entities/player.ts:162
  • +
  • Defined in src/entities/player.ts:122
  • +
  • Defined in src/entities/player.ts:229
  • +
  • Defined in src/entities/player.ts:238
  • Methods

    @@ -845,7 +845,7 @@
    tableName: T

    Returns ArrayType

    +
  • Defined in src/entities/networkable.ts:80
  • +
  • Defined in src/entities/networkable.ts:69
  • +
  • Defined in src/entities/player.ts:415
  • +
  • Defined in src/entities/player.ts:432
  • +
  • Defined in src/entities/player.ts:386
    • @@ -961,7 +961,7 @@

      Parameters

      tableName: TableName

    Returns ElementType

    +
  • Defined in src/entities/player.ts:293
  • +
  • Defined in src/entities/networkable.ts:125
  • +
  • Defined in src/entities/networkable.ts:101
  • Returns GrenadeType

    +
  • Defined in src/entities/projectile.ts:19
    • @@ -158,7 +158,7 @@

      Returns

      Number uniquely identifying this entity. Should be unique thr

      Returns number

    +
  • Defined in src/entities/networkable.ts:20
  • +
  • Defined in src/entities/networkable.ts:121
    • @@ -182,7 +182,7 @@

      Returns

      Name of the model that should be rendered for this entity. (e

      Returns null | string

    +
  • Defined in src/entities/baseentity.ts:71
  • +
  • Defined in src/entities/baseentity.ts:32
  • +
  • Defined in src/entities/baseentity.ts:42
  • +
  • Defined in src/entities/baseentity.ts:15
  • +
  • Defined in src/entities/networkable.ts:13
  • +
  • Defined in src/entities/baseentity.ts:59
    • @@ -256,7 +256,7 @@

      Returns

      Team number (0: Unassigned, 1: Spectator, 2: Terrorist, 3: Co

      Returns number

    +
  • Defined in src/entities/baseentity.ts:52
  • Methods

    @@ -285,7 +285,7 @@
    tableName: T

    Returns ArrayType

    +
  • Defined in src/entities/networkable.ts:80
  • +
  • Defined in src/entities/networkable.ts:69
  • +
  • Defined in src/entities/networkable.ts:125
  • +
  • Defined in src/entities/networkable.ts:101
  • Returns void

    +
  • Defined in src/stringtables.ts:193
    • @@ -168,7 +168,7 @@

      Parameters

      msg: CSVCMsgUpdateStringTable

    Returns void

    +
  • Defined in src/stringtables.ts:380
  • Returns void

    +
  • Defined in src/stringtables.ts:254
    • @@ -230,7 +230,7 @@
      name: "create"
      event: IStringTable<any>

    Returns boolean

    +
  • Defined in src/stringtables.ts:129
  • @@ -242,7 +242,7 @@
    name: "postcreate"
    event: IStringTable<any>
  • Returns boolean

    +
  • Defined in src/stringtables.ts:135
  • @@ -254,7 +254,7 @@
    name: "update"
  • event: IStringTableUpdateEvent<any>

    Returns boolean

    +
  • Defined in src/stringtables.ts:144
    • @@ -282,7 +282,7 @@

      Parameters

      table: "userinfo"

    Returns undefined | IStringTable<IPlayerInfo>

    +
  • Defined in src/stringtables.ts:120
  • @@ -292,7 +292,7 @@

    Parameters

    table: WellKnownStringTable
  • Returns undefined | IStringTable<Buffer>

    +
  • Defined in src/stringtables.ts:121
  • @@ -302,7 +302,7 @@

    Parameters

    name: WellKnownStringTable
  • Returns undefined | IStringTable<any>

    +
  • Defined in src/stringtables.ts:178
    • @@ -328,7 +328,7 @@

      Parameters

      bitbuf: BitStream

    Returns void

    +
  • Defined in src/stringtables.ts:184
    • @@ -341,7 +341,7 @@

      Parameters

      messageEvents: DemoFile

    Returns void

    +
  • Defined in src/stringtables.ts:167
  • Returns StringTables

    +
  • Defined in src/stringtables.ts:128
  • Fired after a table is created. Entries have been populated by now.

    @@ -462,7 +462,7 @@
    table: Returns void
  • Returns StringTables

    +
  • Defined in src/stringtables.ts:134
  • Fired when a string table entry is updated.

    @@ -487,7 +487,7 @@
    event: Returns void
  • Returns StringTables

    +
  • Defined in src/stringtables.ts:140
    • diff --git a/docs/classes/Team.html b/docs/classes/Team.html index b87ce85ba..5b045e8ef 100644 --- a/docs/classes/Team.html +++ b/docs/classes/Team.html @@ -25,7 +25,7 @@

      Hierarchy

      • Team
    +
  • Defined in src/entities/team.ts:17
  • @@ -89,7 +89,7 @@
    props: undefinedReturns Team
    +
  • Defined in src/entities/networkable.ts:48
  • Properties

    @@ -97,7 +97,7 @@
    +
  • Defined in src/entities/networkable.ts:46
  • classId: number
    @@ -105,7 +105,7 @@
    +
  • Defined in src/entities/networkable.ts:32
  • deleting: boolean = false
    @@ -113,7 +113,7 @@
    +
  • Defined in src/entities/networkable.ts:44
  • index: number
    @@ -121,13 +121,13 @@
    +
  • Defined in src/entities/networkable.ts:27
  • props: CTeam
    +
  • Defined in src/entities/networkable.ts:39
  • serialNum: number
    @@ -135,7 +135,7 @@
    +
  • Defined in src/entities/networkable.ts:37
  • Accessors

    @@ -148,7 +148,7 @@

    Returns

    Clan name

    Returns string

    +
  • Defined in src/entities/team.ts:38
  • +
  • Defined in src/entities/team.ts:73
    • @@ -171,7 +171,7 @@

      Returns

      Number uniquely identifying this entity. Should be unique thr

      Returns number

    +
  • Defined in src/entities/networkable.ts:20
  • +
  • Defined in src/entities/networkable.ts:121
  • +
  • Defined in src/entities/team.ts:80
  • +
  • Defined in src/entities/team.ts:21
  • +
  • Defined in src/entities/team.ts:52
  • +
  • Defined in src/entities/team.ts:59
  • +
  • Defined in src/entities/team.ts:66
  • +
  • Defined in src/entities/networkable.ts:13
  • +
  • Defined in src/entities/team.ts:45
  • +
  • Defined in src/entities/team.ts:31
  • Methods

    @@ -302,7 +302,7 @@
    tableName: T

    Returns ArrayType

    +
  • Defined in src/entities/networkable.ts:80
  • +
  • Defined in src/entities/networkable.ts:69
  • +
  • Defined in src/entities/networkable.ts:125
  • +
  • Defined in src/entities/networkable.ts:101
  • Returns boolean

    +
  • Defined in src/usermessagetypes.ts:393
    • @@ -236,7 +236,7 @@

      Parameters

      demo: DemoFile

    Returns void

    +
  • Defined in src/usermessages.ts:11
  • @@ -362,7 +362,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:395
  • @@ -386,7 +386,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:399
  • @@ -410,7 +410,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:400
  • @@ -434,7 +434,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:401
  • @@ -458,7 +458,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:402
  • @@ -482,7 +482,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:403
  • @@ -506,7 +506,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:407
  • @@ -530,7 +530,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:408
  • @@ -554,7 +554,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:409
  • @@ -578,7 +578,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:413
  • @@ -602,7 +602,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:417
  • @@ -626,7 +626,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:418
  • @@ -650,7 +650,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:419
  • @@ -674,7 +674,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:420
  • @@ -698,7 +698,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:424
  • @@ -722,7 +722,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:428
  • @@ -746,7 +746,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:432
  • @@ -770,7 +770,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:436
  • @@ -794,7 +794,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:440
  • @@ -818,7 +818,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:444
  • @@ -842,7 +842,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:445
  • @@ -866,7 +866,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:449
  • @@ -890,7 +890,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:453
  • @@ -914,7 +914,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:457
  • @@ -938,7 +938,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:461
  • @@ -962,7 +962,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:465
  • @@ -986,7 +986,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:469
  • @@ -1010,7 +1010,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:473
  • @@ -1034,7 +1034,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:474
  • @@ -1058,7 +1058,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:478
  • @@ -1082,7 +1082,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:482
  • @@ -1106,7 +1106,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:486
  • @@ -1130,7 +1130,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:490
  • @@ -1154,7 +1154,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:494
  • @@ -1178,7 +1178,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:498
  • @@ -1202,7 +1202,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:502
  • @@ -1226,7 +1226,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:506
  • @@ -1250,7 +1250,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:510
  • @@ -1274,7 +1274,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:514
  • @@ -1298,7 +1298,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:518
  • @@ -1322,7 +1322,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:522
  • @@ -1346,7 +1346,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:526
  • @@ -1370,7 +1370,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:530
  • @@ -1394,7 +1394,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:534
  • @@ -1418,7 +1418,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:538
  • @@ -1442,7 +1442,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:542
  • @@ -1466,7 +1466,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:546
  • @@ -1490,7 +1490,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:550
  • @@ -1514,7 +1514,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:554
  • @@ -1538,7 +1538,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:558
  • @@ -1562,7 +1562,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:559
  • @@ -1586,7 +1586,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:563
  • @@ -1610,7 +1610,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:567
  • @@ -1634,7 +1634,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:571
  • @@ -1658,7 +1658,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:575
  • @@ -1682,7 +1682,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:579
  • @@ -1706,7 +1706,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:583
  • @@ -1730,7 +1730,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:587
  • @@ -1754,7 +1754,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:591
  • @@ -1778,7 +1778,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:595
  • @@ -1802,7 +1802,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:599
  • @@ -1826,7 +1826,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:603
  • @@ -1850,7 +1850,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:607
  • @@ -1874,7 +1874,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:611
  • @@ -1898,7 +1898,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:615
  • @@ -1922,7 +1922,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:619
  • @@ -1946,7 +1946,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:623
  • @@ -1970,7 +1970,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:624
  • @@ -1994,7 +1994,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:628
  • @@ -2018,7 +2018,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:632
  • @@ -2042,7 +2042,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:636
  • @@ -2066,7 +2066,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:640
  • @@ -2090,7 +2090,7 @@

    Returns voidReturns UserMessages

  • +
  • Defined in src/usermessagetypes.ts:644
    • diff --git a/docs/classes/Weapon.html b/docs/classes/Weapon.html index 5a2ac1bc0..35b3ec969 100644 --- a/docs/classes/Weapon.html +++ b/docs/classes/Weapon.html @@ -25,7 +25,7 @@

      Hierarchy

      • Weapon
    +
  • Defined in src/entities/weapon.ts:28
  • @@ -94,7 +94,7 @@
    props: undefinedReturns Weapon
    +
  • Defined in src/entities/networkable.ts:48
  • Properties

    @@ -102,7 +102,7 @@
    +
  • Defined in src/entities/networkable.ts:46
  • classId: number
    @@ -110,7 +110,7 @@
    +
  • Defined in src/entities/networkable.ts:32
  • deleting: boolean = false
    @@ -118,7 +118,7 @@
    +
  • Defined in src/entities/networkable.ts:44
  • index: number
    @@ -126,13 +126,13 @@
    +
  • Defined in src/entities/networkable.ts:27
  • +
  • Defined in src/entities/networkable.ts:39
  • serialNum: number
    @@ -140,7 +140,7 @@
    +
  • Defined in src/entities/networkable.ts:37
  • Accessors

    @@ -153,7 +153,7 @@

    Returns

    Entity class name of the weapon (e.g. "weapon_ak47"

    Returns null | string

    +
  • Defined in src/entities/weapon.ts:55
  • +
  • Defined in src/entities/weapon.ts:72
    • @@ -176,7 +176,7 @@

      Returns

      Number uniquely identifying this entity. Should be unique thr

      Returns number

    +
  • Defined in src/entities/networkable.ts:20
  • +
  • Defined in src/entities/networkable.ts:121
  • +
  • Defined in src/entities/weapon.ts:39
    • @@ -210,7 +210,7 @@

      Returns

      Name of the weapon (e.g. "Five-SeveN")

      Returns null | string

    +
  • Defined in src/entities/weapon.ts:46
    • @@ -222,7 +222,7 @@

      Returns

      Name of the model that should be rendered for this entity. (e

      Returns null | string

    +
  • Defined in src/entities/baseentity.ts:71
  • +
  • Defined in src/entities/baseentity.ts:32
  • +
  • Defined in src/entities/weapon.ts:32
    • @@ -257,7 +257,7 @@

      Returns

      The amount of ammo the owner holds for this weapon. Null if n

      Returns null | number

    +
  • Defined in src/entities/weapon.ts:86
  • +
  • Defined in src/entities/baseentity.ts:15
  • +
  • Defined in src/entities/weapon.ts:64
    • @@ -292,7 +292,7 @@

      Returns

      Quality of the item.

      Returns "normal" | "genuine" | "vintage" | "unusual" | "unique" | "community" | "developer" | "selfmade" | "customized" | "strange" | "completed" | "haunted" | "tournament" | "favored"

    +
  • Defined in src/entities/weapon.ts:96
  • +
  • Defined in src/entities/weapon.ts:79
  • +
  • Defined in src/entities/networkable.ts:13
  • +
  • Defined in src/entities/baseentity.ts:59
    • @@ -340,7 +340,7 @@

      Returns

      Team number (0: Unassigned, 1: Spectator, 2: Terrorist, 3: Co

      Returns number

    +
  • Defined in src/entities/baseentity.ts:52
  • Methods

    @@ -369,7 +369,7 @@
    tableName: T

    Returns ArrayType

    +
  • Defined in src/entities/networkable.ts:80
  • +
  • Defined in src/entities/networkable.ts:69
  • +
  • Defined in src/entities/networkable.ts:125
  • +
  • Defined in src/entities/networkable.ts:101
  • +
  • Defined in src/crosshair.ts:5
  • +
  • Defined in src/entities/player.ts:10
  • +
  • Defined in src/entities/team.ts:8
  • +
  • Defined in src/eventtypes.ts:576
  • +
  • Defined in src/crosshair.ts:37
  • +
  • Defined in src/sharecode.ts:5
  • Returns Uint8Array

    +
  • Defined in src/replaykeys.ts:21
  • Returns IDemoHeader

    +
  • Defined in src/demo.ts:210
  • +
  • Defined in src/demo.ts:231
  • +
  • Defined in src/demo.ts:219
  • +
  • Defined in src/demo.ts:238
  • +
  • Defined in src/entities.ts:154
  • +
  • Defined in src/entities.ts:187
  • +
  • Defined in src/entities.ts:170
  • +
  • Defined in src/entities.ts:66
  • prop: CSVCMsgSendTable_sendpropT
    +
  • Defined in src/entities.ts:65
  • table: CSVCMsgSendTable
    +
  • Defined in src/entities.ts:67
  • +
  • Defined in src/entities/player.ts:68
  • +
  • Defined in src/entities.ts:209
  • +
  • Defined in src/entities.ts:45
  • +
  • Defined in src/entities/projectile.ts:4
  • +
  • Defined in src/entities.ts:54
  • +
  • Defined in src/eventtypes.ts:1175
  • +
  • Defined in src/entities.ts:62
  • +
  • Defined in src/demo.ts:425
  • +
  • Defined in src/entities/weapon.ts:23
  • +
  • Defined in src/entities/team.ts:5
  • +
  • Defined in src/entities.ts:284
  • +
  • Defined in src/stringtables.ts:98